Design review: agenda !467
12 files changed, +390 −215
Layout: unified · split
Sources/OrgApp/FlowLayout.swift added +46
| @@ -0,0 +1,46 @@ | ||
| 1 | import SwiftUI | |
| 2 | ||
| 3 | /// Lays its subviews out in a row, starting a new row where the next one doesn't fit. A subview | |
| 4 | /// wider than the whole width gets the whole width. | |
| 5 | public struct FlowLayout: Layout { | |
| 6 | public var spacing: CGFloat | |
| 7 | public var lineSpacing: CGFloat | |
| 8 | ||
| 9 | public init(spacing: CGFloat = 5, lineSpacing: CGFloat = 3) { | |
| 10 | self.spacing = spacing | |
| 11 | self.lineSpacing = lineSpacing | |
| 12 | } | |
| 13 | ||
| 14 | public func sizeThatFits(proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) -> CGSize { | |
| 15 | let frames = place(subviews, width: proposal.width ?? .infinity) | |
| 16 | let width = frames.map(\.maxX).max() ?? 0 | |
| 17 | return CGSize(width: proposal.width.map { min($0, width) } ?? width, height: frames.map(\.maxY).max() ?? 0) | |
| 18 | } | |
| 19 | ||
| 20 | public func placeSubviews(in bounds: CGRect, proposal: ProposedViewSize, subviews: Subviews, cache: inout ()) { | |
| 21 | for (subview, frame) in zip(subviews, place(subviews, width: bounds.width)) { | |
| 22 | subview.place(at: CGPoint(x: bounds.minX + frame.minX, y: bounds.minY + frame.minY), proposal: ProposedViewSize(frame.size)) | |
| 23 | } | |
| 24 | } | |
| 25 | ||
| 26 | /// Each subview's frame, in rows from the top left. | |
| 27 | private func place(_ subviews: Subviews, width: CGFloat) -> [CGRect] { | |
| 28 | var frames: [CGRect] = [] | |
| 29 | var x: CGFloat = 0 | |
| 30 | var y: CGFloat = 0 | |
| 31 | var rowHeight: CGFloat = 0 | |
| 32 | for subview in subviews { | |
| 33 | var size = subview.sizeThatFits(.unspecified) | |
| 34 | if size.width > width { size = subview.sizeThatFits(ProposedViewSize(width: width, height: nil)) } | |
| 35 | if x > 0, x + size.width > width { | |
| 36 | x = 0 | |
| 37 | y += rowHeight + lineSpacing | |
| 38 | rowHeight = 0 | |
| 39 | } | |
| 40 | frames.append(CGRect(origin: CGPoint(x: x, y: y), size: CGSize(width: min(size.width, width), height: size.height))) | |
| 41 | x += size.width + spacing | |
| 42 | rowHeight = max(rowHeight, size.height) | |
| 43 | } | |
| 44 | return frames | |
| 45 | } | |
| 46 | } | |
Sources/OrgApp/UserConfig.swift +1 −1
| @@ -331,7 +331,7 @@ public enum UserConfig { | ||
| 331 | 331 | comment: "a heading in the project with one of these tags unsticks it; * for any tag", legacy: ""), |
| 332 | 332 | Setting(section: "org-stuck-projects", key: "regexp", defaultsKey: "stuckProjectsRegexp", kind: .string, fallback: .string(""), |
| 333 | 333 | comment: "text in the project matching this Emacs regexp unsticks it", legacy: ""), |
| 334 | Setting(section: "org-agenda-time-grid", key: "when", defaultsKey: "agendaTimeGridWhen", kind: .string, fallback: .string("daily today require-timed"), | |
| 334 | Setting(section: "org-agenda-time-grid", key: "when", defaultsKey: "agendaTimeGridWhen", kind: .string, fallback: .string("daily today require-timed remove-match"), | |
| 335 | 335 | comment: "daily (one-day views), today, weekly (every day), require-timed (only with timed entries), remove-match (no line at an entry's time)", legacy: ""), |
| 336 | 336 | Setting(section: "org-agenda-time-grid", key: "times", defaultsKey: "agendaTimeGridTimes", kind: .string, fallback: .string("800 1000 1200 1400 1600 1800 2000"), |
| 337 | 337 | comment: "the grid's times as HHMM, separated by spaces", legacy: ""), |
Sources/OrgPresentation/AgendaRows.swift +21
| @@ -99,6 +99,27 @@ public struct AgendaRow: Sendable, Equatable, Identifiable { | ||
| 99 | 99 | /// The calendar's color for an event. |
| 100 | 100 | public var color: RGBA? { event?.color } |
| 101 | 101 | |
| 102 | /// The gutter as its lines: a timed row's start over its end, else the status. | |
| 103 | public var gutterLines: [String] { | |
| 104 | start == nil ? [gutter] : gutter.split(separator: "–", maxSplits: 1).map(String.init) | |
| 105 | } | |
| 106 | ||
| 107 | /// The SF Symbol under the gutter: a warning for overdue entries and a check for done ones, | |
| 108 | /// as the status says first, else one for the kind of row. | |
| 109 | public var symbol: String? { | |
| 110 | guard let icon else { return nil } | |
| 111 | if status == .overdue { return "exclamationmark.circle.fill" } | |
| 112 | if status == .done { return "checkmark.circle.fill" } | |
| 113 | switch icon { | |
| 114 | case .scheduled: return "calendar" | |
| 115 | case .deadline: return "flag.fill" | |
| 116 | case .habit: return "repeat" | |
| 117 | case .event: return "circle.fill" | |
| 118 | case .reminder: return "circle" | |
| 119 | case .timestamp: return start == nil ? "calendar" : "clock" | |
| 120 | } | |
| 121 | } | |
| 122 | ||
| 102 | 123 | /// Nil for the time grid and the current-time line. |
| 103 | 124 | public init?(item: AgendaItem, day: Int, today: Int) { |
| 104 | 125 | if item.kind == .timeGrid || item.kind == .currentTime { return nil } |
Sources/Orgstar/AgendaRowView.swift +88 −80
| @@ -5,8 +5,8 @@ import OrgCore | ||
| 5 | 5 | import OrgPresentation |
| 6 | 6 | import SwiftUI |
| 7 | 7 | |
| 8 | /// One agenda line: the time or status over an icon, the category above the title, progress | |
| 9 | /// and tags after it, and the TODO keyword and priority at the end. | |
| 8 | /// One agenda line: the time or status over an icon; above the title the category, progress and | |
| 9 | /// tags, with the TODO keyword and priority at the end; a habit's graph under the title. | |
| 10 | 10 | struct AgendaRowView: View { |
| 11 | 11 | let row: AgendaRow |
| 12 | 12 | /// The agenda day the row is on, for habit graphs. |
| @@ -17,33 +17,32 @@ struct AgendaRowView: View { | ||
| 17 | 17 | /// Marked for a bulk action. |
| 18 | 18 | var marked = false |
| 19 | 19 | @Environment(\.orgTheme) private var theme |
| 20 | @ScaledMetric(relativeTo: .callout) private var gutterWidth = AgendaRowView.gutterWidth | |
| 21 | @Environment(\.colorSchemeContrast) private var contrast | |
| 22 | @Environment(\.accessibilityDifferentiateWithoutColor) private var withoutColor | |
| 23 | @ScaledMetric(relativeTo: .caption) private var badgeSize: CGFloat = 18 | |
| 20 | 24 | |
| 21 | 25 | static let gutterWidth: CGFloat = 92 |
| 22 | 26 | |
| 23 | 27 | var body: some View { |
| 24 | HStack(alignment: .center, spacing: 12) { | |
| 28 | HStack(alignment: .top, spacing: 12) { | |
| 25 | 29 | if showsGutter { gutter } |
| 26 | 30 | VStack(alignment: .leading, spacing: 2) { |
| 27 | if !row.category.isEmpty { categoryLine } | |
| 28 | titleLine | |
| 29 | } | |
| 30 | .layoutPriority(1) | |
| 31 | Spacer(minLength: 8) | |
| 32 | if let habit = row.item?.habit { | |
| 33 | HabitGraph(cells: habit.graph(today: day), theme: theme) | |
| 34 | } | |
| 35 | if let todo = row.todo { | |
| 36 | let color = theme.dynamic(row.isDone ? .systemGreen : .systemRed) { [theme, row] in theme.todoColor(todo, isDone: row.isDone, dark: $0) } | |
| 37 | Text(todo) | |
| 38 | .font(.system(size: 10, weight: .bold)) | |
| 39 | .foregroundStyle(color) | |
| 40 | .padding(.horizontal, 7) | |
| 41 | .padding(.vertical, 2) | |
| 42 | .background(Capsule().fill(color.opacity(0.14))) | |
| 43 | .fixedSize() | |
| 31 | HStack(alignment: .top, spacing: 8) { | |
| 32 | metaLine | |
| 33 | Spacer(minLength: 0) | |
| 34 | marks | |
| 35 | } | |
| 36 | Text(row.title.isEmpty ? " " : row.title) | |
| 37 | .font(.body) | |
| 38 | .strikethrough(row.isDone) | |
| 39 | .foregroundStyle(row.isDone ? AnyShapeStyle(.secondary) : AnyShapeStyle(theme.color("foreground") ?? .primary)) | |
| 40 | .lineLimit(1) | |
| 41 | .truncationMode(.tail) | |
| 42 | if let habit = row.item?.habit { | |
| 43 | HabitGraph(cells: habit.graph(today: day), theme: theme).padding(.top, 2) | |
| 44 | } | |
| 44 | 45 | } |
| 45 | priorityBadge | |
| 46 | .frame(width: 18) | |
| 47 | 46 | } |
| 48 | 47 | .padding(.horizontal, 16) |
| 49 | 48 | .padding(.vertical, 6) |
| @@ -63,40 +62,35 @@ struct AgendaRowView: View { | ||
| 63 | 62 | .accessibilityElement(children: .combine) |
| 64 | 63 | } |
| 65 | 64 | |
| 65 | /// Increase Contrast: keyword and priority badges are filled with their colour, tags outlined in full. | |
| 66 | private var highContrast: Bool { contrast == .increased } | |
| 67 | ||
| 68 | private var background: Color { theme.color("agenda-background") ?? Color(nsColor: .textBackgroundColor) } | |
| 69 | ||
| 66 | 70 | private var statusColor: Color { |
| 67 | 71 | theme.dynamic(.secondaryLabelColor) { [theme, row] in theme.statusColor(row.status, dark: $0) } |
| 68 | 72 | } |
| 69 | 73 | |
| 74 | /// The start over the end for timed rows, else the status; the icon under them. | |
| 70 | 75 | private var gutter: some View { |
| 71 | VStack(alignment: .leading, spacing: 3) { | |
| 72 | Text(row.gutter) | |
| 73 | .font(.system(size: 12, weight: row.status == .overdue || row.status == .dueSoon ? .semibold : .regular).monospacedDigit()) | |
| 76 | VStack(alignment: .leading, spacing: 2) { | |
| 77 | let lines = row.gutterLines | |
| 78 | Text(lines[0]) | |
| 79 | .font(.callout.weight(row.status == .overdue || row.status == .dueSoon ? .semibold : .regular).monospacedDigit()) | |
| 74 | 80 | .foregroundStyle(statusColor) |
| 75 | .lineLimit(1) | |
| 76 | .minimumScaleFactor(0.8) | |
| 77 | if let symbol { | |
| 81 | .lineLimit(2) | |
| 82 | .fixedSize(horizontal: false, vertical: true) | |
| 83 | if lines.count > 1 { | |
| 84 | Text(lines[1]).font(.caption.monospacedDigit()).foregroundStyle(.secondary) | |
| 85 | } | |
| 86 | if let symbol = row.symbol { | |
| 78 | 87 | Image(systemName: symbol) |
| 79 | .font(.system(size: row.icon == .event ? 8 : 10, weight: .semibold)) | |
| 88 | .font(.caption.weight(.semibold)) | |
| 89 | .imageScale(row.icon == .event ? .small : .medium) | |
| 80 | 90 | .foregroundStyle(iconColor) |
| 81 | .frame(height: 12) | |
| 82 | 91 | } |
| 83 | 92 | } |
| 84 | .frame(width: Self.gutterWidth, alignment: .leading) | |
| 85 | } | |
| 86 | ||
| 87 | /// Overdue entries show a warning, done ones a check, as the status says first. | |
| 88 | private var symbol: String? { | |
| 89 | guard let icon = row.icon else { return nil } | |
| 90 | if row.status == .overdue { return "exclamationmark.circle.fill" } | |
| 91 | if row.status == .done { return "checkmark.circle.fill" } | |
| 92 | switch icon { | |
| 93 | case .scheduled: return "calendar" | |
| 94 | case .deadline: return "flag.fill" | |
| 95 | case .habit: return "repeat" | |
| 96 | case .event: return "circle.fill" | |
| 97 | case .reminder: return "circle" | |
| 98 | case .timestamp: return row.start == nil ? "calendar" : "clock" | |
| 99 | } | |
| 93 | .frame(width: gutterWidth, alignment: .leading) | |
| 100 | 94 | } |
| 101 | 95 | |
| 102 | 96 | private var iconColor: Color { |
| @@ -104,53 +98,67 @@ struct AgendaRowView: View { | ||
| 104 | 98 | return row.status == .normal ? Color.secondary.opacity(0.8) : statusColor |
| 105 | 99 | } |
| 106 | 100 | |
| 107 | private var categoryLine: some View { | |
| 108 | HStack(spacing: 5) { | |
| 109 | Circle() | |
| 110 | .fill(row.event.map { event in theme.dynamic(.systemPurple) { [theme] in theme.eventColor(event, dark: $0) } } | |
| 111 | ?? theme.dynamic { [theme, row] in theme.categoryColor(row.category, dark: $0) }) | |
| 112 | .frame(width: 6, height: 6) | |
| 113 | Text(row.category) | |
| 114 | .font(.system(size: 11)) | |
| 115 | .foregroundStyle(theme.color("agenda-category") ?? .secondary) | |
| 116 | .lineLimit(1) | |
| 101 | /// The category, the prefix's detail, progress and tags, wrapping to more lines as needed. | |
| 102 | private var metaLine: some View { | |
| 103 | FlowLayout(spacing: 5, lineSpacing: 3) { | |
| 104 | if !row.category.isEmpty { | |
| 105 | HStack(spacing: 5) { | |
| 106 | Circle() | |
| 107 | .fill(row.event.map { event in theme.dynamic(.systemPurple) { [theme] in theme.eventColor(event, dark: $0) } } | |
| 108 | ?? theme.dynamic { [theme, row] in theme.categoryColor(row.category, dark: $0) }) | |
| 109 | .frame(width: 6, height: 6) | |
| 110 | Text(row.category) | |
| 111 | .font(.subheadline) | |
| 112 | .foregroundStyle(theme.color("agenda-category") ?? .secondary) | |
| 113 | .lineLimit(1) | |
| 114 | } | |
| 115 | } | |
| 117 | 116 | if let detail = row.prefixDetail { |
| 118 | 117 | Text(detail) |
| 119 | .font(.system(size: 11)) | |
| 118 | .font(.subheadline) | |
| 120 | 119 | .foregroundStyle(.secondary) |
| 121 | 120 | .lineLimit(1) |
| 122 | 121 | .truncationMode(.middle) |
| 123 | 122 | } |
| 124 | } | |
| 125 | } | |
| 126 | ||
| 127 | private var titleLine: some View { | |
| 128 | HStack(spacing: 6) { | |
| 129 | Text(row.title.isEmpty ? " " : row.title) | |
| 130 | .font(.system(size: 13)) | |
| 131 | .strikethrough(row.isDone) | |
| 132 | .foregroundStyle(row.isDone ? AnyShapeStyle(.secondary) : AnyShapeStyle(theme.color("foreground") ?? .primary)) | |
| 133 | .lineLimit(1) | |
| 134 | .truncationMode(.tail) | |
| 135 | 123 | ForEach([row.progress, row.detail].compactMap { $0 }, id: \.self) { progress in |
| 136 | 124 | Text(progress) |
| 137 | .font(.system(size: 10, weight: .semibold).monospacedDigit()) | |
| 125 | .font(.caption.weight(.semibold).monospacedDigit()) | |
| 138 | 126 | .foregroundStyle(.secondary) |
| 139 | 127 | .padding(.horizontal, 6) |
| 140 | 128 | .padding(.vertical, 1) |
| 141 | 129 | .background(Capsule().fill(Color.secondary.opacity(0.14))) |
| 142 | .fixedSize() | |
| 143 | 130 | } |
| 144 | 131 | ForEach(row.tags, id: \.self) { tag in |
| 145 | 132 | Text(tag) |
| 146 | .font(.system(size: 10, weight: .medium)) | |
| 133 | .font(.caption.weight(.medium)) | |
| 147 | 134 | .foregroundStyle(theme.color("tags") ?? .secondary) |
| 148 | 135 | .padding(.horizontal, 6) |
| 149 | 136 | .padding(.vertical, 1) |
| 150 | .background(Capsule().strokeBorder((theme.color("tags") ?? .secondary).opacity(0.35), lineWidth: 0.5)) | |
| 151 | .fixedSize() | |
| 137 | .background(Capsule().strokeBorder((theme.color("tags") ?? .secondary).opacity(highContrast ? 1 : 0.35), lineWidth: highContrast ? 1 : 0.5)) | |
| 138 | } | |
| 139 | } | |
| 140 | } | |
| 141 | ||
| 142 | /// The TODO keyword and the priority, at the end of the category's line. | |
| 143 | private var marks: some View { | |
| 144 | HStack(spacing: 6) { | |
| 145 | if let todo = row.todo { | |
| 146 | let color = theme.dynamic(row.isDone ? .systemGreen : .systemRed) { [theme, row] in theme.todoColor(todo, isDone: row.isDone, dark: $0) } | |
| 147 | HStack(spacing: 2) { | |
| 148 | // Done or not without telling green from red. | |
| 149 | if withoutColor, row.isDone { Image(systemName: "checkmark") } | |
| 150 | Text(todo) | |
| 151 | } | |
| 152 | .font(.caption.weight(.bold)) | |
| 153 | .foregroundStyle(highContrast ? background : color) | |
| 154 | .padding(.horizontal, 7) | |
| 155 | .padding(.vertical, 2) | |
| 156 | .background(Capsule().fill(highContrast ? color : color.opacity(0.14))) | |
| 157 | .overlay { if withoutColor, !highContrast { Capsule().strokeBorder(color, lineWidth: 1) } } | |
| 152 | 158 | } |
| 159 | priorityBadge | |
| 153 | 160 | } |
| 161 | .fixedSize() | |
| 154 | 162 | } |
| 155 | 163 | |
| 156 | 164 | @ViewBuilder |
| @@ -158,14 +166,14 @@ struct AgendaRowView: View { | ||
| 158 | 166 | if let priority = row.priority { |
| 159 | 167 | let color = theme.dynamic(.systemOrange) { [theme] in theme.priorityColor(priority, dark: $0) } |
| 160 | 168 | Text(priority) |
| 161 | .font(.system(size: 10, weight: .bold)) | |
| 162 | .foregroundStyle(color) | |
| 163 | .frame(width: 18, height: 18) | |
| 164 | .background(Circle().fill(color.opacity(0.14))) | |
| 165 | .overlay(Circle().strokeBorder(color.opacity(0.6), lineWidth: 1)) | |
| 169 | .font(.caption.weight(.bold)) | |
| 170 | .foregroundStyle(highContrast ? background : color) | |
| 171 | .frame(width: badgeSize, height: badgeSize) | |
| 172 | .background(Circle().fill(highContrast ? color : color.opacity(0.14))) | |
| 173 | .overlay(Circle().strokeBorder(color.opacity(highContrast ? 1 : 0.6), lineWidth: 1)) | |
| 166 | 174 | .help("Priority \(priority)") |
| 167 | 175 | } else { |
| 168 | Color.clear.frame(width: 18, height: 18) | |
| 176 | Color.clear.frame(width: badgeSize, height: badgeSize) | |
| 169 | 177 | } |
| 170 | 178 | } |
| 171 | 179 | } |
| @@ -179,7 +187,7 @@ struct HabitGraph: View { | ||
| 179 | 187 | HStack(spacing: 1) { |
| 180 | 188 | ForEach(cells, id: \.day) { cell in |
| 181 | 189 | Text(String(cell.glyph)) |
| 182 | .font(.system(size: 9, weight: .bold, design: .monospaced)) | |
| 190 | .font(.caption2.monospaced().weight(.bold)) | |
| 183 | 191 | .frame(width: 8, height: 14) |
| 184 | 192 | .background(color(cell.face)) |
| 185 | 193 | .help(Self.label(cell)) |
Sources/Orgstar/AgendaView+Toolbar.swift +9 −6
| @@ -120,18 +120,21 @@ extension AgendaView { | ||
| 120 | 120 | return shown.isEmpty ? "No folders" : shown.map { ($0 as NSString).lastPathComponent }.joined(separator: ", ") |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | /// The span shown, as the window's title: `Week of 5 Oct 2026`. | |
| 123 | /// The span shown, as the window's title: `Week of 5 Oct`, with the year when it isn't | |
| 124 | /// the current one. | |
| 124 | 125 | var title: String { |
| 125 | 126 | guard isAgenda else { return viewName.replacingOccurrences(of: "…", with: "") } |
| 126 | 127 | guard let first = agenda.days.first?.day, let last = agenda.days.last?.day else { return "Agenda" } |
| 128 | let thisYear = Days.date(agenda.today).year | |
| 129 | let year = Days.date(first).year == thisYear && Days.date(last).year == thisYear ? "" : " yyyy" | |
| 127 | 130 | switch spanKind { |
| 128 | case .day: return Self.format(first, "EEEE d MMMM yyyy") | |
| 129 | case .week: return "Week of " + Self.format(first, "d MMM yyyy") | |
| 130 | case .month: return Self.format(first, "MMMM yyyy") | |
| 131 | case .day: return Self.format(first, "EEEE d MMMM" + year) | |
| 132 | case .week: return "Week of " + Self.format(first, "d MMM" + year) | |
| 133 | case .month: return Self.format(first, "MMMM" + year) | |
| 131 | 134 | case nil: |
| 132 | if first == last { return Self.format(first, "EEEE d MMMM yyyy") } | |
| 135 | if first == last { return Self.format(first, "EEEE d MMMM" + year) } | |
| 133 | 136 | let sameYear = Days.date(first).year == Days.date(last).year |
| 134 | return Self.format(first, sameYear ? "d MMM" : "d MMM yyyy") + " – " + Self.format(last, "d MMM yyyy") | |
| 137 | return Self.format(first, sameYear ? "d MMM" : "d MMM yyyy") + " – " + Self.format(last, "d MMM" + year) | |
| 135 | 138 | } |
| 136 | 139 | } |
| 137 | 140 | |
Sources/Orgstar/AgendaView.swift +16 −15
| @@ -69,6 +69,7 @@ struct AgendaView: View { | ||
| 69 | 69 | @State var pickedDate = Date() |
| 70 | 70 | @AppStorage("agendaOverdueExpanded") private var overdueShown = true |
| 71 | 71 | @State private var hovered: String? |
| 72 | @ScaledMetric(relativeTo: .callout) private var gutterWidth = AgendaRowView.gutterWidth | |
| 72 | 73 | @FocusState private var focused: Bool |
| 73 | 74 | @AppStorage("agendaSpan") var span = 10 |
| 74 | 75 | @AppStorage("agendaStartOffset") var startOffset = 0 |
| @@ -307,7 +308,7 @@ struct AgendaView: View { | ||
| 307 | 308 | } |
| 308 | 309 | } |
| 309 | 310 | } header: { |
| 310 | header { Text(block.header).font(.system(size: 13, weight: .semibold)) } | |
| 311 | header { Text(block.header).font(.body.weight(.semibold)) } | |
| 311 | 312 | } |
| 312 | 313 | } |
| 313 | 314 | } else if isAgenda { |
| @@ -324,7 +325,7 @@ struct AgendaView: View { | ||
| 324 | 325 | rowView(Line(id: "list:\(index)", row: row, day: agenda.today), showsGutter: false) |
| 325 | 326 | } |
| 326 | 327 | } header: { |
| 327 | header { Text(listTitle).font(.system(size: 13, weight: .semibold)) } | |
| 328 | header { Text(listTitle).font(.body.weight(.semibold)) } | |
| 328 | 329 | } |
| 329 | 330 | } |
| 330 | 331 | } |
| @@ -477,20 +478,20 @@ struct AgendaView: View { | ||
| 477 | 478 | private func gridLine(_ time: Int) -> some View { |
| 478 | 479 | HStack(spacing: 6) { |
| 479 | 480 | 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) | |
| 482 | 483 | GridRule().stroke(style: StrokeStyle(lineWidth: 0.5, dash: [2, 3])).frame(height: 1) |
| 483 | 484 | } |
| 484 | 485 | .foregroundStyle(.tertiary) |
| 485 | 486 | .padding(.horizontal, 16) |
| 486 | .frame(height: 10) | |
| 487 | .padding(.vertical, 4) | |
| 487 | 488 | .accessibilityHidden(true) |
| 488 | 489 | } |
| 489 | 490 | |
| 490 | 491 | private func header(@ViewBuilder _ content: () -> some View) -> some View { |
| 491 | 492 | HStack(spacing: 6) { content() } |
| 492 | 493 | .padding(.horizontal, 16) |
| 493 | .frame(height: 30) | |
| 494 | .frame(minHeight: 30) | |
| 494 | 495 | .frame(maxWidth: .infinity, alignment: .leading) |
| 495 | 496 | .background(theme.color("agenda-background") ?? Color(nsColor: .textBackgroundColor)) |
| 496 | 497 | .overlay(alignment: .bottom) { Divider() } |
| @@ -502,19 +503,19 @@ struct AgendaView: View { | ||
| 502 | 503 | return header { |
| 503 | 504 | if let relative = group.relativeName(today: agenda.today) { |
| 504 | 505 | Text(relative) |
| 505 | .font(.system(size: 13, weight: .bold)) | |
| 506 | .font(.body.weight(.bold)) | |
| 506 | 507 | .foregroundStyle(color) |
| 507 | 508 | Text("·").foregroundStyle(.tertiary) |
| 508 | 509 | } |
| 509 | 510 | 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)) | |
| 511 | 512 | .foregroundStyle(color) |
| 512 | 513 | Spacer() |
| 513 | 514 | Button { |
| 514 | 515 | capture(on: group.day) |
| 515 | 516 | } label: { |
| 516 | 517 | Image(systemName: "plus") |
| 517 | .font(.system(size: 12, weight: .semibold)) | |
| 518 | .font(.callout.weight(.semibold)) | |
| 518 | 519 | .frame(width: 22, height: 22) |
| 519 | 520 | .contentShape(Rectangle()) |
| 520 | 521 | } |
| @@ -532,11 +533,11 @@ struct AgendaView: View { | ||
| 532 | 533 | } label: { |
| 533 | 534 | HStack(spacing: 6) { |
| 534 | 535 | Image(systemName: "chevron.right") |
| 535 | .font(.system(size: 10, weight: .bold)) | |
| 536 | .font(.caption.weight(.bold)) | |
| 536 | 537 | .rotationEffect(.degrees(overdueShown ? 90 : 0)) |
| 537 | Text("Overdue").font(.system(size: 12, weight: .semibold)) | |
| 538 | Text("Overdue").font(.callout.weight(.semibold)) | |
| 538 | 539 | Text("\(count)") |
| 539 | .font(.system(size: 10, weight: .bold).monospacedDigit()) | |
| 540 | .font(.caption.weight(.bold).monospacedDigit()) | |
| 540 | 541 | .padding(.horizontal, 6) |
| 541 | 542 | .padding(.vertical, 1) |
| 542 | 543 | .background(Capsule().fill(color.opacity(0.15))) |
| @@ -555,14 +556,14 @@ struct AgendaView: View { | ||
| 555 | 556 | private var nowLine: some View { |
| 556 | 557 | HStack(spacing: 6) { |
| 557 | 558 | 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) | |
| 560 | 561 | Circle().frame(width: 6, height: 6) |
| 561 | 562 | Rectangle().frame(height: 1) |
| 562 | 563 | } |
| 563 | 564 | .foregroundStyle(todayColor) |
| 564 | 565 | .padding(.horizontal, 16) |
| 565 | .frame(height: 10) | |
| 566 | .padding(.vertical, 4) | |
| 566 | 567 | .accessibilityLabel("Now") |
| 567 | 568 | } |
| 568 | 569 | |
Sources/OrgstarMobile/AgendaScreen.swift +145 −97
| @@ -17,6 +17,7 @@ struct AgendaScreen: View, Equatable { | ||
| 17 | 17 | @Environment(ClockModel.self) private var clock |
| 18 | 18 | @Environment(MobileModel.self) private var model |
| 19 | 19 | @Environment(\.colorScheme) private var colorScheme |
| 20 | @Environment(\.dynamicTypeSize) private var typeSize | |
| 20 | 21 | @Environment(\.openURL) private var openURL |
| 21 | 22 | @State private var tick = 0 |
| 22 | 23 | /// The time the now line shows, kept to the minute while the agenda is open. |
| @@ -114,12 +115,7 @@ struct AgendaScreen: View, Equatable { | ||
| 114 | 115 | } else if case .agenda = agenda.mode { |
| 115 | 116 | let _ = model.settingsVersion |
| 116 | 117 | ForEach(Perf.measure("agenda.groups") { agenda.groups(showAllDates: OrgPreferences.agendaShowAllDates(), filter: filter) }) { group in |
| 117 | overdue(group) | |
| 118 | Section { | |
| 119 | day(group) | |
| 120 | } header: { | |
| 121 | header(group) | |
| 122 | } | |
| 118 | dayGroup(group) | |
| 123 | 119 | } |
| 124 | 120 | } else if case .blocks = agenda.mode { |
| 125 | 121 | // A block's title over its days, or over its entries. |
| @@ -127,12 +123,7 @@ struct AgendaScreen: View, Equatable { | ||
| 127 | 123 | if block.isAgenda { |
| 128 | 124 | Section { } header: { Text(block.header).font(.headline) } |
| 129 | 125 | ForEach(agenda.groups(block, showAllDates: OrgPreferences.agendaShowAllDates(), filter: filter)) { group in |
| 130 | overdue(group) | |
| 131 | Section { | |
| 132 | day(group) | |
| 133 | } header: { | |
| 134 | header(group) | |
| 135 | } | |
| 126 | dayGroup(group) | |
| 136 | 127 | } |
| 137 | 128 | } else { |
| 138 | 129 | Section { |
| @@ -216,6 +207,12 @@ struct AgendaScreen: View, Equatable { | ||
| 216 | 207 | Button("Search…") { asking = .search } |
| 217 | 208 | if canSaveView { Button("Save as View…") { asking = .save } } |
| 218 | 209 | Divider() |
| 210 | if case .agenda = agenda.mode { | |
| 211 | Button("Go to Date…", systemImage: "calendar") { jumping = true } | |
| 212 | } | |
| 213 | Button("Filter…", systemImage: filter.isEmpty ? "line.3.horizontal.decrease" : "line.3.horizontal.decrease.circle.fill") { showingFilter = true } | |
| 214 | Button("Select", systemImage: "checkmark.circle") { selecting = true } | |
| 215 | Divider() | |
| 219 | 216 | Button("Board", systemImage: "rectangle.split.3x1") { showingBoard = true } |
| 220 | 217 | } label: { |
| 221 | 218 | Label("Views", systemImage: "list.bullet.rectangle") |
| @@ -440,15 +437,12 @@ struct AgendaScreen: View, Equatable { | ||
| 440 | 437 | |
| 441 | 438 | // MARK: - Days |
| 442 | 439 | |
| 443 | /// Today's entries from earlier days, in a section of their own above today's. | |
| 440 | /// A day under its header. On today, the entries from earlier days come first, in a group | |
| 441 | /// of their own headed Overdue. | |
| 444 | 442 | @ViewBuilder |
| 445 | private func overdue(_ group: AgendaDayGroup) -> some View { | |
| 443 | private func dayGroup(_ group: AgendaDayGroup) -> some View { | |
| 446 | 444 | if group.isToday, !group.overdue.isEmpty { |
| 447 | 445 | Section { |
| 448 | if overdueExpanded { | |
| 449 | ForEach(group.overdue) { item in Deferred { row(item, day: group.day) } } | |
| 450 | } | |
| 451 | } header: { | |
| 452 | 446 | Button { |
| 453 | 447 | withAnimation { overdueExpanded.toggle() } |
| 454 | 448 | } label: { |
| @@ -464,8 +458,23 @@ struct AgendaScreen: View, Equatable { | ||
| 464 | 458 | .contentShape(Rectangle()) |
| 465 | 459 | } |
| 466 | 460 | .buttonStyle(.plain) |
| 467 | .textCase(nil) | |
| 468 | 461 | .accessibilityValue(overdueExpanded ? "Expanded" : "Collapsed") |
| 462 | if overdueExpanded { | |
| 463 | ForEach(group.overdue) { item in Deferred { row(item, day: group.day) } } | |
| 464 | } | |
| 465 | } header: { | |
| 466 | header(group) | |
| 467 | } | |
| 468 | if !group.rows.isEmpty { | |
| 469 | Section { | |
| 470 | day(group) | |
| 471 | } | |
| 472 | } | |
| 473 | } else { | |
| 474 | Section { | |
| 475 | day(group) | |
| 476 | } header: { | |
| 477 | header(group) | |
| 469 | 478 | } |
| 470 | 479 | } |
| 471 | 480 | } |
| @@ -642,17 +651,21 @@ struct AgendaScreen: View, Equatable { | ||
| 642 | 651 | .glassEffect(.regular, in: Capsule()) |
| 643 | 652 | .onTapGesture { message = nil } |
| 644 | 653 | } |
| 645 | HStack(spacing: 2) { | |
| 646 | let isAgenda = if case .agenda = agenda.mode { true } else { false } | |
| 647 | if isAgenda { | |
| 654 | if case .agenda = agenda.mode { | |
| 655 | HStack(spacing: 2) { | |
| 648 | 656 | barButton("Earlier", "chevron.left") { step(forward: false) } |
| 649 | } | |
| 650 | barButton("Filter", filter.isEmpty ? "line.3.horizontal.decrease" : "line.3.horizontal.decrease.circle.fill") { showingFilter = true } | |
| 651 | barButton("Select", "checkmark.circle") { selecting = true } | |
| 652 | if isAgenda { | |
| 653 | barButton("Today", "smallcircle.filled.circle") { goToday() } | |
| 654 | barButton("Go to Date", "calendar") { jumping = true } | |
| 657 | // At accessibility sizes Today goes into the span menu, so the bar fits. | |
| 658 | if !typeSize.isAccessibilitySize { | |
| 659 | Button("Today") { goToday() } | |
| 660 | .font(.subheadline.weight(.semibold)) | |
| 661 | .padding(.horizontal, 8) | |
| 662 | .frame(minHeight: 44) | |
| 663 | .contentShape(Rectangle()) | |
| 664 | } | |
| 655 | 665 | Menu { |
| 666 | if typeSize.isAccessibilitySize { | |
| 667 | Button("Today") { goToday() } | |
| 668 | } | |
| 656 | 669 | Picker("Span", selection: Binding { range } set: { show($0, around: $0 == nil || todayShown ? agenda.today : firstDay) }) { |
| 657 | 670 | ForEach(SpanRange.allCases) { Text($0.title).tag(Optional($0)) } |
| 658 | 671 | Text("\(agenda.span) Days").tag(SpanRange?.none) |
| @@ -660,19 +673,17 @@ struct AgendaScreen: View, Equatable { | ||
| 660 | 673 | Toggle("Log Mode", systemImage: "clock.arrow.circlepath", isOn: $logMode) |
| 661 | 674 | } label: { |
| 662 | 675 | (range.map { Text($0.title) } ?? Text("\(agenda.span) Days")) |
| 663 | .font(.footnote.weight(.semibold).monospacedDigit()) | |
| 676 | .font(.subheadline.weight(.semibold).monospacedDigit()) | |
| 664 | 677 | .lineLimit(1) |
| 665 | 678 | .frame(minWidth: 52, minHeight: 44) |
| 666 | 679 | .contentShape(Rectangle()) |
| 667 | 680 | } |
| 668 | 681 | .accessibilityLabel("Span") |
| 669 | 682 | barButton(LocalizedStringResource("agenda.later", defaultValue: "Later", comment: "Shows the next days in the agenda"), "chevron.right") { step(forward: true) } |
| 670 | } else { | |
| 671 | barButton("Agenda", "calendar") { show(nil, around: agenda.today) } | |
| 672 | 683 | } |
| 684 | .padding(.horizontal, 6) | |
| 685 | .glassEffect(.regular.interactive(), in: Capsule()) | |
| 673 | 686 | } |
| 674 | .padding(.horizontal, 6) | |
| 675 | .glassEffect(.regular.interactive(), in: Capsule()) | |
| 676 | 687 | } |
| 677 | 688 | .padding(.bottom, 8) |
| 678 | 689 | .frame(maxWidth: .infinity) |
| @@ -682,7 +693,7 @@ struct AgendaScreen: View, Equatable { | ||
| 682 | 693 | Button(String(localized: title), systemImage: image, action: action) |
| 683 | 694 | .labelStyle(.iconOnly) |
| 684 | 695 | .font(.body.weight(.medium)) |
| 685 | .frame(width: 44, height: 44) | |
| 696 | .frame(minWidth: 44, minHeight: 44) | |
| 686 | 697 | .contentShape(Rectangle()) |
| 687 | 698 | } |
| 688 | 699 | |
| @@ -937,24 +948,56 @@ extension RGBA { | ||
| 937 | 948 | var swiftUI: Color { Color(.sRGB, red: red, green: green, blue: blue, opacity: alpha) } |
| 938 | 949 | } |
| 939 | 950 | |
| 940 | /// One agenda line: the time or status with an icon in the gutter; the category, title, | |
| 941 | /// progress and tags; the TODO keyword and priority on the right. | |
| 951 | /// One agenda line: the time or status over an icon; above the title the | |
| 952 | /// category, progress and tags, with the TODO keyword and priority at the end; a habit's graph under it. | |
| 942 | 953 | struct AgendaRowView: View { |
| 943 | 954 | let row: AgendaRow |
| 944 | 955 | /// The day the row is on, for habit graphs. |
| 945 | 956 | let day: Int |
| 946 | 957 | let theme: ThemeSpec |
| 947 | 958 | let dark: Bool |
| 959 | @Environment(\.dynamicTypeSize) private var typeSize | |
| 960 | @ScaledMetric(relativeTo: .subheadline) private var gutterWidth: CGFloat = 82 | |
| 961 | @ScaledMetric(relativeTo: .caption2) private var badgeSize: CGFloat = 18 | |
| 962 | @Environment(\.colorSchemeContrast) private var contrast | |
| 963 | @Environment(\.accessibilityDifferentiateWithoutColor) private var withoutColor | |
| 964 | ||
| 965 | /// Increase Contrast: keyword and priority badges are filled with their colour. | |
| 966 | private var highContrast: Bool { contrast == .increased } | |
| 967 | ||
| 968 | /// TODO and match lists have no times or statuses. | |
| 969 | private var hasGutter: Bool { !row.gutter.isEmpty || row.icon != nil } | |
| 948 | 970 | |
| 949 | 971 | var body: some View { |
| 950 | HStack(alignment: .top, spacing: 10) { | |
| 951 | // TODO and match lists have no times or statuses. | |
| 952 | if !row.gutter.isEmpty || row.icon != nil { gutter.frame(width: 82, alignment: .leading) } | |
| 953 | VStack(alignment: .leading, spacing: 2) { | |
| 954 | HStack(spacing: 5) { | |
| 972 | Group { | |
| 973 | // At accessibility sizes the gutter is a line of its own above the rest. | |
| 974 | if typeSize.isAccessibilitySize { | |
| 975 | VStack(alignment: .leading, spacing: 4) { | |
| 976 | if hasGutter { stackedGutter } | |
| 977 | content | |
| 978 | } | |
| 979 | } else { | |
| 980 | HStack(alignment: .top, spacing: 10) { | |
| 981 | if hasGutter { gutter.frame(width: gutterWidth, alignment: .leading) } | |
| 982 | content | |
| 983 | } | |
| 984 | } | |
| 985 | } | |
| 986 | .padding(.vertical, 2) | |
| 987 | // Blocked entries dim, as `org-agenda-dim-blocked-tasks`. | |
| 988 | .opacity(row.isBlocked ? 0.5 : row.isDone ? 0.75 : 1) | |
| 989 | } | |
| 990 | ||
| 991 | private var content: some View { | |
| 992 | VStack(alignment: .leading, spacing: 2) { | |
| 993 | HStack(alignment: .top, spacing: 5) { | |
| 994 | // Wraps instead of truncating the tags. | |
| 995 | FlowLayout(spacing: 5, lineSpacing: 3) { | |
| 955 | 996 | if !row.category.isEmpty { |
| 956 | Circle().fill(categoryColor).frame(width: 7, height: 7) | |
| 957 | Text(row.category).lineLimit(1).layoutPriority(1) | |
| 997 | HStack(spacing: 5) { | |
| 998 | Circle().fill(categoryColor).frame(width: 7, height: 7) | |
| 999 | Text(row.category).lineLimit(1) | |
| 1000 | } | |
| 958 | 1001 | } |
| 959 | 1002 | if let detail = row.prefixDetail { Text(detail).lineLimit(1).truncationMode(.middle) } |
| 960 | 1003 | ForEach([row.progress, row.detail].compactMap { $0 }, id: \.self) { progress in |
| @@ -962,28 +1005,25 @@ struct AgendaRowView: View { | ||
| 962 | 1005 | .padding(.horizontal, 5) |
| 963 | 1006 | .background(.quaternary.opacity(0.7), in: Capsule()) |
| 964 | 1007 | } |
| 965 | ForEach(row.tags.prefix(3), id: \.self) { tag in | |
| 1008 | ForEach(row.tags, id: \.self) { tag in | |
| 966 | 1009 | Text(tag).lineLimit(1) |
| 967 | 1010 | .padding(.horizontal, 5) |
| 968 | 1011 | .background(.quaternary.opacity(0.7), in: Capsule()) |
| 969 | 1012 | } |
| 970 | Spacer(minLength: 4) | |
| 971 | marks | |
| 972 | } | |
| 973 | .font(.caption) | |
| 974 | .foregroundStyle(.secondary) | |
| 975 | Text(row.title.isEmpty ? " " : row.title) | |
| 976 | .font(.body) | |
| 977 | .strikethrough(row.isDone) | |
| 978 | .foregroundStyle(row.isDone ? .secondary : .primary) | |
| 979 | if let habit = row.item?.habit { | |
| 980 | HabitStrip(cells: habit.graph(today: day), theme: theme, dark: dark).padding(.top, 3) | |
| 981 | 1013 | } |
| 1014 | Spacer(minLength: 4) | |
| 1015 | marks | |
| 1016 | } | |
| 1017 | .font(.caption) | |
| 1018 | .foregroundStyle(.secondary) | |
| 1019 | Text(row.title.isEmpty ? " " : row.title) | |
| 1020 | .font(.body) | |
| 1021 | .strikethrough(row.isDone) | |
| 1022 | .foregroundStyle(row.isDone ? .secondary : .primary) | |
| 1023 | if let habit = row.item?.habit { | |
| 1024 | HabitStrip(cells: habit.graph(today: day), theme: theme, dark: dark).padding(.top, 3) | |
| 982 | 1025 | } |
| 983 | 1026 | } |
| 984 | .padding(.vertical, 2) | |
| 985 | // Blocked entries dim, as `org-agenda-dim-blocked-tasks`. | |
| 986 | .opacity(row.isBlocked ? 0.5 : row.isDone ? 0.75 : 1) | |
| 987 | 1027 | } |
| 988 | 1028 | |
| 989 | 1029 | /// The TODO keyword and the priority, on the category's line. |
| @@ -991,19 +1031,24 @@ struct AgendaRowView: View { | ||
| 991 | 1031 | HStack(spacing: 5) { |
| 992 | 1032 | if let todo = row.todo { |
| 993 | 1033 | let color = theme.todoColor(todo, isDone: row.isDone, dark: dark)?.swiftUI ?? .secondary |
| 994 | Text(todo) | |
| 995 | .font(.caption2.weight(.semibold)) | |
| 996 | .foregroundStyle(color) | |
| 997 | .padding(.horizontal, 6).padding(.vertical, 2) | |
| 998 | .background(color.opacity(0.14), in: Capsule()) | |
| 1034 | HStack(spacing: 2) { | |
| 1035 | // Done or not without telling green from red. | |
| 1036 | if withoutColor, row.isDone { Image(systemName: "checkmark") } | |
| 1037 | Text(todo) | |
| 1038 | } | |
| 1039 | .font(.caption2.weight(.semibold)) | |
| 1040 | .foregroundStyle(highContrast ? Color(.systemBackground) : color) | |
| 1041 | .padding(.horizontal, 6).padding(.vertical, 2) | |
| 1042 | .background(highContrast ? color : color.opacity(0.14), in: Capsule()) | |
| 1043 | .overlay { if withoutColor, !highContrast { Capsule().strokeBorder(color, lineWidth: 1) } } | |
| 999 | 1044 | } |
| 1000 | 1045 | if let priority = row.priority { |
| 1001 | 1046 | let color = theme.priorityColor(priority, dark: dark)?.swiftUI ?? .orange |
| 1002 | 1047 | Text(priority) |
| 1003 | 1048 | .font(.caption2.weight(.bold)) |
| 1004 | .foregroundStyle(color) | |
| 1005 | .frame(width: 18, height: 18) | |
| 1006 | .background(color.opacity(0.14), in: Circle()) | |
| 1049 | .foregroundStyle(highContrast ? Color(.systemBackground) : color) | |
| 1050 | .frame(width: badgeSize, height: badgeSize) | |
| 1051 | .background(highContrast ? color : color.opacity(0.14), in: Circle()) | |
| 1007 | 1052 | .overlay(Circle().strokeBorder(color, lineWidth: 1.2)) |
| 1008 | 1053 | .accessibilityLabel("Priority \(priority)") |
| 1009 | 1054 | } |
| @@ -1022,40 +1067,43 @@ struct AgendaRowView: View { | ||
| 1022 | 1067 | |
| 1023 | 1068 | /// The start over the end for timed rows, else the status; the icon under them. |
| 1024 | 1069 | private var gutter: some View { |
| 1025 | HStack(alignment: .firstTextBaseline, spacing: 4) { | |
| 1026 | Image(systemName: icon ?? "circle").font(.caption2.weight(.semibold)).foregroundStyle(iconColor) | |
| 1027 | .frame(width: 14) | |
| 1028 | .opacity(icon == nil ? 0 : 1) | |
| 1029 | VStack(alignment: .leading, spacing: 1) { | |
| 1030 | if row.start != nil { | |
| 1031 | let parts = row.gutter.split(separator: "–", maxSplits: 1) | |
| 1032 | Text(parts.first.map(String.init) ?? row.gutter) | |
| 1033 | .font(.subheadline.monospacedDigit().weight(.semibold)) | |
| 1034 | .foregroundStyle(row.status == .normal ? Color.primary : row.status == .done ? Color.secondary : statusColor) | |
| 1035 | if parts.count > 1 { | |
| 1036 | Text(parts[1]).font(.caption.monospacedDigit()).foregroundStyle(.secondary) | |
| 1037 | } | |
| 1038 | } else if !row.gutter.isEmpty { | |
| 1039 | Text(row.gutter) | |
| 1040 | .font(.caption.weight(.medium).monospacedDigit()) | |
| 1041 | .foregroundStyle(statusColor) | |
| 1042 | .lineLimit(1) | |
| 1043 | .allowsTightening(true) | |
| 1044 | .minimumScaleFactor(0.8) | |
| 1070 | VStack(alignment: .leading, spacing: 2) { | |
| 1071 | let lines = row.gutterLines | |
| 1072 | if row.start != nil { | |
| 1073 | Text(lines[0]) | |
| 1074 | .font(.subheadline.monospacedDigit().weight(.semibold)) | |
| 1075 | .foregroundStyle(row.status == .normal ? Color.primary : row.status == .done ? Color.secondary : statusColor) | |
| 1076 | if lines.count > 1 { | |
| 1077 | Text(lines[1]).font(.caption.monospacedDigit()).foregroundStyle(.secondary) | |
| 1045 | 1078 | } |
| 1079 | } else if !row.gutter.isEmpty { | |
| 1080 | Text(row.gutter) | |
| 1081 | .font(.caption.weight(.medium).monospacedDigit()) | |
| 1082 | .foregroundStyle(statusColor) | |
| 1083 | .lineLimit(2) | |
| 1084 | .fixedSize(horizontal: false, vertical: true) | |
| 1085 | } | |
| 1086 | if let symbol = row.symbol { | |
| 1087 | Image(systemName: symbol) | |
| 1088 | .font(.caption2.weight(.semibold)) | |
| 1089 | .imageScale(row.icon == .event ? .small : .medium) | |
| 1090 | .foregroundStyle(iconColor) | |
| 1046 | 1091 | } |
| 1047 | 1092 | } |
| 1048 | 1093 | } |
| 1049 | 1094 | |
| 1050 | private var icon: String? { | |
| 1051 | switch row.icon { | |
| 1052 | case .scheduled: row.status == .overdue ? "exclamationmark.circle.fill" : "calendar" | |
| 1053 | case .deadline: row.status == .overdue ? "exclamationmark.triangle.fill" : "flag.fill" | |
| 1054 | case .habit: "repeat" | |
| 1055 | case .event: "calendar" | |
| 1056 | case .reminder: "circle" | |
| 1057 | case .timestamp: "clock" | |
| 1058 | case nil: nil | |
| 1095 | /// The gutter as one line, the icon first, for accessibility sizes. | |
| 1096 | private var stackedGutter: some View { | |
| 1097 | HStack(alignment: .firstTextBaseline, spacing: 6) { | |
| 1098 | if let symbol = row.symbol { | |
| 1099 | Image(systemName: symbol) | |
| 1100 | .font(.caption.weight(.semibold)) | |
| 1101 | .imageScale(row.icon == .event ? .small : .medium) | |
| 1102 | .foregroundStyle(iconColor) | |
| 1103 | } | |
| 1104 | Text(row.gutter) | |
| 1105 | .font(.subheadline.weight(.semibold).monospacedDigit()) | |
| 1106 | .foregroundStyle(row.start != nil && row.status == .normal ? Color.primary : statusColor) | |
| 1059 | 1107 | } |
| 1060 | 1108 | } |
| 1061 | 1109 | |
| @@ -1078,7 +1126,7 @@ struct GridLineRow: View { | ||
| 1078 | 1126 | .foregroundStyle(.tertiary) |
| 1079 | 1127 | .listRowInsets(EdgeInsets(top: 0, leading: 16, bottom: 0, trailing: 16)) |
| 1080 | 1128 | .listRowSeparator(.hidden) |
| 1081 | .frame(height: 14) | |
| 1129 | .padding(.vertical, 5) | |
| 1082 | 1130 | .accessibilityHidden(true) |
| 1083 | 1131 | } |
| 1084 | 1132 | } |
| @@ -1098,7 +1146,7 @@ struct NowLine: View { | ||
| 1098 | 1146 | } |
| 1099 | 1147 | .listRowInsets(EdgeInsets(top: 0, leading: 16, bottom: 0, trailing: 16)) |
| 1100 | 1148 | .listRowSeparator(.hidden) |
| 1101 | .frame(height: 16) | |
| 1149 | .padding(.vertical, 5) | |
| 1102 | 1150 | .accessibilityLabel("Now") |
| 1103 | 1151 | } |
| 1104 | 1152 | } |
Tests/OrgPresentationTests/AgendaRowsTests.swift +14
| @@ -94,6 +94,20 @@ struct AgendaRowsTests { | ||
| 94 | 94 | #expect(!rent.isEvent && rent.item != nil) |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | @Test func gutterLinesAndSymbols() { | |
| 98 | let rows = Self.rows() | |
| 99 | #expect(rows["Dentist"]?.gutterLines == ["13:50", "14:30"]) | |
| 100 | #expect(rows["Standup"]?.gutterLines == ["08:00"]) | |
| 101 | #expect(rows["Send forms"]?.gutterLines == ["3d late"]) | |
| 102 | #expect(rows["Send forms"]?.symbol == "exclamationmark.circle.fill") | |
| 103 | #expect(rows["Pay rent"]?.symbol == "exclamationmark.circle.fill") | |
| 104 | #expect(rows["Took out bins"]?.symbol == "checkmark.circle.fill") | |
| 105 | #expect(rows["File taxes"]?.symbol == "flag.fill") | |
| 106 | #expect(rows["Water plants"]?.symbol == "calendar") | |
| 107 | #expect(rows["Dentist"]?.symbol == "clock") | |
| 108 | #expect(rows["Birthday"]?.symbol == "calendar") | |
| 109 | } | |
| 110 | ||
| 97 | 111 | @Test func logRowsKeepTheDurationAndState() { |
| 98 | 112 | let text = """ |
| 99 | 113 | * DONE Write report |
docs/manual/guide/07-agenda.org +10 −10
| @@ -87,7 +87,7 @@ The Day, Week and Month control in the toolbar, or =v d=, =v w= and =v m=, shows | ||
| 87 | 87 | |
| 88 | 88 | To return to the configured span, choose Agenda from the view menu. |
| 89 | 89 | |
| 90 | The window's title names the days shown: =Thursday 8 October 2026= for a day, =Week of 5 Oct 2026=, =October 2026=, or the first and last day for the configured span, =5 Oct – 14 Oct 2026=. | |
| 90 | The window's title names the days shown: =Thursday 8 October= for a day, =Week of 5 Oct=, =October=, or the first and last day for the configured span, =5 Oct – 14 Oct=. The year is added when the days aren't all in the current year, as in =28 Dec 2026 – 6 Jan 2027=. | |
| 91 | 91 | |
| 92 | 92 | ** Moving through days |
| 93 | 93 | |
| @@ -139,9 +139,9 @@ Days without entries are left out. Today always shows, with =Nothing scheduled= | ||
| 139 | 139 | org-agenda-show-all-dates = true |
| 140 | 140 | #+END_SRC |
| 141 | 141 | |
| 142 | Today's past deadlines and entries and habits scheduled on earlier days go in a group headed =Overdue= with their count, above today's other entries; on iOS it is a section of its own above today. Their left column shows how late they are, not the time of day they had. The oldest date comes first; entries with the same date keep Org's order. Click or tap the header to collapse or expand the group; it stays as you left it. | |
| 142 | Today's past deadlines and entries and habits scheduled on earlier days go in a group headed =Overdue= with their count, above today's other entries. Their left column shows how late they are, not the time of day they had. The oldest date comes first; entries with the same date keep Org's order. Click or tap the header to collapse or expand the group; it stays as you left it. | |
| 143 | 143 | |
| 144 | Days with a time grid show dotted lines at the grid's times among the timed entries, as =org-agenda-time-grid= does: by default at 8:00, 10:00 and every two hours to 20:00, on today and in one-day views, when the day has a timed entry. An entry at a grid line's time comes before the line. On today, a line marked with the current time sits among them: before the first entry that starts later, or after the last one when all have started. The grid's days and times are set in =[org-agenda-time-grid]= in =config.toml=, =org-agenda-use-time-grid= turns the grid off, and =org-agenda-show-current-time-in-grid= the now line (see [[file:13-configuration.org][Configuration]]). With the grid off there is no now line, as in Org. | |
| 144 | Days with a time grid show dotted lines at the grid's times among the timed entries, as =org-agenda-time-grid= does: by default at 8:00, 10:00 and every two hours to 20:00, on today and in one-day views, when the day has a timed entry, and not at a time an entry has. On today, a line marked with the current time sits among them: before the first entry that starts later, or after the last one when all have started. The grid's days and times are set in =[org-agenda-time-grid]= in =config.toml=, =org-agenda-use-time-grid= turns the grid off, and =org-agenda-show-current-time-in-grid= the now line (see [[file:13-configuration.org][Configuration]]). With the grid off there is no now line, as in Org. | |
| 145 | 145 | |
| 146 | 146 | ** Sorting |
| 147 | 147 | |
| @@ -171,21 +171,21 @@ In the TODO list and matches, the date keys use the first one in the strategy: w | ||
| 171 | 171 | Press =l= to turn log mode (=org-agenda-log-mode=) on or off; on iOS, use Log Mode in the span menu. Each day then also shows: |
| 172 | 172 | |
| 173 | 173 | - =Closed= entries whose =CLOSED:= timestamp is on that day; |
| 174 | - =Clocked= entries for each =CLOCK:= line that starts on that day, with the clock's start and end times in the left column and the time clocked, such as =1:30=, after the title; | |
| 174 | - =Clocked= entries for each =CLOCK:= line that starts on that day, with the clock's start and end times in the left column and the time clocked, such as =1:30=, above the title; | |
| 175 | 175 | - with =state= in =org-agenda-log-mode-items=, =State:= entries for each state change logged that day (a =- State "DONE" from "TODO" [2026-10-05 Mon 16:20]= line), with the new state in parentheses and the note's first line after the title. |
| 176 | 176 | |
| 177 | 177 | A note under a clock line (a list item directly below it) is added to the title after a =-=. =org-agenda-log-mode-items= in =config.toml= picks the kinds, separated by spaces; the default is Org's, ="closed clock"=. |
| 178 | 178 | |
| 179 | 179 | * Rows |
| 180 | 180 | |
| 181 | Each row shows, from left to right: | |
| 181 | Rows look the same on the Mac and iOS. Each shows: | |
| 182 | 182 | |
| 183 | - The time or status described above, with an icon below it on the Mac and before it on iOS: a calendar for scheduled entries, a flag for deadlines, arrows in a circle for habits, a clock or a calendar for timestamps, and a dot or a calendar for calendar events. An overdue entry shows a warning sign instead, and on the Mac a done entry shows a check mark. | |
| 184 | - The category, with a colored dot, above the title. For a calendar event this is the calendar's name. | |
| 183 | - On the left, the time or status described above, a timed entry's end under its start, and an icon below: a calendar for scheduled entries, a flag for deadlines, arrows in a circle for habits, a clock or a calendar for timestamps, and a dot for calendar events. An overdue entry shows a warning sign instead, and a done entry a check mark. | |
| 184 | - Above the title, the category with a colored dot (for a calendar event, the calendar's name), the value of the first statistics cookie (=1/3=, =50%=) and the tags, inherited tags first, as small capsules. The line wraps when they don't fit. At its end are the TODO keyword as a colored badge and the priority as a colored letter in a circle. | |
| 185 | 185 | - The title: the heading without its TODO keyword, priority cookie, statistics cookies, timestamps and tags, with links shown as their descriptions. A done entry's title is struck through. |
| 186 | - The value of the first statistics cookie (=1/3=, =50%=) and the tags, inherited tags first, as small capsules. iOS shows at most three tags. | |
| 187 | - The habit's consistency graph, for habits. | |
| 188 | - The TODO keyword as a colored badge, and the priority as a colored letter in a circle. | |
| 186 | - Under the title, the habit's consistency graph, for habits. | |
| 187 | ||
| 188 | With Increase Contrast on in the system's accessibility settings, the keyword and priority badges are filled with their color, and on the Mac tags have a full outline. With Differentiate Without Color on, keyword badges are outlined and a done keyword shows a check mark. | |
| 189 | 189 | |
| 190 | 190 | The status sets the color of the left column: |
| 191 | 191 | |
docs/manual/guide/13-configuration.org +3 −3
| @@ -356,10 +356,10 @@ These mirror the four elements of =org-stuck-projects=. See [[file:07-agenda.org | ||
| 356 | 356 | |
| 357 | 357 | | Key | Type | Default | Effect | |
| 358 | 358 | |---------+--------+----------------------------------------+-------------------------------------------| |
| 359 | | =when= | string | ="daily today require-timed"= | Which days get a grid, separated by spaces | | |
| 360 | | =times= | string | ="800 1000 1200 1400 1600 1800 2000"= | The grid's times as =HHMM= | | |
| 359 | | =when= | string | ="daily today require-timed remove-match"= | Which days get a grid, separated by spaces | | |
| 360 | | =times= | string | ="800 1000 1200 1400 1600 1800 2000"= | The grid's times as =HHMM= | | |
| 361 | 361 | |
| 362 | These mirror the first two elements of =org-agenda-time-grid=. =when= takes =daily= (views of one day), =today=, =weekly= (every day), =require-timed= (only days with a timed entry) and =remove-match= (no line at a time an entry has). orgstar draws the lines itself, so Emacs's third and fourth elements, the strings for the lines, have no equivalent. | |
| 362 | These mirror the first two elements of =org-agenda-time-grid=. =when= takes =daily= (views of one day), =today=, =weekly= (every day), =require-timed= (only days with a timed entry) and =remove-match= (no line at a time an entry has). The default adds =remove-match= to Org's, so that a grid line doesn't repeat an entry's time; ="daily today require-timed"= gives Org's grid. orgstar draws the lines itself, so Emacs's third and fourth elements, the strings for the lines, have no equivalent. | |
| 363 | 363 | |
| 364 | 364 | ** [org-structure-template-alist] |
| 365 | 365 | |
docs/manual/guide/14-ios.org +3 −3
| @@ -188,11 +188,11 @@ Tap a result to open it in the reader. A heading result opens at that heading. | ||
| 188 | 188 | |
| 189 | 189 | * The agenda |
| 190 | 190 | |
| 191 | The Agenda tab shows the agenda over all your folders, with the span and start day from the settings (10 days from 3 days ago by default). Each day lists its entries in rows: the time or a status such as =Due today= or =3d late= on the left, the category and the keyword above the title. Days without entries are hidden, except today. Today's overdue entries are in a section of their own above today, and a line marks the current time between timed entries. Pull down to refresh. | |
| 191 | The Agenda tab shows the agenda over all your folders, with the span and start day from the settings (10 days from 3 days ago by default). Each day lists its entries in rows: the time or a status such as =Due today= or =3d late= on the left, the category, tags and keyword above the title, as on the Mac (see Rows in [[file:07-agenda.org][The agenda]]). Days without entries are hidden, except today. Under today's header, today's overdue entries come first under Overdue, and a line marks the current time between timed entries. Pull down to refresh. | |
| 192 | 192 | |
| 193 | - Views (top left) :: the built-in views and those in =views.toml=, Tags and Properties… (a match such as =+work-home= or ~TODO="WAIT"~), and Search… (a phrase, or snippets such as =+invoice -paid=); Save as View… keeps the match or search showing as a view in =views.toml=. | |
| 193 | - Views (top left) :: the built-in views and those in =views.toml=, Tags and Properties… (a match such as =+work-home= or ~TODO="WAIT"~), and Search… (a phrase, or snippets such as =+invoice -paid=); Save as View… keeps the match or search showing as a view in =views.toml=. Below them are Go to Date…, Filter… and Select, which picks entries for an action on all of them. | |
| 194 | 194 | - Folders (top right, with more than one folder) :: shows or hides each folder's files in the agenda, the widgets, the watch and the badge; the shown folders' names appear under the title. A Focus can hide folders too, and mute their reminders (see Hiding folders in [[file:07-agenda.org][The agenda]]). |
| 195 | - The bar at the bottom :: Earlier, Filter, Today, Go to Date, the span (Day, Week, Month or the configured span, and Log Mode, which adds closed entries and clocked time) and Later. | |
| 195 | - The bar at the bottom :: Earlier, Today, the span (Day, Week, Month or the configured span, and Log Mode, which adds closed entries and clocked time) and Later. At accessibility text sizes Today is in the span's menu, and each entry's time or status is on a line of its own above it. | |
| 196 | 196 | - Filter :: keep or leave out tags and categories of the entries shown, or type a filter as Org's =/= takes it: =+keep= and =-drop= tags or categories, =<0:30= for effort, =/regexp/=. The filter in use shows above the bar. |
| 197 | 197 | - + on a day's header :: captures an entry scheduled on that day (see [[file:08-capture.org][Capture]]). |
| 198 | 198 | - Tap :: an entry to open it in a sheet: its title, TODO state, priority, scheduled date, deadline, tags and notes. Changes use the same commands as the editor and are written to the file together on Done, or dropped on Cancel; Undo and Redo step through them. More ▸ Open in File saves and shows the entry in the reader. |
l10n/Localizable.xcstrings +34
| @@ -14276,6 +14276,40 @@ | ||
| 14276 | 14276 | } |
| 14277 | 14277 | } |
| 14278 | 14278 | }, |
| 14279 | "Go to Date…": { | |
| 14280 | "localizations": { | |
| 14281 | "de": { | |
| 14282 | "stringUnit": { | |
| 14283 | "state": "translated", | |
| 14284 | "value": "Gehe zu Datum …" | |
| 14285 | } | |
| 14286 | }, | |
| 14287 | "es": { | |
| 14288 | "stringUnit": { | |
| 14289 | "state": "translated", | |
| 14290 | "value": "Ir a la fecha…" | |
| 14291 | } | |
| 14292 | }, | |
| 14293 | "fr": { | |
| 14294 | "stringUnit": { | |
| 14295 | "state": "translated", | |
| 14296 | "value": "Aller à la date…" | |
| 14297 | } | |
| 14298 | }, | |
| 14299 | "ja": { | |
| 14300 | "stringUnit": { | |
| 14301 | "state": "translated", | |
| 14302 | "value": "日付へ移動…" | |
| 14303 | } | |
| 14304 | }, | |
| 14305 | "pt-BR": { | |
| 14306 | "stringUnit": { | |
| 14307 | "state": "translated", | |
| 14308 | "value": "Ir para Data…" | |
| 14309 | } | |
| 14310 | } | |
| 14311 | } | |
| 14312 | }, | |
| 14279 | 14313 | "Go to Entry": { |
| 14280 | 14314 | "localizations": { |
| 14281 | 14315 | "de": { |