Cotton code
77 lines · 3.6 KB · SwiftRaw
// The faces of the tools package row 7 brings back as decks (KINDS,// 7f4a5f0fb): a coding session, a memory, a mood and a meeting (the audio// face), each drawn from a synthetic record as the core would resolve it,// at the deck's card size; a session's, a memory's and a mood's records are// their faces' catalogues' (`SessionFaceCatalogue`, `MemoryFaceCatalogue`,// `MoodFaceCatalogue`), a session's task list is here. Every name, line and fact is invented.import CottonPaperimport SwiftUI@testable import CottonUIextension GalleryFaces {    /// The running session's task list, the page after its face.    static let runningTasks = [        CardPage(label: "Task list", text: "Draw the shelf face\nRegister it on the deck\nAdd the gallery specimen\nMeasure it on the stack\nPush to main"),    ]    @MainActor @ViewBuilder static var sessionCards: some View {        VStack(spacing: 8) {            stage(card, SessionFaceCatalogue.runningSession) {                SessionFace(card: SessionFaceCatalogue.runningSession, mark: SessionStateMark.ink("running"), pages: runningTasks)            }            stage(card, SessionFaceCatalogue.failedSession) {                SessionFace(card: SessionFaceCatalogue.failedSession, mark: SessionStateMark.ink("failed"))            }        }    }    @MainActor @ViewBuilder static var memoryCards: some View {        VStack(spacing: 8) {            stage(card, MemoryFaceCatalogue.namedMemory) { MemoryFace(card: MemoryFaceCatalogue.namedMemory) }            stage(card, MemoryFaceCatalogue.keptMemory) { MemoryFace(card: MemoryFaceCatalogue.keptMemory) }        }    }    @MainActor @ViewBuilder static var moodCards: some View {        VStack(spacing: 8) {            stage(card, MoodFaceCatalogue.eveningMood) { MoodFace(card: MoodFaceCatalogue.eveningMood) }            stage(card, MoodFaceCatalogue.quietMood) { MoodFace(card: MoodFaceCatalogue.quietMood) }        }    }    /// An invented meeting, ready: what was said, the decisions and the    /// transcript to turn to.    static let standup = card("audio", [        "title": .text("Example studio weekly"),        "subtitle": .list([.text("Asha Example"), .text("Ravi Example"), .text("Meera Example")]),        "date": .text("Mon 19 Oct"),        "length": .text("32 min"),    ])    static let standupPages = [        CardPage(label: "What was said", text: "## The shelf\nThe invented shelf ships on **Friday**.\n- Ravi takes the importer\n- Meera checks the *example* prints before they go out\n> The studio closes early on Thursday.", markdown: true),        CardPage(label: "Decisions", text: "Ship the shelf on Friday.\nRavi owns the importer."),        CardPage(label: "Transcript", text: "Asha: Shall we start with the shelf?\nRavi: It is nearly there."),    ]    /// A meeting still being turned into text.    static let transcribing = card("audio", [        "title": .text("Invented call with the printer"),        "date": .text("Fri 23 Oct"),        "length": .text("12 min"),        "state": .text("Turning it into text\u{2026}"),    ])    @MainActor @ViewBuilder static var meetingCards: some View {        VStack(spacing: 8) {            stage(Size.audio, standup) {                AudioFace(card: standup, peaks: [], preview: standupPages.first?.text, pages: standupPages)            }            stage(Size.audio, standup) {                AudioFace(card: standup, peaks: [], preview: standupPages.first?.text, pages: standupPages, opened: 2)            }            stage(Size.audio, transcribing) { AudioFace(card: transcribing, peaks: []) }        }    }}