2023-04-16 17:23:13 +00:00
|
|
|
//
|
|
|
|
// CurrentAccountView.swift
|
|
|
|
// ComposeUI
|
|
|
|
//
|
|
|
|
// Created by Shadowfacts on 3/4/23.
|
|
|
|
//
|
|
|
|
|
|
|
|
import SwiftUI
|
|
|
|
import Pachyderm
|
2023-04-16 17:47:06 +00:00
|
|
|
import TuskerComponents
|
2023-04-16 17:23:13 +00:00
|
|
|
|
|
|
|
struct CurrentAccountView: View {
|
|
|
|
let account: (any AccountProtocol)?
|
|
|
|
@EnvironmentObject private var controller: ComposeController
|
|
|
|
|
|
|
|
var body: some View {
|
2023-04-23 01:16:30 +00:00
|
|
|
controller.currentAccountContainerView(AnyView(currentAccount))
|
2023-04-20 02:20:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
private var currentAccount: some View {
|
2023-04-16 17:23:13 +00:00
|
|
|
HStack(alignment: .top) {
|
2023-04-16 17:47:06 +00:00
|
|
|
AvatarImageView(
|
|
|
|
url: account?.avatar,
|
|
|
|
size: 50,
|
|
|
|
style: controller.config.avatarStyle,
|
|
|
|
fetchAvatar: controller.fetchAvatar
|
|
|
|
)
|
|
|
|
.accessibilityHidden(true)
|
2023-04-16 17:23:13 +00:00
|
|
|
|
|
|
|
if let account {
|
|
|
|
VStack(alignment: .leading) {
|
|
|
|
controller.displayNameLabel(account, .title2, 24)
|
|
|
|
.lineLimit(1)
|
|
|
|
|
|
|
|
Text(verbatim: "@\(account.acct)")
|
|
|
|
.font(.body.weight(.light))
|
|
|
|
.foregroundColor(.secondary)
|
|
|
|
.lineLimit(1)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Spacer()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|