Commit 10ba31996e

10ba31996eb20bd17990b224284e588fc0dad02c

parent: d4c865455d

Verified · cmc

cmc <hello@cleberg.net> · 2026-11-22 20:48 UTC

Mac agenda: text styles instead of fixed sizes

Rows, day headers, the Overdue header, grid and now lines use text
styles (body, callout, subheadline, caption, caption2) in place of
8 to 13 pt system fonts. The gutter width and the priority badge are
scaled metrics, and headers grow with their text.

Ref #221

Layout: unified · split

Sources/Orgstar/AgendaRowView.swift +17 −15
@@ -17,6 +17,8 @@ struct AgendaRowView: View {
1717 /// Marked for a bulk action.
1818 var marked = false
1919 @Environment(\.orgTheme) private var theme
20 @ScaledMetric(relativeTo: .callout) private var gutterWidth = AgendaRowView.gutterWidth
21 @ScaledMetric(relativeTo: .caption) private var badgeSize: CGFloat = 18
2022
2123 static let gutterWidth: CGFloat = 92
2224
@@ -35,7 +37,7 @@ struct AgendaRowView: View {
3537 if let todo = row.todo {
3638 let color = theme.dynamic(row.isDone ? .systemGreen : .systemRed) { [theme, row] in theme.todoColor(todo, isDone: row.isDone, dark: $0) }
3739 Text(todo)
38 .font(.system(size: 10, weight: .bold))
40 .font(.caption.weight(.bold))
3941 .foregroundStyle(color)
4042 .padding(.horizontal, 7)
4143 .padding(.vertical, 2)
@@ -43,7 +45,7 @@ struct AgendaRowView: View {
4345 .fixedSize()
4446 }
4547 priorityBadge
46 .frame(width: 18)
48 .frame(width: badgeSize)
4749 }
4850 .padding(.horizontal, 16)
4951 .padding(.vertical, 6)
@@ -70,18 +72,18 @@ struct AgendaRowView: View {
7072 private var gutter: some View {
7173 VStack(alignment: .leading, spacing: 3) {
7274 Text(row.gutter)
73 .font(.system(size: 12, weight: row.status == .overdue || row.status == .dueSoon ? .semibold : .regular).monospacedDigit())
75 .font(.callout.weight(row.status == .overdue || row.status == .dueSoon ? .semibold : .regular).monospacedDigit())
7476 .foregroundStyle(statusColor)
7577 .lineLimit(1)
7678 .minimumScaleFactor(0.8)
7779 if let symbol {
7880 Image(systemName: symbol)
79 .font(.system(size: row.icon == .event ? 8 : 10, weight: .semibold))
81 .font(.caption.weight(.semibold))
82 .imageScale(row.icon == .event ? .small : .medium)
8083 .foregroundStyle(iconColor)
81 .frame(height: 12)
8284 }
8385 }
84 .frame(width: Self.gutterWidth, alignment: .leading)
86 .frame(width: gutterWidth, alignment: .leading)
8587 }
8688
8789 /// Overdue entries show a warning, done ones a check, as the status says first.
@@ -111,12 +113,12 @@ struct AgendaRowView: View {
111113 ?? theme.dynamic { [theme, row] in theme.categoryColor(row.category, dark: $0) })
112114 .frame(width: 6, height: 6)
113115 Text(row.category)
114 .font(.system(size: 11))
116 .font(.subheadline)
115117 .foregroundStyle(theme.color("agenda-category") ?? .secondary)
116118 .lineLimit(1)
117119 if let detail = row.prefixDetail {
118120 Text(detail)
119 .font(.system(size: 11))
121 .font(.subheadline)
120122 .foregroundStyle(.secondary)
121123 .lineLimit(1)
122124 .truncationMode(.middle)
@@ -127,14 +129,14 @@ struct AgendaRowView: View {
127129 private var titleLine: some View {
128130 HStack(spacing: 6) {
129131 Text(row.title.isEmpty ? " " : row.title)
130 .font(.system(size: 13))
132 .font(.body)
131133 .strikethrough(row.isDone)
132134 .foregroundStyle(row.isDone ? AnyShapeStyle(.secondary) : AnyShapeStyle(theme.color("foreground") ?? .primary))
133135 .lineLimit(1)
134136 .truncationMode(.tail)
135137 ForEach([row.progress, row.detail].compactMap { $0 }, id: \.self) { progress in
136138 Text(progress)
137 .font(.system(size: 10, weight: .semibold).monospacedDigit())
139 .font(.caption.weight(.semibold).monospacedDigit())
138140 .foregroundStyle(.secondary)
139141 .padding(.horizontal, 6)
140142 .padding(.vertical, 1)
@@ -143,7 +145,7 @@ struct AgendaRowView: View {
143145 }
144146 ForEach(row.tags, id: \.self) { tag in
145147 Text(tag)
146 .font(.system(size: 10, weight: .medium))
148 .font(.caption.weight(.medium))
147149 .foregroundStyle(theme.color("tags") ?? .secondary)
148150 .padding(.horizontal, 6)
149151 .padding(.vertical, 1)
@@ -158,14 +160,14 @@ struct AgendaRowView: View {
158160 if let priority = row.priority {
159161 let color = theme.dynamic(.systemOrange) { [theme] in theme.priorityColor(priority, dark: $0) }
160162 Text(priority)
161 .font(.system(size: 10, weight: .bold))
163 .font(.caption.weight(.bold))
162164 .foregroundStyle(color)
163 .frame(width: 18, height: 18)
165 .frame(width: badgeSize, height: badgeSize)
164166 .background(Circle().fill(color.opacity(0.14)))
165167 .overlay(Circle().strokeBorder(color.opacity(0.6), lineWidth: 1))
166168 .help("Priority \(priority)")
167169 } else {
168 Color.clear.frame(width: 18, height: 18)
170 Color.clear.frame(width: badgeSize, height: badgeSize)
169171 }
170172 }
171173}
@@ -179,7 +181,7 @@ struct HabitGraph: View {
179181 HStack(spacing: 1) {
180182 ForEach(cells, id: \.day) { cell in
181183 Text(String(cell.glyph))
182 .font(.system(size: 9, weight: .bold, design: .monospaced))
184 .font(.caption2.monospaced().weight(.bold))
183185 .frame(width: 8, height: 14)
184186 .background(color(cell.face))
185187 .help(Self.label(cell))
Sources/Orgstar/AgendaView.swift +14 −13
@@ -69,6 +69,7 @@ struct AgendaView: View {
6969 @State var pickedDate = Date()
7070 @AppStorage("agendaOverdueExpanded") private var overdueShown = true
7171 @State private var hovered: String?
72 @ScaledMetric(relativeTo: .callout) private var gutterWidth = AgendaRowView.gutterWidth
7273 @FocusState private var focused: Bool
7374 @AppStorage("agendaSpan") var span = 10
7475 @AppStorage("agendaStartOffset") var startOffset = 0
@@ -307,7 +308,7 @@ struct AgendaView: View {
307308 }
308309 }
309310 } header: {
310 header { Text(block.header).font(.system(size: 13, weight: .semibold)) }
311 header { Text(block.header).font(.body.weight(.semibold)) }
311312 }
312313 }
313314 } else if isAgenda {
@@ -324,7 +325,7 @@ struct AgendaView: View {
324325 rowView(Line(id: "list:\(index)", row: row, day: agenda.today), showsGutter: false)
325326 }
326327 } header: {
327 header { Text(listTitle).font(.system(size: 13, weight: .semibold)) }
328 header { Text(listTitle).font(.body.weight(.semibold)) }
328329 }
329330 }
330331 }
@@ -477,8 +478,8 @@ struct AgendaView: View {
477478 private func gridLine(_ time: Int) -> some View {
478479 HStack(spacing: 6) {
479480 Text(String(format: "%02d:%02d", time / 100, time % 100))
480 .font(.system(size: 10).monospacedDigit())
481 .frame(width: AgendaRowView.gutterWidth, alignment: .leading)
481 .font(.caption.monospacedDigit())
482 .frame(width: gutterWidth, alignment: .leading)
482483 GridRule().stroke(style: StrokeStyle(lineWidth: 0.5, dash: [2, 3])).frame(height: 1)
483484 }
484485 .foregroundStyle(.tertiary)
@@ -490,7 +491,7 @@ struct AgendaView: View {
490491 private func header(@ViewBuilder _ content: () -> some View) -> some View {
491492 HStack(spacing: 6) { content() }
492493 .padding(.horizontal, 16)
493 .frame(height: 30)
494 .frame(minHeight: 30)
494495 .frame(maxWidth: .infinity, alignment: .leading)
495496 .background(theme.color("agenda-background") ?? Color(nsColor: .textBackgroundColor))
496497 .overlay(alignment: .bottom) { Divider() }
@@ -502,19 +503,19 @@ struct AgendaView: View {
502503 return header {
503504 if let relative = group.relativeName(today: agenda.today) {
504505 Text(relative)
505 .font(.system(size: 13, weight: .bold))
506 .font(.body.weight(.bold))
506507 .foregroundStyle(color)
507508 Text("·").foregroundStyle(.tertiary)
508509 }
509510 Text(Self.format(group.day, Days.date(group.day).year == Days.date(agenda.today).year ? "EEEE d MMMM" : "EEEE d MMMM yyyy"))
510 .font(.system(size: 13, weight: group.isToday ? .bold : .semibold))
511 .font(.body.weight(group.isToday ? .bold : .semibold))
511512 .foregroundStyle(color)
512513 Spacer()
513514 Button {
514515 capture(on: group.day)
515516 } label: {
516517 Image(systemName: "plus")
517 .font(.system(size: 12, weight: .semibold))
518 .font(.callout.weight(.semibold))
518519 .frame(width: 22, height: 22)
519520 .contentShape(Rectangle())
520521 }
@@ -532,11 +533,11 @@ struct AgendaView: View {
532533 } label: {
533534 HStack(spacing: 6) {
534535 Image(systemName: "chevron.right")
535 .font(.system(size: 10, weight: .bold))
536 .font(.caption.weight(.bold))
536537 .rotationEffect(.degrees(overdueShown ? 90 : 0))
537 Text("Overdue").font(.system(size: 12, weight: .semibold))
538 Text("Overdue").font(.callout.weight(.semibold))
538539 Text("\(count)")
539 .font(.system(size: 10, weight: .bold).monospacedDigit())
540 .font(.caption.weight(.bold).monospacedDigit())
540541 .padding(.horizontal, 6)
541542 .padding(.vertical, 1)
542543 .background(Capsule().fill(color.opacity(0.15)))
@@ -555,8 +556,8 @@ struct AgendaView: View {
555556 private var nowLine: some View {
556557 HStack(spacing: 6) {
557558 Text(now.formatted(.dateTime.hour(.twoDigits(amPM: .omitted)).minute()))
558 .font(.system(size: 10, weight: .semibold).monospacedDigit())
559 .frame(width: AgendaRowView.gutterWidth, alignment: .leading)
559 .font(.caption.weight(.semibold).monospacedDigit())
560 .frame(width: gutterWidth, alignment: .leading)
560561 Circle().frame(width: 6, height: 6)
561562 Rectangle().frame(height: 1)
562563 }