macOS client overlays, menus and notifications
This commit is contained in:
@@ -76,7 +76,11 @@ struct MainView: View {
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
overlays.install()
|
||||
let store = store
|
||||
let overlays = overlays
|
||||
overlays.install { key in
|
||||
ctrlGo(key, store, overlays)
|
||||
}
|
||||
}
|
||||
.onDisappear {
|
||||
overlays.uninstall()
|
||||
@@ -122,25 +126,22 @@ struct PaneTabButton: View {
|
||||
}
|
||||
}
|
||||
|
||||
private enum LeftTab {
|
||||
case lead, status, settings
|
||||
}
|
||||
|
||||
private struct LeftPane: View {
|
||||
@Environment(Store.self) private var store
|
||||
@ViewState private var tab = LeftTab.lead
|
||||
@Environment(Overlays.self) private var overlays
|
||||
|
||||
var body: some View {
|
||||
let tab = overlays.leftTab
|
||||
VStack(spacing: 0) {
|
||||
HStack(spacing: 4) {
|
||||
PaneTabButton(label: "Lead", active: tab == .lead) {
|
||||
tab = .lead
|
||||
overlays.leftTab = .lead
|
||||
}
|
||||
PaneTabButton(label: "Status", active: tab == .status) {
|
||||
tab = .status
|
||||
overlays.leftTab = .status
|
||||
}
|
||||
PaneTabButton(label: "Settings", active: tab == .settings) {
|
||||
tab = .settings
|
||||
overlays.leftTab = .settings
|
||||
}
|
||||
Spacer(minLength: 0)
|
||||
HStack(spacing: 10) {
|
||||
@@ -237,6 +238,7 @@ private struct TaskPane: View {
|
||||
|
||||
private struct TaskBar: View {
|
||||
@Environment(Store.self) private var store
|
||||
@Environment(Overlays.self) private var overlays
|
||||
@Environment(\.paneAccent) private var accent
|
||||
@ViewState private var previews: [Components.Schemas.Preview] = []
|
||||
@ViewState private var target = 0
|
||||
@@ -248,25 +250,25 @@ private struct TaskBar: View {
|
||||
let label = task.map { "\(project?.name ?? "") ▸ \($0.title)" } ?? project?.name ?? "No task"
|
||||
HStack(spacing: 0) {
|
||||
Color.clear.frame(maxWidth: .infinity, maxHeight: 1)
|
||||
Menu {
|
||||
ForEach(store.activeTasks(), id: \.task.id) { row in
|
||||
Button("\(row.project.name): \(row.task.title)") {
|
||||
store.focusTask(row.task.id)
|
||||
}
|
||||
}
|
||||
Button {
|
||||
overlays.openSwitcher(store)
|
||||
} label: {
|
||||
Text("\(label) ▾")
|
||||
.font(Fonts.font(13, weight: 700))
|
||||
.foregroundStyle(accent)
|
||||
.lineLimit(1)
|
||||
.truncationMode(.tail)
|
||||
.contentShape(Rectangle())
|
||||
}
|
||||
.menuStyle(.button)
|
||||
.buttonStyle(.plain)
|
||||
.menuIndicator(.hidden)
|
||||
.padding(.horizontal, 10)
|
||||
.padding(.vertical, 6)
|
||||
.help("Switch task (⌘K)")
|
||||
.onGeometryChange(for: CGRect.self) { g in
|
||||
g.frame(in: .named("window"))
|
||||
} action: { frame in
|
||||
overlays.pickerFrame = frame
|
||||
}
|
||||
.layoutPriority(1)
|
||||
HStack(spacing: 12) {
|
||||
Spacer(minLength: 0)
|
||||
|
||||
Reference in New Issue
Block a user