mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-01-28 05:19:17 +01:00
38 lines
967 B
Swift
38 lines
967 B
Swift
|
import SwiftUI
|
||
|
import DesignSystem
|
||
|
|
||
|
struct AppAccountView: View {
|
||
|
@EnvironmentObject var appAccounts: AppAccountsManager
|
||
|
@StateObject var viewModel: AppAccountViewModel
|
||
|
|
||
|
var body: some View {
|
||
|
HStack {
|
||
|
if let account = viewModel.account {
|
||
|
ZStack(alignment: .topTrailing) {
|
||
|
AvatarView(url: account.avatar)
|
||
|
if viewModel.appAccount.id == appAccounts.currentAccount.id {
|
||
|
Image(systemName: "checkmark.circle.fill")
|
||
|
.foregroundColor(.green)
|
||
|
.offset(x: 5, y: -5)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
VStack(alignment: .leading) {
|
||
|
Text(viewModel.appAccount.server)
|
||
|
.font(.headline)
|
||
|
if let account = viewModel.account {
|
||
|
Text(account.displayName)
|
||
|
Text(account.username)
|
||
|
.font(.footnote)
|
||
|
.foregroundColor(.gray)
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
.onAppear {
|
||
|
Task {
|
||
|
await viewModel.fetchAccount()
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|