diff options
| author | Christian Cleberg <[email protected]> | 2026-04-01 23:25:54 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-04-01 23:25:54 -0500 |
| commit | a83893afa086f0050c825144fa818024db4df056 (patch) | |
| tree | c11c90f50acc633d2388e9a4940a4f3e7662b2a6 /Hutch/Views/Lookup/UserProfileView.swift | |
| parent | 7fe5ec3f69211712d39f3a1dff090119340e05d9 (diff) | |
| download | hutch-2.8.0.tar.gz hutch-2.8.0.tar.bz2 hutch-2.8.0.zip | |
feat: add Look Up screen and restrict management actions to ownersv2.8.0
Implements: https://todo.sr.ht/~ccleberg/Hutch/4
Diffstat (limited to 'Hutch/Views/Lookup/UserProfileView.swift')
| -rw-r--r-- | Hutch/Views/Lookup/UserProfileView.swift | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/Hutch/Views/Lookup/UserProfileView.swift b/Hutch/Views/Lookup/UserProfileView.swift new file mode 100644 index 0000000..3fcbb2f --- /dev/null +++ b/Hutch/Views/Lookup/UserProfileView.swift @@ -0,0 +1,52 @@ +import SwiftUI + +struct UserProfileView: View { + let user: User + + @Environment(AppState.self) private var appState + + var body: some View { + List { + if let avatarURL = user.avatar.flatMap(URL.init(string:)) { + Section { + HStack { + Spacer() + AsyncImage(url: avatarURL) { phase in + switch phase { + case .success(let image): + image + .resizable() + .scaledToFill() + case .failure, .empty: + Image(systemName: "person.crop.circle.fill") + .resizable() + .scaledToFit() + .foregroundStyle(.secondary) + .padding(20) + @unknown default: + EmptyView() + } + } + .frame(width: 96, height: 96) + .clipShape(Circle()) + .overlay { + Circle() + .stroke(Color.secondary.opacity(0.2), lineWidth: 1) + } + Spacer() + } + .listRowBackground(Color.clear) + } + } + + Section { + LabeledContent("Username", value: user.username) + LabeledContent("Canonical Name", value: user.canonicalName) + LabeledContent("Email", value: user.email) + } + } + .listStyle(.insetGrouped) + .navigationTitle(user.canonicalName) + .navigationBarTitleDisplayMode(.inline) + } +} |
