Drop the project page heading and split tasks from settings
This commit is contained in:
@@ -53,6 +53,7 @@ final class Overlays {
|
|||||||
var leadFocus = 0
|
var leadFocus = 0
|
||||||
var tabFocus = 0
|
var tabFocus = 0
|
||||||
var projectFocus = false
|
var projectFocus = false
|
||||||
|
var projectSettings = false
|
||||||
var taskList = false
|
var taskList = false
|
||||||
@ObservationIgnored var pickerFrame: CGRect = .zero
|
@ObservationIgnored var pickerFrame: CGRect = .zero
|
||||||
@ObservationIgnored var menuHover = false
|
@ObservationIgnored var menuHover = false
|
||||||
|
|||||||
@@ -14,9 +14,25 @@ struct ProjectView: View {
|
|||||||
@FocusState private var focused: Bool
|
@FocusState private var focused: Bool
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
|
VStack(spacing: 0) {
|
||||||
|
if store.focusedProject() != nil {
|
||||||
|
HStack(spacing: 4) {
|
||||||
|
PaneTabButton(label: "Tasks", active: !overlays.projectSettings) {
|
||||||
|
overlays.projectSettings = false
|
||||||
|
}
|
||||||
|
PaneTabButton(label: "Settings", active: overlays.projectSettings) {
|
||||||
|
overlays.projectSettings = true
|
||||||
|
}
|
||||||
|
Spacer(minLength: 0)
|
||||||
|
}
|
||||||
|
.padding(.horizontal, 12)
|
||||||
|
.overlay(alignment: .bottom) {
|
||||||
|
Rectangle().fill(Palette.border).frame(height: 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
ScrollView {
|
ScrollView {
|
||||||
if let p = store.focusedProject() {
|
if let p = store.focusedProject() {
|
||||||
ProjectBlock(project: p, todo: todos[p.id])
|
ProjectBlock(project: p, todo: todos[p.id], settings: overlays.projectSettings)
|
||||||
.padding(.horizontal, 16)
|
.padding(.horizontal, 16)
|
||||||
.padding(.top, 8)
|
.padding(.top, 8)
|
||||||
.padding(.bottom, 16)
|
.padding(.bottom, 16)
|
||||||
@@ -24,6 +40,7 @@ struct ProjectView: View {
|
|||||||
Muted(text: "No project selected.")
|
Muted(text: "No project selected.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||||
.focusable()
|
.focusable()
|
||||||
.focusEffectDisabled()
|
.focusEffectDisabled()
|
||||||
@@ -136,28 +153,14 @@ private struct ProjectWorkflowMenu: View {
|
|||||||
private struct ProjectBlock: View {
|
private struct ProjectBlock: View {
|
||||||
let project: Project
|
let project: Project
|
||||||
let todo: Result<Todo, ApiError>?
|
let todo: Result<Todo, ApiError>?
|
||||||
|
let settings: Bool
|
||||||
@Environment(Store.self) private var store
|
@Environment(Store.self) private var store
|
||||||
@Environment(Overlays.self) private var overlays
|
@Environment(Overlays.self) private var overlays
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
let active = (store.tasks[project.id] ?? []).filter { $0.status == .active }
|
let active = (store.tasks[project.id] ?? []).filter { $0.status == .active }
|
||||||
VStack(alignment: .leading, spacing: 0) {
|
VStack(alignment: .leading, spacing: 0) {
|
||||||
HStack(alignment: .firstTextBaseline, spacing: 6) {
|
if settings {
|
||||||
Text(project.name).font(Fonts.font(13, weight: 700))
|
|
||||||
Text(project.defaultBranch).font(Fonts.font(11)).foregroundStyle(Palette.muted)
|
|
||||||
}
|
|
||||||
.padding(.top, 16)
|
|
||||||
.padding(.bottom, 6)
|
|
||||||
heading("Tasks")
|
|
||||||
if active.isEmpty {
|
|
||||||
Text("No active tasks.")
|
|
||||||
.foregroundStyle(Palette.muted)
|
|
||||||
.padding(.horizontal, 10)
|
|
||||||
.padding(.vertical, 6)
|
|
||||||
}
|
|
||||||
TaskRows(active: active)
|
|
||||||
heading("TODO")
|
|
||||||
TodoBlock(project: project, todo: todo, active: active)
|
|
||||||
heading("Settings")
|
heading("Settings")
|
||||||
Grid(alignment: .leading, horizontalSpacing: 12, verticalSpacing: 4) {
|
Grid(alignment: .leading, horizontalSpacing: 12, verticalSpacing: 4) {
|
||||||
GridRow {
|
GridRow {
|
||||||
@@ -183,6 +186,18 @@ private struct ProjectBlock: View {
|
|||||||
.help("Create a task in this project on a timer")
|
.help("Create a task in this project on a timer")
|
||||||
}
|
}
|
||||||
ScheduleRows(project: project)
|
ScheduleRows(project: project)
|
||||||
|
} else {
|
||||||
|
heading("Tasks")
|
||||||
|
if active.isEmpty {
|
||||||
|
Text("No active tasks.")
|
||||||
|
.foregroundStyle(Palette.muted)
|
||||||
|
.padding(.horizontal, 10)
|
||||||
|
.padding(.vertical, 6)
|
||||||
|
}
|
||||||
|
TaskRows(active: active)
|
||||||
|
heading("TODO")
|
||||||
|
TodoBlock(project: project, todo: todo, active: active)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.frame(maxWidth: .infinity, alignment: .leading)
|
.frame(maxWidth: .infinity, alignment: .leading)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user