← All repositories

reportage

A life-logging app for iPhone

git clone https://code.inqk.net/reportage.git


commit 3043a77d8109cb0c7b8b24ac1a2f0ebd822315db
parent 95c9d308f863293efe7b5fb29f310be925afc089
Author: Michael Camilleri <[email protected]>
Date:   Tue, 20 Oct 2026 18:25:10 +0900

Use explicit colour for some text fields

Diffstat

MNotes/Design.md | 4+++-
MReportage/Views/Settings/QuestionEditor.swift | 54+++++++++++++++++++++++++++++++++++++++++-------------
MReportage/Views/Theme/Theme.swift | 3+++

3 files changed, 47 insertions(+), 14 deletions(-)

diff --git a/Notes/Design.md b/Notes/Design.md

@@ -204,7 +204,9 @@ the app: a question's type is shown with a sentence on how its answers appear
 in the timeline, and the narrative rule's fields sit in the Timeline section
 under Show in Timeline, with an example of how answers read. The type is
 chosen when a question is added, in the same form, and is shown but can't be
-changed after that, since answers already given wouldn't fit another type. A
+changed after that, since answers already given wouldn't fit another type.
+Text fields sit on a faint wash of ink (`Theme.field`) so they read as
+somewhere to type, and each answer is its own field, without rules between. A
 new question goes to the end of the order, asked in the prompted survey.
 Asking an archived question brings it back in that survey alone. Removing
 questions is next.

diff --git a/Reportage/Views/Settings/QuestionEditor.swift b/Reportage/Views/Settings/QuestionEditor.swift

@@ -205,19 +205,24 @@ struct QuestionForm: View {
 
     var body: some View {
         List {
-            TextField("Question", text: $editor.prompt, axis: .vertical)
-                .font(Theme.serif(.title3, weight: .medium))
-                .focused($focus, equals: .prompt)
-                .submitLabel(.done)
-                .onChange(of: editor.prompt) { _, prompt in
-                    // Return finishes the prompt rather than starting a line.
-                    if prompt.contains("\n") {
-                        editor.prompt = prompt.replacingOccurrences(of: "\n", with: "")
-                        focus = nil
+            Section {
+                TextField("Write a question", text: $editor.prompt, axis: .vertical)
+                    .font(Theme.serif(.title3, weight: .medium))
+                    .focused($focus, equals: .prompt)
+                    .submitLabel(.done)
+                    .onChange(of: editor.prompt) { _, prompt in
+                        // Return finishes the prompt rather than starting a line.
+                        if prompt.contains("\n") {
+                            editor.prompt = prompt.replacingOccurrences(of: "\n", with: "")
+                            focus = nil
+                        }
                     }
-                }
-                .settingsRow()
-                .listRowSeparator(.hidden, edges: .top)
+                    .filledField(focus: $focus, as: .prompt)
+                    .settingsRow()
+                    .listRowSeparator(.hidden)
+            } header: {
+                SettingsHeading("Question")
+            }
             Section {
                 if editor.isNew {
                     Picker("Type", selection: $editor.kind) {
@@ -268,6 +273,20 @@ struct QuestionForm: View {
     }
 }
 
+extension View {
+    /// Draws a text field on a wash of ink so it reads as somewhere to type,
+    /// and focuses it from anywhere in the wash, not just its text.
+    fileprivate func filledField(
+        focus: FocusState<QuestionForm.Field?>.Binding, as field: QuestionForm.Field
+    ) -> some View {
+        padding(.horizontal, 12)
+            .padding(.vertical, 9)
+            .background(Theme.field, in: .rect(cornerRadius: 10))
+            .contentShape(.rect(cornerRadius: 10))
+            .onTapGesture { focus.wrappedValue = field }
+    }
+}
+
 /// A choice question's answers, which can be renamed, moved, removed and
 /// added to.
 private struct OptionsSection: View {
@@ -282,7 +301,12 @@ private struct OptionsSection: View {
                     .font(Theme.serif(.body))
                     .focused(focus, equals: .option(option.id))
                     .submitLabel(.done)
-                    .settingsRow()
+                    .filledField(focus: focus, as: .option(option.id))
+                    // Each answer is its own field, so they sit closer than
+                    // rows and need no rules between them.
+                    .listRowInsets(EdgeInsets(top: 4, leading: Theme.margin, bottom: 4, trailing: Theme.margin))
+                    .listRowBackground(Theme.paper)
+                    .listRowSeparator(.hidden)
             }
             .onMove { offsets, destination in
                 editor.options.move(fromOffsets: offsets, toOffset: destination)
@@ -359,6 +383,10 @@ private struct TimelineSection: View {
                 .multilineTextAlignment(.trailing)
                 .focused(focus, equals: .rule(index))
                 .submitLabel(.done)
+                // One width for every phrase, so fields beside labels of
+                // different lengths line up.
+                .frame(maxWidth: 200)
+                .filledField(focus: focus, as: .rule(index))
         }
         .settingsRow()
     }

diff --git a/Reportage/Views/Theme/Theme.swift b/Reportage/Views/Theme/Theme.swift

@@ -20,6 +20,9 @@ enum Theme {
     /// Screen titles: a warm ink, softer than `ink` so the title doesn't
     /// outweigh the reports beneath it.
     static let titleInk = Color(light: 0x4A433B, dark: 0xC4BDB2)
+    /// Behind a text field, so it reads as somewhere to type: a faint wash
+    /// of `ink` on `paper`.
+    static let field = Color(light: 0xE8E3D8, dark: 0x242220)
 
     // MARK: Spacing
     //