Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions AppleNugs/Views/ArtistListView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct ArtistListView: View {
@State private var filter = ""
@State private var loading = false
@State private var error: String?
/// Every artist's photo, by id (iOS). Empty until the walk lands, and for
/// Every artist's photo, by id. Empty until the walk lands, and for
/// good if it fails — rows show the monogram meanwhile.
@State private var avatars: [String: URL] = [:]
@FocusState private var filterFocused: Bool
Expand Down Expand Up @@ -67,11 +67,9 @@ struct ArtistListView: View {
// ruling 2: no show counts), heavy 17 on frost
// rules, under heavy slush letter headers.
HStack(spacing: 12) {
#if os(iOS)
// The artist's photo, as on Home's crate.
ArtistPortrait(url: avatars[artist.id], name: artist.name)
.frame(width: Self.portraitSide, height: Self.portraitSide)
#endif
Text(artist.name)
.font(theme.type.title(17))
.foregroundStyle(theme.palette.textPrimary)
Expand Down Expand Up @@ -187,15 +185,18 @@ struct ArtistListView: View {
} catch {
self.error = error.localizedDescription
}
#if os(iOS)
// After the names are on screen: photos are a nicety, never a reason
// to hold the list back, and a failure reports nothing.
if !artists.isEmpty, avatars.isEmpty {
avatars = (try? await app.allArtistAvatars()) ?? [:]
}
#endif
}

/// The row's photo: 40pt, a size that reads as a face in a dense list.
/// The row's photo: a size that reads as a face in a dense list — 40pt on
/// a phone, 32pt in the Mac's tighter rows.
#if os(iOS)
private static let portraitSide: CGFloat = 40
#else
private static let portraitSide: CGFloat = 32
#endif
}
12 changes: 6 additions & 6 deletions AppleNugs/Views/HomeView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,9 @@ struct HomeView: View {
.padding(.vertical, 2)
}

/// The crate's grid. The Mac keeps the design sheet's `.crategrid`: rows of
/// a small monogram and the name, three across a ~800pt Home. iOS gets
/// compact TILES instead — monogram above, name below — because rows sized
/// The crate's grid. The Mac keeps the design sheet's `.crategrid` layout:
/// rows of a small circular photo and the name, three across a ~800pt Home.
/// iOS gets compact TILES instead — photo above, name below — because rows sized
/// for the Mac ran the full width of a phone (one ~350pt bar per artist)
/// and of the Duo's right column, mostly bare. Tiles put three across a
/// portrait phone and five across the flat Duo's column.
Expand Down Expand Up @@ -273,7 +273,9 @@ struct HomeView: View {

private func crateCell(_ artist: ArtistEntry) -> some View {
HStack(spacing: 11) {
MonogramTile(text: artist.name, size: 36)
// The artist's photo in a circle, as on iOS and the Artists list.
ArtistPortrait(url: avatars[artist.id], name: artist.name)
.frame(width: 36, height: 36)
Text(artist.name)
.font(theme.type.body(14))
.foregroundStyle(theme.palette.textPrimary)
Expand Down Expand Up @@ -359,13 +361,11 @@ struct HomeView: View {
} catch {
sampleError = error.localizedDescription
}
#if os(iOS)
// Photos are a nicety on top of a crate that already works: a failure
// leaves the monograms, and reports nothing.
if !sample.isEmpty {
avatars = (try? await app.artistAvatars(ids: sample.map(\.id))) ?? [:]
}
#endif
}
}

Expand Down
Loading