Commit 990043b7ec

990043b7ec74ea1681276e57e1adbb253f3de1ef

parent: 10ba31996e

Verified · cmc

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

iOS agenda: one bottom bar, tags that don't truncate

The bar keeps Earlier, Today (now a word, not a circled dot), the span
and Later. Go to Date…, Filter… and Select move to the Views menu, and
outside the day view there is no bar. The category line wraps, so every
tag shows in full instead of three cut to a few letters.

Ref #222

Layout: unified · split

Sources/OrgApp/FlowLayout.swift added +46
@@ -0,0 +1,46 @@
1import 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.
5public 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/OrgstarMobile/AgendaScreen.swift +36 −29
@@ -216,6 +216,12 @@ struct AgendaScreen: View, Equatable {
216216 Button("Search…") { asking = .search }
217217 if canSaveView { Button("Save as View…") { asking = .save } }
218218 Divider()
219 if case .agenda = agenda.mode {
220 Button("Go to Date…", systemImage: "calendar") { jumping = true }
221 }
222 Button("Filter…", systemImage: filter.isEmpty ? "line.3.horizontal.decrease" : "line.3.horizontal.decrease.circle.fill") { showingFilter = true }
223 Button("Select", systemImage: "checkmark.circle") { selecting = true }
224 Divider()
219225 Button("Board", systemImage: "rectangle.split.3x1") { showingBoard = true }
220226 } label: {
221227 Label("Views", systemImage: "list.bullet.rectangle")
@@ -642,16 +648,14 @@ struct AgendaScreen: View, Equatable {
642648 .glassEffect(.regular, in: Capsule())
643649 .onTapGesture { message = nil }
644650 }
645 HStack(spacing: 2) {
646 let isAgenda = if case .agenda = agenda.mode { true } else { false }
647 if isAgenda {
651 if case .agenda = agenda.mode {
652 HStack(spacing: 2) {
648653 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 }
654 Button("Today") { goToday() }
655 .font(.subheadline.weight(.semibold))
656 .padding(.horizontal, 8)
657 .frame(minHeight: 44)
658 .contentShape(Rectangle())
655659 Menu {
656660 Picker("Span", selection: Binding { range } set: { show($0, around: $0 == nil || todayShown ? agenda.today : firstDay) }) {
657661 ForEach(SpanRange.allCases) { Text($0.title).tag(Optional($0)) }
@@ -660,19 +664,17 @@ struct AgendaScreen: View, Equatable {
660664 Toggle("Log Mode", systemImage: "clock.arrow.circlepath", isOn: $logMode)
661665 } label: {
662666 (range.map { Text($0.title) } ?? Text("\(agenda.span) Days"))
663 .font(.footnote.weight(.semibold).monospacedDigit())
667 .font(.subheadline.weight(.semibold).monospacedDigit())
664668 .lineLimit(1)
665669 .frame(minWidth: 52, minHeight: 44)
666670 .contentShape(Rectangle())
667671 }
668672 .accessibilityLabel("Span")
669673 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) }
672674 }
675 .padding(.horizontal, 6)
676 .glassEffect(.regular.interactive(), in: Capsule())
673677 }
674 .padding(.horizontal, 6)
675 .glassEffect(.regular.interactive(), in: Capsule())
676678 }
677679 .padding(.bottom, 8)
678680 .frame(maxWidth: .infinity)
@@ -951,21 +953,26 @@ struct AgendaRowView: View {
951953 // TODO and match lists have no times or statuses.
952954 if !row.gutter.isEmpty || row.icon != nil { gutter.frame(width: 82, alignment: .leading) }
953955 VStack(alignment: .leading, spacing: 2) {
954 HStack(spacing: 5) {
955 if !row.category.isEmpty {
956 Circle().fill(categoryColor).frame(width: 7, height: 7)
957 Text(row.category).lineLimit(1).layoutPriority(1)
958 }
959 if let detail = row.prefixDetail { Text(detail).lineLimit(1).truncationMode(.middle) }
960 ForEach([row.progress, row.detail].compactMap { $0 }, id: \.self) { progress in
961 Text(progress).monospacedDigit()
962 .padding(.horizontal, 5)
963 .background(.quaternary.opacity(0.7), in: Capsule())
964 }
965 ForEach(row.tags.prefix(3), id: \.self) { tag in
966 Text(tag).lineLimit(1)
967 .padding(.horizontal, 5)
968 .background(.quaternary.opacity(0.7), in: Capsule())
956 HStack(alignment: .top, spacing: 5) {
957 // Wraps instead of truncating the tags.
958 FlowLayout(spacing: 5, lineSpacing: 3) {
959 if !row.category.isEmpty {
960 HStack(spacing: 5) {
961 Circle().fill(categoryColor).frame(width: 7, height: 7)
962 Text(row.category).lineLimit(1)
963 }
964 }
965 if let detail = row.prefixDetail { Text(detail).lineLimit(1).truncationMode(.middle) }
966 ForEach([row.progress, row.detail].compactMap { $0 }, id: \.self) { progress in
967 Text(progress).monospacedDigit()
968 .padding(.horizontal, 5)
969 .background(.quaternary.opacity(0.7), in: Capsule())
970 }
971 ForEach(row.tags, id: \.self) { tag in
972 Text(tag).lineLimit(1)
973 .padding(.horizontal, 5)
974 .background(.quaternary.opacity(0.7), in: Capsule())
975 }
969976 }
970977 Spacer(minLength: 4)
971978 marks
docs/manual/guide/07-agenda.org +1 −1
@@ -183,7 +183,7 @@ Each row shows, from left to right:
183183- 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.
184184- The category, with a colored dot, above the title. For a calendar event this is the calendar's name.
185185- 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.
186- The value of the first statistics cookie (=1/3=, =50%=) and the tags, inherited tags first, as small capsules.
187187- The habit's consistency graph, for habits.
188188- The TODO keyword as a colored badge, and the priority as a colored letter in a circle.
189189
docs/manual/guide/14-ios.org +2 −2
@@ -190,9 +190,9 @@ Tap a result to open it in the reader. A heading result opens at that heading.
190190
191191The 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.
192192
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.
194194- 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.
196196- 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.
197197- + on a day's header :: captures an entry scheduled on that day (see [[file:08-capture.org][Capture]]).
198198- 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 @@
1427614276 }
1427714277 }
1427814278 },
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 },
1427914313 "Go to Entry": {
1428014314 "localizations": {
1428114315 "de": {