aboutsummaryrefslogtreecommitdiff
path: root/HoloBar
diff options
context:
space:
mode:
authorFuwn <[email protected]>2025-02-12 21:41:09 -0800
committerFuwn <[email protected]>2025-02-12 21:41:09 -0800
commitd70954016a2ea2fb903d75e28161bf473307215e (patch)
tree54616c4090076e12a3784bfde4b2e0c106331c0c /HoloBar
parentfeat(CharacterFetcher): Track raw name and affiliation (diff)
downloadholobar-d70954016a2ea2fb903d75e28161bf473307215e.tar.xz
holobar-d70954016a2ea2fb903d75e28161bf473307215e.zip
feat(HoloBarApp): Add more avatar fallback levels
Diffstat (limited to 'HoloBar')
-rw-r--r--HoloBar/HoloBarApp.swift20
1 files changed, 17 insertions, 3 deletions
diff --git a/HoloBar/HoloBarApp.swift b/HoloBar/HoloBarApp.swift
index 3fb0154..eac0acd 100644
--- a/HoloBar/HoloBarApp.swift
+++ b/HoloBar/HoloBarApp.swift
@@ -17,9 +17,23 @@ struct HoloBarApp: App {
}) {
HStack {
if showAvatars {
- AsyncImage(url: character.avatarURL, content: { $0 }, placeholder: {
- Image(systemName: "person.crop.circle")
- })
+ AsyncImage(url: character.avatarURL) { phase in
+ if let image = phase.image {
+ image
+ .resizable()
+ .scaledToFill()
+ } else if phase.error != nil {
+ Image(systemName: "person.crop.circle.badge.exclamationmark")
+ .resizable()
+ .scaledToFit()
+ .foregroundStyle(.gray)
+ } else {
+ Image(systemName: "person.crop.circle")
+ .resizable()
+ .scaledToFit()
+ .foregroundStyle(.gray)
+ }
+ }
}
Text(character.name)