Cotton code
63 lines · 2.8 KB · SwiftRaw
import CottonKitimport SwiftUIstruct MeetingRecoveryNote: View {    @Environment(\.theme) private var theme    let offer: MeetingRecoveryOffer    /// What Keep is doing to THIS recording right now, or nothing.    let busy: MeetingKeepStage?    /// How far the encode has got, 0…1 — drawn only while `busy` is    /// ``MeetingKeepStage/finishing``.    let progress: Double    let keep: () -> Void    let discard: () -> Void    var body: some View {        Paper(dye: .newsprint, edge: .torn, seed: "meeting-recovery", tilt: false, inset: 20) {            VStack(alignment: .leading, spacing: 12) {                Text(MeetingRecoveryWords.headline(offer))                    .paperTitle(18)                    .fixedSize(horizontal: false, vertical: true)                Text(MeetingRecoveryWords.detail(offer))                    .paperBody(13, ink: .pencil)                    .lineSpacing(2)                    .fixedSize(horizontal: false, vertical: true)                if busy == .finishing {                    // The same pencil line the record sheet draws while the                    // capture is being encoded, and for the same reason: Keep                    // runs the same transcode Stop would have.                    ZStack {                        ProgressLine(fraction: 1, seed: "meeting-recovery-track", theme: theme)                            .stroke(theme.print(.pencil), lineWidth: 0.7)                        ProgressLine(fraction: progress, seed: "meeting-recovery-progress", theme: theme)                            .stroke(                                theme.print(.ink).opacity(0.72),                                style: StrokeStyle(lineWidth: 2.4, lineCap: .round))                    }                    .blendMode(theme.printBlend)                    .frame(height: 5)                    .accessibilityIdentifier("meeting-recovery-progress")                    .accessibilityLabel(ShellLines.line("capture", "meeting.finishing_recording"))                }                HStack(spacing: 22) {                    DocketAction(                        label: MeetingRecoveryWords.keepLabel(busy),                        identifier: "meeting-recovery-keep",                        action: keep                    )                    .disabled(busy != nil)                    DocketAction(                        label: ShellLines.line("capture", "meeting.discard"),                        identifier: "meeting-recovery-discard",                        action: discard                    )                    .disabled(busy != nil)                    Spacer(minLength: 0)                }            }            .frame(maxWidth: .infinity, alignment: .leading)        }        .fixedSize(horizontal: false, vertical: true)        .accessibilityIdentifier("meeting-recovery-\(offer.marker.id)")    }}