// B7: a record's face is its decoded print or today's full-name card. // A synced key whose bytes have not arrived is still a name card. The eager // media sweep supplies the print; drawing never asks the network to fetch it. import SwiftUI struct RecordPrint: View { @Environment(\.theme) private var theme let key: String? let name: String let detail: String? let seed: String let caption: String? let edge: CGFloat var size: PrintSize = .grid var tilts: Bool = true /// How wide the name's card is drawn while there is no picture; nil, as /// wide as the print. A page's face without a photo is card-sized — the /// polaroid is for a photo (architect, 13 Oct 2026). var absentWidth: CGFloat? = nil /// A face: with no picture the name (its initials) is drawn in the /// print's own window, so the frame is the same whether or not there is /// a photo (architect, r8). var framesInitials = false /// Whether `name` is a monogram — the initials a framed window carries — /// and is struck at the theme's monogram size. var monogram = false @State private var slot = MediaImageSlot() var body: some View { Group { if let image = slot.image(for: key) { InstantPrint(seed: seed, caption: caption, size: size, tilts: tilts) { Image(uiImage: image).resizable().scaledToFill() } .accessibilityIdentifier("record-print-\(seed)") } else if framesInitials { InstantPrint(seed: seed, caption: caption, size: size, tilts: tilts) { GeometryReader { geo in Text(name) .paperBody(TypedCard.nameSize(side: geo.size.width, in: theme.scale, monogram: monogram)) .lineLimit(1) .frame(width: geo.size.width, height: geo.size.height) .background(FaceTint.dye(for: seed).fill) } } .accessibilityIdentifier("record-name-card-\(seed)") } else { TypedCard(name: name, detail: detail, seed: seed, dye: FaceTint.dye(for: seed)) .frame(maxWidth: absentWidth ?? .infinity) .accessibilityIdentifier("record-name-card-\(seed)") } } // Keep the resolver mounted across both faces, so an absent print // hears the media-arrival bell and replaces the card in place. .mediaSlot($slot, key: key, edge: edge) } }