// Asked of you: the questions only the owner can answer, as slips. Moved out// of Home's bands unchanged; the board draws it above its tiles.importCottonKitimportSwiftUI// MARK: - Asked of you/// **Asked of you** — the questions only the owner can answer, as torn slips/// of dyed paper, three to a row: the count and what it counts, typed. Normally/// fewer than five.////// One slip per SOURCE, each opening the surface where the answer is given. It/// is deliberately not a list of items: four sources with one slip each is a/// glance; fifty items is a second inbox. The paper and the rows are/// `DecideSlips`'; the words are the core's (`shell.today`).////// **No cap, no slice, no "N more"** — `ASKED_KEYS` is four long and/// zero-count rows are dropped, so the band is 0–4 slips structurally, and/// nothing at all when nothing waits.////// **There is no loading state either.** The read answers `[]` while anything/// is in flight, so loading and empty paint identically — a skeleton here would/// be a shape promising slips that may not exist.publicstructAskedBand: View {privatelet items: [AskedItem]privatelet onOpen: (String) -> Voidprivatelet onAnswered: () -> Void @Environment(\.theme) privatevar themepublicinit( items: [AskedItem], onOpen: @escaping (String) -> Void, onAnswered: @escaping () -> Void = {} ) {self.items = itemsself.onOpen = onOpenself.onAnswered = onAnswered }publicvar body: someView {if !items.isEmpty { VStack(alignment: .leading, spacing: AskedBandKnobs.boardAskedBandSpacing) {PaperSection(title: ShellLines.line("board", "asked.title"))// A row that asks tile by tile is answered in place: its// tiles, never a slip that opens a list of them. A person// asking to join is a card in their own database; an arrival// is answered in the window's.ForEach(items.filter { !$0.tiles.isEmpty }) { item inForEach(item.tiles) { tile inArrivalTile(tile: tile, onAnswered: onAnswered) } } slips(items.filter { $0.tiles.isEmpty }) } .accessibilityIdentifier("home-asked") } }/// A `Grid`, not a lazy one: the slips in a row share the row's height, so/// a sentence that wraps to three lines does not leave its neighbours short.privatefunc slips(_ items: [AskedItem]) -> someView {let rows = DecideSlips.rows(DecideSlips.slips(items), columns: AskedBandKnobs.boardAskedBandColumns)returnGrid(horizontalSpacing: RecordListSurfaceKnobs.paperGap, verticalSpacing: RecordListSurfaceKnobs.paperGap) {ForEach(Array(rows.enumerated()), id: \.offset) { _, row inGridRow {ForEach(row) { slip inButton(action: { onOpen(slip.path) }) {Paper(dye: slip.dye, edge: .torn, seed: "decide-\(slip.key.rawValue)", fills: true) {Text(slip.label) .paperBody(theme.scale.bodySize) .lineLimit(AskedBandKnobs.boardAskedBandMaxLines) .fixedSize(horizontal: false, vertical: true) .frame(maxWidth: .infinity, maxHeight: .infinity, alignment: .leading) } .frame(minHeight: AskedBandKnobs.boardAskedBandMinHeight) .frame(maxWidth: .infinity, maxHeight: .infinity) } .buttonStyle(MotionButtonStyle()) .accessibilityLabel(slip.label) .accessibilityIdentifier("home-asked-\(slip.key.rawValue)") .modifier(UnreadUnderTheFan()) }// A short last row keeps the slips their width: the empty// cells are air, not stretched paper.ForEach(0..<(DecideSlips.width(of: rows) - row.count), id: \.self) { _ inColor.clear.gridCellUnsizedAxes([.horizontal, .vertical]) } } } } }}/// The sizes, counts and timings AskedBand draws with: Swift's own, beside/// their reader — a theme sets only its tokens (`scale.tokens`).enumAskedBandKnobs {staticlet boardAskedBandColumns = 3staticlet boardAskedBandMaxLines = 4staticlet boardAskedBandMinHeight: CGFloat = 70staticlet boardAskedBandSpacing: CGFloat = 14}