// Nancy's Naga Kitchen's DISH (Codex round 2, nan-dish-2; the coordinator's// bar: every fact under its words by its symbol, the face filling its card,// no act drawn on it), wherever a card names it (drawn from Loom's registry):// her terracotta band with the woven strips, the dish on her dark plate// across it, the name heavy and narrow, the kind (marked veg or meat), the// spice and the rating as chips, the start of the description, and the price// a plate and the reviews large at the foot. This is the dish face's front// in her app (`DishFace` with her labels); the pages after it are the dish// face's, with its page dots. Order is the dish's act, on the long-press fan.// No tool name on the card, no logo (none is in the repository).importCottonPaperimportCottonValuesimportSwiftUIpublicstructKitchenDishFront<Picture: View>: View {let card: DeckCardlet picture: Picture?var rating: Double?var mark: PaperInk?var labels = CardLabels()publicinit(card: DeckCard, picture: Picture?, rating: Double? = nil, mark: PaperInk? = nil, labels: CardLabels = CardLabels()) {self.card = cardself.picture = pictureself.rating = ratingself.mark = markself.labels = labels }publicvar body: someView {GeometryReader { room inlet edge = min(room.size.width * 0.62, room.size.height * 0.37) VStack(spacing: 10) { ZStack(alignment: .top) {KitchenBand().frame(height: edge * 0.72 + 14)KitchenPlate(card: card, picture: picture).frame(width: edge, height: edge).padding(.top, 14) .facePart(.picture) } .frame(height: edge + 14)KitchenDishWords(card: card, rating: rating, mark: mark)Spacer(minLength: 0)KitchenDishFoot(card: card, labels: labels) } } }}/// The dish on her dark plate; with no picture, its name's letters.structKitchenPlate<Picture: View>: View {let card: DeckCardlet picture: Picture? @Environment(\.theme) privatevar themevar body: someView { ZStack {Circle().fill(theme.colors.inkBody.color)iflet picture { picture.frame(maxWidth: .infinity, maxHeight: .infinity).clipShape(Circle()).padding(10) } elseifcase .monogram(let letters)? = KitchenPortrait.of(card) {KitchenInitials(letters: letters).padding(10) } } .shadow(color: .black.opacity(KitchenKnobs.shadow), radius: KitchenKnobs.shadowRadius, y: KitchenKnobs.shadowDrop) .accessibilityIdentifier("face-plate") }}privatestructKitchenDishWords: View {let card: DeckCardvar rating: Double?var mark: PaperInk? @Environment(\.theme) privatevar themevar body: someView { VStack(spacing: 8) {iflet title = card.text("title") {KitchenHeading(words: title, size: KitchenKnobs.heading - 4) .textCase(.uppercase) .multilineTextAlignment(.center) .lineLimit(2) .minimumScaleFactor(0.6) .fixedSize(horizontal: false, vertical: true) .accessibilityIdentifier("deck-title") .facePart(.title) } HStack(spacing: 6) {ForEach(Array(DeckCard.chips(card.text("subtitle")).enumerated()), id: \.offset) { index, chip inKitchenChip(words: chip, mark: index == 0 ? mark : nil) .facePart(.subtitle) }iflet rating {KitchenChip(words: rating.formatted(.number.precision(.fractionLength(1))), symbol: "star.fill") .accessibilityIdentifier("face-rating") } } .accessibilityElement(children: .combine) .accessibilityIdentifier("face-chips")iflet body = card.text("body") {Text(body) .font(theme.type.body(KitchenKnobs.body)) .foregroundStyle(theme.colors.inkBody.color) .multilineTextAlignment(.center) .lineLimit(2) .fixedSize(horizontal: false, vertical: true) .facePart(.body) } } .frame(maxWidth: .infinity) .padding(.horizontal, KitchenKnobs.side) }}/// The price a plate and the reviews, each large under its label.privatestructKitchenDishFoot: View {let card: DeckCardlet labels: CardLabels @Environment(\.theme) privatevar themevar body: someView { VStack(spacing: 8) {Rectangle().fill(theme.colors.hairline.color).frame(height: 1) HStack(alignment: .bottom, spacing: 12) {iflet sum = card.text("amount") {KitchenFigure(label: labels[slot: "amount"], words: sum) .accessibilityIdentifier("face-sum") .facePart(.amount) }Spacer(minLength: 0)iflet reviews = card.text("count") {KitchenFigure(label: labels[slot: "count"], words: reviews, size: KitchenKnobs.headingSmall + 4, trailing: true) .accessibilityIdentifier("face-count") } } } .padding(.horizontal, KitchenKnobs.side) }}/// The dish in Nancy's look, and the cards it is reviewed in. The kitchen's/// kit names it for its dishes (`nancy.dish`), with its rating, its kind's/// mark, its pages and its table's labels. The fixtures hold no dish, so the/// plate shows its name's letters.publicenumKitchenDishFaceCatalogue {publicstaticlet stock: FaceStock = .framedpublicstaticlet ground: FaceGround = .paperpublicstaticlet face = Face(id: "nancy.dish", specimens: [Specimen("dish", dish.reading { $0.stars = 4.5 $0.stored = ["subtitle": "veg"] $0.labels = CardLabels(bySlot: ["amount": "Price a plate", "count": "Reviews"]) })]) { card, picture, _ inDishFace(card: card, picture: picture, pages: card.pages, rating: card.stars, mark: DishKindMark.ink(card.stored["subtitle"]), kitchen: card.labels) }publicstaticlet dish = DeckCard(face: .plain, fields: ["title": .text("Invented dal"), "amount": .text("\u{20B9}180"),"subtitle": .text("Veg \u{00B7} Mild"), "count": .text("23"), "body": .text("An invented dish, cooked the morning it leaves."), ])}