commit 1b79bf25a6a007beb28e875bd88ad40955f3b170
parent 95fbb3fe5b47d1b73144ce864bbd6284789a10f0
Author: Michael Camilleri <[email protected]>
Date: Wed, 21 Oct 2026 00:47:38 +0900
Adjust spacing with Charts tab
Diffstat
| M | Notes/Design.md | | | 4 | ++-- |
| M | Reportage/Views/Charts/ChartsView.swift | | | 46 | +++++++++++++++++++++++++++++++--------------- |
2 files changed, 33 insertions(+), 17 deletions(-)
diff --git a/Notes/Design.md b/Notes/Design.md
@@ -955,8 +955,8 @@ all time. These trail back from today rather than following the calendar, so the start of a month isn't nearly empty. The period chosen is remembered. -The tab shows one card per question answered in the period: unarchived -questions in survey order, then archived ones. A card gives the gist: the +Under a Questions heading, the tab shows one card per question answered in +the period: unarchived questions in survey order, then archived ones. A card gives the gist: the top three answers for token and choice questions, the share answering yes, the average of a number, or the count of notes. Tapping it opens the question in full, with every answer, the lowest, average and highest number,
diff --git a/Reportage/Views/Charts/ChartsView.swift b/Reportage/Views/Charts/ChartsView.swift
@@ -45,16 +45,20 @@ struct ChartsView: View {
NavigationStack {
List {
ChartsTitle(period: $period)
- ForEach(model.summaries) { summary in
- NavigationLink {
- QuestionChartView(id: summary.id, model: model)
- } label: {
- SummaryCard(summary: summary)
+ Section {
+ ForEach(model.summaries) { summary in
+ NavigationLink {
+ QuestionChartView(id: summary.id, model: model)
+ } label: {
+ SummaryCard(summary: summary)
+ }
+ .settingsRow()
}
- .settingsRow()
- }
- if model.isLoaded, model.summaries.isEmpty {
- SettingsNote { Text("No questions were answered in this period.") }
+ if model.isLoaded, model.summaries.isEmpty {
+ SettingsNote { Text("No questions were answered in this period.") }
+ }
+ } header: {
+ SettingsHeading("Questions")
}
if !model.data.context.isEmpty {
Section {
@@ -100,18 +104,30 @@ private struct ChartsTitle: View {
}
}
-/// Chooses the period the charts cover.
+/// Chooses the period the charts cover. A menu rather than a picker, which
+/// a list row would show with its label at the leading edge, beside the
+/// title.
private struct PeriodMenu: View {
@Binding var period: ChartPeriod
var body: some View {
- Picker("Period", selection: $period) {
- ForEach(ChartPeriod.allCases, id: \.self) { period in
- Text(period.title).tag(period)
+ Menu {
+ Picker("Period", selection: $period) {
+ ForEach(ChartPeriod.allCases, id: \.self) { period in
+ Text(period.title).tag(period)
+ }
+ }
+ } label: {
+ HStack(spacing: 4) {
+ Text(period.title)
+ Image(systemName: "chevron.up.chevron.down")
+ .imageScale(.small)
}
+ .font(.body)
+ .foregroundStyle(Theme.accent)
}
- .pickerStyle(.menu)
- .tint(Theme.accent)
+ .accessibilityLabel("Period")
+ .accessibilityValue(period.title)
}
}