mirror of
https://github.com/XcodesOrg/XcodesApp.git
synced 2026-04-26 14:57:37 +00:00
Update install and select state representations in Xcode list
This commit is contained in:
parent
ee08684e01
commit
d122014b74
1 changed files with 31 additions and 14 deletions
|
|
@ -41,23 +41,13 @@ struct XcodeListView: View {
|
||||||
|
|
||||||
Text(verbatim: xcode.path ?? "")
|
Text(verbatim: xcode.path ?? "")
|
||||||
.font(.caption)
|
.font(.caption)
|
||||||
.foregroundColor(selectedXcodeID == xcode.id ? Color(NSColor.selectedMenuItemTextColor) : Color(NSColor.secondaryLabelColor))
|
.foregroundColor(.secondary)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Spacer()
|
Spacer()
|
||||||
|
|
||||||
if xcode.selected {
|
selectControl(for: xcode)
|
||||||
Tag(text: "SELECTED")
|
installControl(for: xcode)
|
||||||
.foregroundColor(.green)
|
|
||||||
}
|
|
||||||
|
|
||||||
Button(xcode.installed ? "INSTALLED" : "INSTALL") {
|
|
||||||
print("Installing...")
|
|
||||||
}
|
|
||||||
.buttonStyle(AppStoreButtonStyle(installed: xcode.installed,
|
|
||||||
highlighted: selectedXcodeID == xcode.id))
|
|
||||||
.disabled(xcode.installed)
|
|
||||||
}
|
}
|
||||||
.contextMenu {
|
.contextMenu {
|
||||||
InstallButton(xcode: xcode)
|
InstallButton(xcode: xcode)
|
||||||
|
|
@ -73,7 +63,7 @@ struct XcodeListView: View {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ViewBuilder
|
@ViewBuilder
|
||||||
func appIconView(for xcode: Xcode) -> some View {
|
func appIconView(for xcode: Xcode) -> some View {
|
||||||
if let icon = xcode.icon {
|
if let icon = xcode.icon {
|
||||||
|
|
@ -84,6 +74,33 @@ struct XcodeListView: View {
|
||||||
.foregroundColor(.secondary)
|
.foregroundColor(.secondary)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private func selectControl(for xcode: Xcode) -> some View {
|
||||||
|
if xcode.selected {
|
||||||
|
Image(systemName: "checkmark.circle.fill")
|
||||||
|
.foregroundColor(.green)
|
||||||
|
.help("This version is selected as the default")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private func installControl(for xcode: Xcode) -> some View {
|
||||||
|
if xcode.selected {
|
||||||
|
Button("DEFAULT") { appState.select(id: xcode.id) }
|
||||||
|
.buttonStyle(AppStoreButtonStyle(installed: false, highlighted: selectedXcodeID == xcode.id))
|
||||||
|
.disabled(true)
|
||||||
|
.help("This version is selected as the default")
|
||||||
|
} else if xcode.installed {
|
||||||
|
Button("SELECT") { appState.select(id: xcode.id) }
|
||||||
|
.buttonStyle(AppStoreButtonStyle(installed: false, highlighted: selectedXcodeID == xcode.id))
|
||||||
|
.help("Select this version as the default")
|
||||||
|
} else {
|
||||||
|
Button("INSTALL") { print("Installing...") }
|
||||||
|
.buttonStyle(AppStoreButtonStyle(installed: true, highlighted: selectedXcodeID == xcode.id))
|
||||||
|
.help("Install this version")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct XcodeListView_Previews: PreviewProvider {
|
struct XcodeListView_Previews: PreviewProvider {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue