Commit 7e501c1c3d
Verified · cmc
Layout: unified · split
Sources/OrgstarMobile/AgendaScreen.swift +83 −42
| @@ -17,6 +17,7 @@ struct AgendaScreen: View, Equatable { | |||
| 17 | @Environment(ClockModel.self) private var clock | 17 | @Environment(ClockModel.self) private var clock |
| 18 | @Environment(MobileModel.self) private var model | 18 | @Environment(MobileModel.self) private var model |
| 19 | @Environment(\.colorScheme) private var colorScheme | 19 | @Environment(\.colorScheme) private var colorScheme |
| 20 | @Environment(\.dynamicTypeSize) private var typeSize | ||
| 20 | @Environment(\.openURL) private var openURL | 21 | @Environment(\.openURL) private var openURL |
| 21 | @State private var tick = 0 | 22 | @State private var tick = 0 |
| 22 | /// The time the now line shows, kept to the minute while the agenda is open. | 23 | /// The time the now line shows, kept to the minute while the agenda is open. |
| @@ -653,12 +654,18 @@ struct AgendaScreen: View, Equatable { | |||
| 653 | if case .agenda = agenda.mode { | 654 | if case .agenda = agenda.mode { |
| 654 | HStack(spacing: 2) { | 655 | HStack(spacing: 2) { |
| 655 | barButton("Earlier", "chevron.left") { step(forward: false) } | 656 | barButton("Earlier", "chevron.left") { step(forward: false) } |
| 656 | Button("Today") { goToday() } | 657 | // At accessibility sizes Today goes into the span menu, so the bar fits. |
| 657 | .font(.subheadline.weight(.semibold)) | 658 | if !typeSize.isAccessibilitySize { |
| 658 | .padding(.horizontal, 8) | 659 | Button("Today") { goToday() } |
| 659 | .frame(minHeight: 44) | 660 | .font(.subheadline.weight(.semibold)) |
| 660 | .contentShape(Rectangle()) | 661 | .padding(.horizontal, 8) |
| 662 | .frame(minHeight: 44) | ||
| 663 | .contentShape(Rectangle()) | ||
| 664 | } | ||
| 661 | Menu { | 665 | Menu { |
| 666 | if typeSize.isAccessibilitySize { | ||
| 667 | Button("Today") { goToday() } | ||
| 668 | } | ||
| 662 | Picker("Span", selection: Binding { range } set: { show($0, around: $0 == nil || todayShown ? agenda.today : firstDay) }) { | 669 | Picker("Span", selection: Binding { range } set: { show($0, around: $0 == nil || todayShown ? agenda.today : firstDay) }) { |
| 663 | ForEach(SpanRange.allCases) { Text($0.title).tag(Optional($0)) } | 670 | ForEach(SpanRange.allCases) { Text($0.title).tag(Optional($0)) } |
| 664 | Text("\(agenda.span) Days").tag(SpanRange?.none) | 671 | Text("\(agenda.span) Days").tag(SpanRange?.none) |
| @@ -686,7 +693,7 @@ struct AgendaScreen: View, Equatable { | |||
| 686 | Button(String(localized: title), systemImage: image, action: action) | 693 | Button(String(localized: title), systemImage: image, action: action) |
| 687 | .labelStyle(.iconOnly) | 694 | .labelStyle(.iconOnly) |
| 688 | .font(.body.weight(.medium)) | 695 | .font(.body.weight(.medium)) |
| 689 | .frame(width: 44, height: 44) | 696 | .frame(minWidth: 44, minHeight: 44) |
| 690 | .contentShape(Rectangle()) | 697 | .contentShape(Rectangle()) |
| 691 | } | 698 | } |
| 692 | 699 | ||
| @@ -949,44 +956,25 @@ struct AgendaRowView: View { | |||
| 949 | let day: Int | 956 | let day: Int |
| 950 | let theme: ThemeSpec | 957 | let theme: ThemeSpec |
| 951 | let dark: Bool | 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 | |||
| 963 | /// TODO and match lists have no times or statuses. | ||
| 964 | private var hasGutter: Bool { !row.gutter.isEmpty || row.icon != nil } | ||
| 952 | 965 | ||
| 953 | var body: some View { | 966 | var body: some View { |
| 954 | HStack(alignment: .top, spacing: 10) { | 967 | Group { |
| 955 | // TODO and match lists have no times or statuses. | 968 | // At accessibility sizes the gutter is a line of its own above the rest. |
| 956 | if !row.gutter.isEmpty || row.icon != nil { gutter.frame(width: 82, alignment: .leading) } | 969 | if typeSize.isAccessibilitySize { |
| 957 | VStack(alignment: .leading, spacing: 2) { | 970 | VStack(alignment: .leading, spacing: 4) { |
| 958 | HStack(alignment: .top, spacing: 5) { | 971 | if hasGutter { stackedGutter } |
| 959 | // Wraps instead of truncating the tags. | 972 | content |
| 960 | FlowLayout(spacing: 5, lineSpacing: 3) { | ||
| 961 | if !row.category.isEmpty { | ||
| 962 | HStack(spacing: 5) { | ||
| 963 | Circle().fill(categoryColor).frame(width: 7, height: 7) | ||
| 964 | Text(row.category).lineLimit(1) | ||
| 965 | } | ||
| 966 | } | ||
| 967 | if let detail = row.prefixDetail { Text(detail).lineLimit(1).truncationMode(.middle) } | ||
| 968 | ForEach([row.progress, row.detail].compactMap { $0 }, id: \.self) { progress in | ||
| 969 | Text(progress).monospacedDigit() | ||
| 970 | .padding(.horizontal, 5) | ||
| 971 | .background(.quaternary.opacity(0.7), in: Capsule()) | ||
| 972 | } | ||
| 973 | ForEach(row.tags, id: \.self) { tag in | ||
| 974 | Text(tag).lineLimit(1) | ||
| 975 | .padding(.horizontal, 5) | ||
| 976 | .background(.quaternary.opacity(0.7), in: Capsule()) | ||
| 977 | } | ||
| 978 | } | ||
| 979 | Spacer(minLength: 4) | ||
| 980 | marks | ||
| 981 | } | 973 | } |
| 982 | .font(.caption) | 974 | } else { |
| 983 | .foregroundStyle(.secondary) | 975 | HStack(alignment: .top, spacing: 10) { |
| 984 | Text(row.title.isEmpty ? " " : row.title) | 976 | if hasGutter { gutter.frame(width: gutterWidth, alignment: .leading) } |
| 985 | .font(.body) | 977 | content |
| 986 | .strikethrough(row.isDone) | ||
| 987 | .foregroundStyle(row.isDone ? .secondary : .primary) | ||
| 988 | if let habit = row.item?.habit { | ||
| 989 | HabitStrip(cells: habit.graph(today: day), theme: theme, dark: dark).padding(.top, 3) | ||
| 990 | } | 978 | } |
| 991 | } | 979 | } |
| 992 | } | 980 | } |
| @@ -995,6 +983,44 @@ struct AgendaRowView: View { | |||
| 995 | .opacity(row.isBlocked ? 0.5 : row.isDone ? 0.75 : 1) | 983 | .opacity(row.isBlocked ? 0.5 : row.isDone ? 0.75 : 1) |
| 996 | } | 984 | } |
| 997 | 985 | ||
| 986 | private var content: some View { | ||
| 987 | VStack(alignment: .leading, spacing: 2) { | ||
| 988 | HStack(alignment: .top, spacing: 5) { | ||
| 989 | // Wraps instead of truncating the tags. | ||
| 990 | FlowLayout(spacing: 5, lineSpacing: 3) { | ||
| 991 | if !row.category.isEmpty { | ||
| 992 | HStack(spacing: 5) { | ||
| 993 | Circle().fill(categoryColor).frame(width: 7, height: 7) | ||
| 994 | Text(row.category).lineLimit(1) | ||
| 995 | } | ||
| 996 | } | ||
| 997 | if let detail = row.prefixDetail { Text(detail).lineLimit(1).truncationMode(.middle) } | ||
| 998 | ForEach([row.progress, row.detail].compactMap { $0 }, id: \.self) { progress in | ||
| 999 | Text(progress).monospacedDigit() | ||
| 1000 | .padding(.horizontal, 5) | ||
| 1001 | .background(.quaternary.opacity(0.7), in: Capsule()) | ||
| 1002 | } | ||
| 1003 | ForEach(row.tags, id: \.self) { tag in | ||
| 1004 | Text(tag).lineLimit(1) | ||
| 1005 | .padding(.horizontal, 5) | ||
| 1006 | .background(.quaternary.opacity(0.7), in: Capsule()) | ||
| 1007 | } | ||
| 1008 | } | ||
| 1009 | Spacer(minLength: 4) | ||
| 1010 | marks | ||
| 1011 | } | ||
| 1012 | .font(.caption) | ||
| 1013 | .foregroundStyle(.secondary) | ||
| 1014 | Text(row.title.isEmpty ? " " : row.title) | ||
| 1015 | .font(.body) | ||
| 1016 | .strikethrough(row.isDone) | ||
| 1017 | .foregroundStyle(row.isDone ? .secondary : .primary) | ||
| 1018 | if let habit = row.item?.habit { | ||
| 1019 | HabitStrip(cells: habit.graph(today: day), theme: theme, dark: dark).padding(.top, 3) | ||
| 1020 | } | ||
| 1021 | } | ||
| 1022 | } | ||
| 1023 | |||
| 998 | /// The TODO keyword and the priority, on the category's line. | 1024 | /// The TODO keyword and the priority, on the category's line. |
| 999 | private var marks: some View { | 1025 | private var marks: some View { |
| 1000 | HStack(spacing: 5) { | 1026 | HStack(spacing: 5) { |
| @@ -1011,7 +1037,7 @@ struct AgendaRowView: View { | |||
| 1011 | Text(priority) | 1037 | Text(priority) |
| 1012 | .font(.caption2.weight(.bold)) | 1038 | .font(.caption2.weight(.bold)) |
| 1013 | .foregroundStyle(color) | 1039 | .foregroundStyle(color) |
| 1014 | .frame(width: 18, height: 18) | 1040 | .frame(width: badgeSize, height: badgeSize) |
| 1015 | .background(color.opacity(0.14), in: Circle()) | 1041 | .background(color.opacity(0.14), in: Circle()) |
| 1016 | .overlay(Circle().strokeBorder(color, lineWidth: 1.2)) | 1042 | .overlay(Circle().strokeBorder(color, lineWidth: 1.2)) |
| 1017 | .accessibilityLabel("Priority \(priority)") | 1043 | .accessibilityLabel("Priority \(priority)") |
| @@ -1057,6 +1083,21 @@ struct AgendaRowView: View { | |||
| 1057 | } | 1083 | } |
| 1058 | } | 1084 | } |
| 1059 | 1085 | ||
| 1086 | /// The gutter as one line, the icon first, for accessibility sizes. | ||
| 1087 | private var stackedGutter: some View { | ||
| 1088 | HStack(alignment: .firstTextBaseline, spacing: 6) { | ||
| 1089 | if let symbol = row.symbol { | ||
| 1090 | Image(systemName: symbol) | ||
| 1091 | .font(.caption.weight(.semibold)) | ||
| 1092 | .imageScale(row.icon == .event ? .small : .medium) | ||
| 1093 | .foregroundStyle(iconColor) | ||
| 1094 | } | ||
| 1095 | Text(row.gutter) | ||
| 1096 | .font(.subheadline.weight(.semibold).monospacedDigit()) | ||
| 1097 | .foregroundStyle(row.start != nil && row.status == .normal ? Color.primary : statusColor) | ||
| 1098 | } | ||
| 1099 | } | ||
| 1100 | |||
| 1060 | private var iconColor: Color { | 1101 | private var iconColor: Color { |
| 1061 | if row.isEvent { return categoryColor } | 1102 | if row.isEvent { return categoryColor } |
| 1062 | return row.status == .normal ? Color(.tertiaryLabel) : statusColor | 1103 | return row.status == .normal ? Color(.tertiaryLabel) : statusColor |
docs/manual/guide/14-ios.org +1 −1
| @@ -192,7 +192,7 @@ The Agenda tab shows the agenda over all your folders, with the span and start d | |||
| 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=. Below them are Go to Date…, Filter… and Select, which picks entries for an action on all of them. | 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 | - 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]]). | 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, Today, 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 | - 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. | 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 | - + on a day's header :: captures an entry scheduled on that day (see [[file:08-capture.org][Capture]]). | 197 | - + on a day's header :: captures an entry scheduled on that day (see [[file:08-capture.org][Capture]]). |
| 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. | 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. |