SPB Git

Repository Public

NFTGalleryView.swift 27.3 KB 463 lines swift

1// =============================================================================2//                  SP BOUCHER | SOFTWARE & RESEARCH3//             ARTIFICIAL INTELLIGENCE • FINANCE • ENGINEERING4// =============================================================================5//6// PROJECT METADATA7// -----------------------------------------------------------------------------8// Project          : SP Wallet9// File             : Features/NFTs/NFTGalleryView.swift10// Description      : Root of the NFT section: the gallery of what the server's11//                    inventory holds (adaptive grid, filters by state, network,12//                    collection and standard, search, spam as the indexer flags13//                    it), what is really read on each network, and the entries14//                    to lookup / manual tracking, receive addresses,15//                    protections and market sources. A name or an image never16//                    qualifies a collection: the chain's own verification state17//                    is written on every card. On iPad the grid and the item18//                    page sit side by side. Offline: the dated snapshot and the19//                    cached images, no action.20// Module           : Features21// Repository       : https://git.spboucher.ai/sp-wallet-ios22// Created          : 2026-11-1823// Last Modified    : 2026-11-1824//25// =============================================================================26// AUTHOR & PROFESSIONAL AFFILIATION27// =============================================================================28//29// Author           : Simon-Pierre Boucher30// Position         : Professor of Finance31// Institution      : Université du Québec en Outaouais (UQO)32// Department       : Département des sciences administratives33// Organization     : SP Boucher34//35// Website          : https://spboucher.ai36// Git              : https://git.spboucher.ai37//38// =============================================================================39// OFFICIAL CONTACT DIRECTORY40// =============================================================================41//42// General          : info@spboucher.ai43// Professional     : contact@spboucher.ai44// Direct           : simon@spboucher.ai45// Research         : research@spboucher.ai46// Development      : dev@spboucher.ai47// Support          : support@spboucher.ai48// Security/Admin   : admin@spboucher.ai49// Notifications    : notifications@spboucher.ai50//51// Preferred Contact: support@spboucher.ai52//53// =============================================================================54// COPYRIGHT & INTELLECTUAL PROPERTY55// =============================================================================56//57// Copyright (c) 202658// Simon-Pierre Boucher59//60// All rights reserved where applicable.61//62// This file is governed by the applicable project license,63// copyright notices, institutional agreements and relevant law.64//65// Unless expressly authorized by the applicable license or66// rights holder, copying, redistribution, sublicensing,67// publication and commercial exploitation are not permitted.68//69// Existing third-party rights and notices remain unaffected.70//71// =============================================================================72// CONFIDENTIALITY & SECURITY73// =============================================================================74//75// Classification   : Public76// Distribution     : Public repository; use is governed by the project license77// Security Contact : admin@spboucher.ai78//79// Access to this source does not independently grant permission80// to redistribute or disclose confidential materials.81//82// Do not embed credentials, private keys, access tokens,83// certificates or confidential personal information.84//85// =============================================================================86// LICENSE & MAINTENANCE87// =============================================================================88//89// License          : None specified (no license file in this repository)90// Maintainer       : Simon-Pierre Boucher91// Technical Contact: dev@spboucher.ai92//93// =============================================================================94// END OF SP BOUCHER SOURCE HEADER95// =============================================================================9697import SwiftUI98import SPWalletCore99100enum NFTRoute: Hashable, Identifiable {101    case item(String), lookup, receive, networks, protections, market102    var id: Self { self }103}104105struct NFTGalleryView: View {106    @Environment(AppModel.self) private var model107    @State private var ctx: NFTContext?108109    var body: some View {110        Group {111            if let ctx { NFTGalleryScreen(ctx: ctx) } else { ProgressView().frame(maxWidth: .infinity, maxHeight: .infinity) }112        }113        .spPage()114        .navigationTitle(AppSection.nfts.title)115        .task { if ctx == nil { ctx = NFTContext.make(model.env) } }116    }117}118119/** Shown at the top of every NFT screen in the DEBUG fixture mode. Never visible in a release build. */120struct NFTFixtureBanner: View {121    let ctx: NFTContext122    var body: some View {123        #if DEBUG124        if ctx.isFixture {125            Notice(tone: .warn, title: String(localized: "DONNÉES D’ESSAI"),126                   message: String(localized: "Réponses d’essai intégrées : rien ne vient de ton portefeuille ni d’une chaîne."), icon: "testtube.2")127                .accessibilityIdentifier("nft.banner.fixture")128        }129        #endif130    }131}132133/** An NFT-domain error with the domain's own sentence. */134struct NFTErrorNotice: View {135    let error: Error136    var retry: (() -> Void)?137    var body: some View {138        let m = NFTText.errorMessage(error)139        VStack(alignment: .leading, spacing: 10) {140            Notice(tone: .danger, title: m.title, message: m.detail)141            if let retry { Button(String(localized: "Réessayer"), action: retry).buttonStyle(.spSecondary) }142        }143    }144}145146struct NFTGalleryScreen: View {147    let ctx: NFTContext148    /** A piece to show beside the grid when the layout has two columns (state restoration, layout tests). */149    var initialSelection: String?150    @Environment(AppModel.self) private var model151    @Environment(\.horizontalSizeClass) private var sizeClass152    @State private var gallery = NFTGalleryModel()153    @State private var selected: String?154    @State private var route: NFTRoute?155156    private struct ReloadKey: Hashable { let filter: NFTGalleryFilter; let online: Bool; let revision: Int }157158    var body: some View {159        GeometryReader { geo in160            if sizeClass == .regular, geo.size.width >= 700 {161                HStack(spacing: 0) {162                    column(wide: true).frame(width: min(430, geo.size.width * 0.46))163                    Divider()164                    Group {165                        if let selected { NFTItemView(ctx: ctx, key: selected, embedded: true).id(selected) }166                        else { EmptyState(icon: "photo.stack", title: String(localized: "Choisis une pièce"), message: String(localized: "Sa fiche s’affiche ici.")).frame(maxHeight: .infinity) }167                    }.frame(maxWidth: .infinity)168                }169            } else { column(wide: false) }170        }171        .onAppear { if selected == nil { selected = initialSelection } }172        .searchable(text: $gallery.filter.search, prompt: String(localized: "Nom, collection ou identifiant"))173        .toolbar { ToolbarItem(placement: .topBarTrailing) { menu } }174        .navigationDestination(item: $route) { r in destination(r).wallet(model) }175        .task(id: ReloadKey(filter: serverFilter, online: model.canOperate, revision: ctx.revision)) {176            // typing in the search field does not send one request per keystroke177            if !gallery.filter.trimmedSearch.isEmpty { try? await Task.sleep(for: .milliseconds(350)) }178            guard !Task.isCancelled else { return }179            await gallery.load(ctx, online: model.canOperate)180            if let s = selected, !gallery.items.contains(where: { $0.key == s }), gallery.live, gallery.filter.isDefault { selected = nil }181        }182    }183184    /** The part of the filter the server applies: the standard is local and must not trigger a request. */185    private var serverFilter: NFTGalleryFilter { var f = gallery.filter; f.standard = nil; return f }186187    @ViewBuilder private func destination(_ r: NFTRoute) -> some View {188        switch r {189        case .item(let key): NFTItemView(ctx: ctx, key: key)190        case .lookup: NFTLookupView(ctx: ctx, capabilities: gallery.caps.value)191        case .receive: NFTReceiveView(ctx: ctx)192        case .networks: NFTNetworksView(ctx: ctx, capabilities: gallery.caps)193        case .protections: NFTProtectionsView(ctx: ctx, capabilities: gallery.caps.value)194        case .market: NFTMarketOverviewView(ctx: ctx)195        }196    }197198    private var menu: some View {199        Menu {200            Button { Task { await gallery.sync(ctx) } } label: { Label(String(localized: "Synchroniser maintenant"), systemImage: "arrow.triangle.2.circlepath") }201                .disabled(!model.canOperate || gallery.isSyncRunning)202            Button { route = .lookup } label: { Label(String(localized: "Ouvrir ou suivre un NFT"), systemImage: "magnifyingglass") }203            Button { route = .receive } label: { Label(String(localized: "Adresses de réception"), systemImage: "arrow.down.left") }204            Divider()205            Button { route = .networks } label: { Label(String(localized: "Réseaux : ce qui est lu"), systemImage: "list.bullet.rectangle") }206            Button { route = .protections } label: { Label(String(localized: "Protections"), systemImage: "lock.shield") }207            Button { route = .market } label: { Label(String(localized: "Marché : sources et estimation"), systemImage: "chart.bar.doc.horizontal") }208        } label: { Image(systemName: "ellipsis.circle").accessibilityLabel(String(localized: "Actions NFT")) }209        .accessibilityIdentifier("nft.menu")210    }211212    // MARK: gallery column213214    private func column(wide: Bool) -> some View {215        ScrollView {216            // a plain stack: a lazy grid nested in a lazy stack re-places itself endlessly when the list above it changes height217            VStack(alignment: .leading, spacing: 14) {218                NFTFixtureBanner(ctx: ctx)219                FreshnessBanner()220                if !gallery.live, let at = gallery.savedAt, !gallery.items.isEmpty {221                    Notice(tone: .info, title: String(localized: "Inventaire du \(at.formatted(date: .abbreviated, time: .shortened))"),222                           message: String(localized: "Dernier inventaire synchronisé, non actualisé. Les filtres s’appliquent à cet instantané."), icon: "clock")223                        .accessibilityIdentifier("nft.snapshot")224                }225                if let e = gallery.error, model.canOperate { NFTErrorNotice(error: e) { Task { await gallery.load(ctx, online: true) } } }226                if let e = gallery.syncError { NFTErrorNotice(error: e) }227                header228                discoverySummary229                filters230                content231                if gallery.live, gallery.page?.cursor != nil {232                    Button { Task { await gallery.loadMore(ctx) } } label: { HStack { if gallery.loadingMore { ProgressView() }; Text(String(localized: "Afficher plus")) } }233                        .buttonStyle(.spSecondary).disabled(gallery.loadingMore || !model.canOperate).accessibilityIdentifier("nft.more")234                }235                discovery236                if let v = gallery.page?.valuation {237                    Text(String(localized: "Valeur des NFT : \(v.state == "unavailable" ? String(localized: "non disponible") : v.state) — \(NFTText.marketWhy(v.reason)). Les NFT ne valent pas zéro, ne sont pas évalués au prix plancher et n’entrent dans aucun total du portefeuille."))238                        .font(.spFootnote).foregroundStyle(Theme.mute).accessibilityIdentifier("nft.valuation")239                }240            }241            .padding(.horizontal, wide ? 14 : Theme.Space.gutter).padding(.vertical, 12)242        }243        .refreshable { if model.canOperate { await gallery.load(ctx, online: true) } }244    }245246    private var header: some View {247        HStack(alignment: .firstTextBaseline) {248            VStack(alignment: .leading, spacing: 2) {249                if gallery.live || !gallery.items.isEmpty {250                    let n = gallery.visible.count, total = gallery.page?.total251                    Text(total.map { $0 > n ? String(localized: "\(n) affichés sur \($0)") : String(localized: "\(n) NFT") } ?? String(localized: "\(n) NFT"))252                        .font(.spHeadline).foregroundStyle(Theme.ink).accessibilityIdentifier("nft.count")253                }254                Text(syncLine).font(.spFootnote).foregroundStyle(Theme.mute)255            }256            Spacer()257            Button { Task { await gallery.sync(ctx) } } label: {258                HStack(spacing: 6) { if gallery.isSyncRunning { ProgressView().controlSize(.small) } else { Image(systemName: "arrow.triangle.2.circlepath") }; Text(String(localized: "Synchroniser")) }259            }260            .buttonStyle(.bordered).font(.spCallout.weight(.semibold)).disabled(!model.canOperate || gallery.isSyncRunning).accessibilityIdentifier("nft.sync")261        }262    }263264    private var syncLine: String {265        if gallery.isSyncRunning {266            let names = (gallery.page?.sync?.running ?? []).map { gallery.caps.value?.chain($0)?.name ?? $0 }267            return names.isEmpty ? String(localized: "Synchronisation…") : String(localized: "Synchronisation : \(names.joined(separator: ", "))…")268        }269        if let last = gallery.page?.sync?.lastSyncedAt?.values.max() { return String(localized: "Dernière lecture des chaînes : \(last.formatted(date: .abbreviated, time: .shortened))") }270        return gallery.page == nil ? "" : String(localized: "Jamais synchronisé")271    }272273    /**274     What is NOT read, said above the grid in one compact row: an empty or short gallery never means "owns nothing" on a network275     that is not inventoried. The full sentences are under the grid and on the networks screen.276     */277    @ViewBuilder private var discoverySummary: some View {278        let unread = gallery.unreadChains279        let keyless = unread.filter { NFTText.isDiscoveryNotConfigured($0.reason) }, others = unread.filter { !NFTText.isDiscoveryNotConfigured($0.reason) }280        if gallery.caps.value != nil {281            VStack(alignment: .leading, spacing: 8) {282                Button { route = .networks } label: {283                    HStack(alignment: .top, spacing: 10) {284                        Image(systemName: unread.isEmpty ? "checkmark.circle.fill" : "exclamationmark.triangle.fill").foregroundStyle(unread.isEmpty ? Theme.emerald : Theme.warn).padding(.top, 1)285                        VStack(alignment: .leading, spacing: 2) {286                            if unread.isEmpty { Text(String(localized: "Tous les réseaux pris en charge sont lus")).font(.spFootnote.weight(.semibold)).foregroundStyle(Theme.ink) }287                            if !keyless.isEmpty {288                                Text(String(localized: "Découverte automatique non configurée : \(keyless.map(\.name).joined(separator: ", "))")).font(.spFootnote.weight(.semibold)).foregroundStyle(Theme.ink)289                                    .multilineTextAlignment(.leading).lineLimit(3)290                            }291                            if !others.isEmpty {292                                Text(String(localized: "Lecture partielle ou bloquée : \(others.map(\.name).joined(separator: ", "))")).font(.spFootnote.weight(.semibold)).foregroundStyle(Theme.ink)293                                    .multilineTextAlignment(.leading).lineLimit(2)294                            }295                            Text(String(localized: "Réseaux : ce qui est lu")).font(.spFootnote).foregroundStyle(Theme.blue)296                        }297                        Spacer(minLength: 4)298                        Image(systemName: "chevron.right").font(.system(size: 12, weight: .bold)).foregroundStyle(Theme.mute).padding(.top, 3)299                    }300                    .padding(12).background(Theme.surface, in: RoundedRectangle(cornerRadius: Theme.Radius.control, style: .continuous))301                    .overlay(RoundedRectangle(cornerRadius: Theme.Radius.control, style: .continuous).strokeBorder(Theme.hairline, lineWidth: 0.5))302                }303                .buttonStyle(.plain).accessibilityIdentifier("nft.networks")304                if !keyless.isEmpty {305                    Button { route = .lookup } label: { Label(String(localized: "Ouvrir ou suivre un NFT par contrat + identifiant"), systemImage: "magnifyingglass").font(.spCallout.weight(.semibold)).frame(minHeight: 36) }306                        .accessibilityIdentifier("nft.discovery.lookup")307                }308            }309        } else if let e = gallery.caps.error, model.canOperate {310            Notice(tone: .warn, title: String(localized: "État des réseaux indisponible"), message: NFTText.errorMessage(e).detail)311        }312    }313314    /** The same facts in full sentences, under the grid. */315    @ViewBuilder private var discovery: some View {316        let unread = gallery.unreadChains317        let keyless = unread.filter { NFTText.isDiscoveryNotConfigured($0.reason) }, others = unread.filter { !NFTText.isDiscoveryNotConfigured($0.reason) }318        if !keyless.isEmpty {319            Notice(tone: .warn, title: String(localized: "Découverte automatique non configurée : \(keyless.map(\.name).joined(separator: ", "))"),320                   message: String(localized: "Sur ces réseaux, le serveur ne peut pas chercher les NFT d’une adresse : la galerie n’y montre que les pièces suivies à la main. Un NFT s’y ouvre ou s’y suit par contrat + identifiant, vérifié sur la chaîne."))321                .accessibilityIdentifier("nft.discovery.keyless")322        }323        if !others.isEmpty {324            Notice(tone: .info, title: String(localized: "Lecture partielle ou bloquée : \(others.map(\.name).joined(separator: ", "))"),325                   message: others.map { "\($0.name) — \(NFTText.inventoryReason($0.reason))" }.joined(separator: "\n"))326        }327    }328329    private var filters: some View {330        VStack(alignment: .leading, spacing: 10) {331            Picker(String(localized: "État"), selection: $gallery.filter.status) {332                Text(String(localized: "Détenus")).tag(NFTGalleryFilter.Status.inWallet)333                Text(String(localized: "Suivis")).tag(NFTGalleryFilter.Status.tracked)334                Text(String(localized: "Sortis")).tag(NFTGalleryFilter.Status.left)335            }336            .pickerStyle(.segmented).disabled(!model.canOperate).accessibilityIdentifier("nft.filter.status")337            ScrollView(.horizontal, showsIndicators: false) {338                HStack(spacing: 8) {339                    filterMenu(String(localized: "Réseau"), value: gallery.filter.chain.map { gallery.caps.value?.chain($0)?.name ?? $0 }, id: "chain") {340                        Button(String(localized: "Tous les réseaux")) { gallery.filter.chain = nil }341                        ForEach(gallery.chains, id: \.self) { c in Button(gallery.caps.value?.chain(c)?.name ?? c) { gallery.filter.chain = c } }342                    }343                    filterMenu(String(localized: "Collection"), value: gallery.filter.collection.map(collectionLabel), id: "collection") {344                        Button(String(localized: "Toutes les collections")) { gallery.filter.collection = nil }345                        ForEach(gallery.collections.value ?? []) { c in Button("\(collectionLabel(c.collectionKey)) · \(c.count)") { gallery.filter.collection = c.collectionKey } }346                    }347                    filterMenu(String(localized: "Standard"), value: gallery.filter.standard.map { NFTText.standard($0) }, id: "standard") {348                        Button(String(localized: "Tous les standards")) { gallery.filter.standard = nil }349                        ForEach(gallery.standards, id: \.self) { s in Button(NFTText.standard(s)) { gallery.filter.standard = s } }350                    }351                }352            }353            if gallery.filter.standard != nil, gallery.page?.cursor != nil {354                Text(String(localized: "Le filtre par standard s’applique aux pièces déjà chargées.")).font(.spFootnote).foregroundStyle(Theme.mute)355            }356            spamLine357        }358    }359360    /** A collection is named by its key first; the creator's name is secondary text. */361    private func collectionLabel(_ key: String) -> String {362        let c = gallery.collections.value?.first { $0.collectionKey == key }363        let id = NFTKey(key).map { Money.shortAddress($0.assetId) } ?? key364        return c?.name.map { "\($0) (\(id))" } ?? id365    }366367    private func filterMenu<Content: View>(_ title: String, value: String?, id: String, @ViewBuilder content: () -> Content) -> some View {368        Menu(content: content) {369            HStack(spacing: 5) {370                Text(value.map { "\(title) : \($0)" } ?? title).lineLimit(1)371                Image(systemName: "chevron.down").font(.system(size: 10, weight: .bold))372            }373            .font(.spCallout.weight(.semibold)).foregroundStyle(value == nil ? Theme.ink : Theme.blue)374            .padding(.horizontal, 12).frame(minHeight: 36).background(Theme.elev, in: Capsule())375        }376        .accessibilityIdentifier("nft.filter.\(id)")377    }378379    @ViewBuilder private var spamLine: some View {380        let hidden = gallery.page?.hiddenSpam ?? 0381        if gallery.live, hidden > 0 || gallery.filter.showSpam {382            HStack(alignment: .firstTextBaseline) {383                Text(gallery.filter.showSpam ? String(localized: "Les pièces signalées comme indésirables par l’indexeur sont affichées.")384                     : String(localized: "\(hidden) pièce(s) signalée(s) comme indésirable(s) par l’indexeur sont masquées."))385                    .font(.spFootnote).foregroundStyle(Theme.mute)386                Spacer()387                Button(gallery.filter.showSpam ? String(localized: "Les masquer") : String(localized: "Les afficher")) { gallery.filter.showSpam.toggle() }388                    .font(.spFootnote.weight(.semibold)).accessibilityIdentifier("nft.spam.toggle")389            }390        }391    }392393    @ViewBuilder private var content: some View {394        let rows = gallery.visible395        if rows.isEmpty {396            if gallery.loading && !gallery.live { ProgressView().frame(maxWidth: .infinity).padding(.vertical, 40) }397            else if !gallery.live && gallery.items.isEmpty && gallery.error == nil {398                EmptyState(icon: "wifi.slash", title: String(localized: "Inventaire NFT non synchronisé"),399                           message: String(localized: "Aucun inventaire n’a été enregistré sur cet appareil. Il se synchronise à la prochaine connexion au serveur.")).accessibilityIdentifier("nft.empty.offline")400            } else if gallery.error != nil && gallery.items.isEmpty { EmptyView() }401            else if gallery.filter.hasNarrowing { EmptyState(icon: "line.3.horizontal.decrease.circle", title: String(localized: "Aucun NFT ne correspond")).accessibilityIdentifier("nft.empty.filter") }402            else if gallery.filter.status != .inWallet { EmptyState(icon: "photo.stack", title: String(localized: "Rien dans cette vue")).accessibilityIdentifier("nft.empty.other") }403            else if gallery.isSyncRunning {404                EmptyState(icon: "arrow.triangle.2.circlepath", title: String(localized: "Lecture des réseaux en cours"), message: String(localized: "L’inventaire se construit à partir des chaînes ; cela peut prendre une minute."))405            } else {406                EmptyState(icon: "photo.stack", title: String(localized: "Aucun NFT détecté sur les réseaux lus"),407                           message: String(localized: "Seuls les réseaux marqués « pris en charge » ont été lus. Un réseau bloqué ou non pris en charge n’a pas été inventorié : cela ne veut pas dire qu’il ne contient aucun NFT."))408                    .accessibilityIdentifier("nft.empty")409            }410        } else {411            LazyVGrid(columns: [GridItem(.adaptive(minimum: 150, maximum: 240), spacing: 12)], spacing: 12) {412                ForEach(rows) { item in413                    Button { open(item.key) } label: { NFTCard(ctx: ctx, item: item, selected: selected == item.key) }414                        .buttonStyle(.plain).accessibilityIdentifier("nft.card")415                        .contextMenu { Button { UIPasteboard.general.string = item.key } label: { Label(String(localized: "Copier la clé canonique"), systemImage: "doc.on.doc") } }416                }417            }418        }419    }420421    private func open(_ key: String) {422        if sizeClass == .regular { selected = key } else { route = .item(key) }423    }424}425426/** One piece of the gallery. The name is the creator's (untrusted text); what the chain says about the collection is written under it. */427struct NFTCard: View {428    let ctx: NFTContext429    let item: NFTSummary430    var selected = false431432    var body: some View {433        let badge = NFTText.collectionBadge(item.collection?.verifiedOnChain)434        VStack(alignment: .leading, spacing: 0) {435            NFTMediaImage(ctx: ctx, id: item.image?.id, kind: item.image?.kind, status: item.image?.status ?? "available")436                .aspectRatio(1, contentMode: .fit)437                .overlay(alignment: .topLeading) { NetworkIcon(network: item.chain, size: 22).padding(7) }438                .overlay(alignment: .topTrailing) {439                    if item.quantity != "1" {440                        Text("× \(item.quantity)").font(.system(size: 12, weight: .bold)).monospacedDigit().foregroundStyle(.white).lineLimit(1)441                            .padding(.horizontal, 7).padding(.vertical, 3).background(.black.opacity(0.62), in: Capsule()).padding(7)442                    }443                }444            VStack(alignment: .leading, spacing: 4) {445                Text(verbatim: item.displayName ?? String(localized: "Nom non disponible")).font(.system(size: 14.5, weight: .semibold))446                    .foregroundStyle(item.displayName == nil ? Theme.mute : Theme.ink).lineLimit(1)447                Text(verbatim: item.collection?.name ?? NFTKey(item.key).map { Money.shortAddress($0.assetId) } ?? "").font(.system(size: 12)).foregroundStyle(Theme.mute).lineLimit(1)448                Label(badge.0, systemImage: badge.2).font(.system(size: 11.5, weight: .semibold)).foregroundStyle(badge.1.color).lineLimit(1).minimumScaleFactor(0.8)449                Text(NFTText.standard(item.standard)).font(.system(size: 11.5)).foregroundStyle(Theme.mute).lineLimit(1)450                if let s = item.spam { Pill(text: String(localized: "Indésirable selon \(NFTText.sourceName(s.by))"), tone: .warn, icon: "exclamationmark.triangle.fill") }451                if !item.inWallet { let o = NFTText.ownership(item.state); Pill(text: o.0, tone: o.1) }452                if item.stale { Label(String(localized: "détention non relue récemment"), systemImage: "clock").font(.system(size: 11)).foregroundStyle(Theme.warn).lineLimit(1) }453            }454            .padding(10).frame(maxWidth: .infinity, alignment: .leading)455        }456        .background(Theme.surface)457        .clipShape(RoundedRectangle(cornerRadius: 16, style: .continuous))458        .overlay(RoundedRectangle(cornerRadius: 16, style: .continuous).strokeBorder(selected ? Theme.blue : Theme.hairline, lineWidth: selected ? 2 : 0.5))459        .contentShape(RoundedRectangle(cornerRadius: 16))460        .accessibilityElement(children: .combine)461    }462}463
Files main
Menu

Theme