Accounts: Replace lock / robot emojis with SF Symbols

This commit is contained in:
Thomas Ricouard 2023-02-23 18:57:48 +01:00
parent f01a742845
commit 3f17afa8ac
2 changed files with 36 additions and 23 deletions

View file

@ -132,9 +132,19 @@ struct AccountDetailHeaderView: View {
accountAvatarView
HStack(alignment: .firstTextBaseline) {
VStack(alignment: .leading, spacing: 0) {
EmojiTextApp(.init(stringValue: account.safeDisplayName), emojis: account.emojis)
.font(.scaledHeadline)
.emojiSize(Font.scaledHeadlinePointSize)
HStack(alignment: .center, spacing: 2) {
EmojiTextApp(.init(stringValue: account.safeDisplayName), emojis: account.emojis)
.font(.scaledHeadline)
.emojiSize(Font.scaledHeadlinePointSize)
if account.bot {
Text(Image(systemName: "gearshape.fill"))
.font(.footnote)
}
if account.locked {
Text(Image(systemName: "lock.fill"))
.font(.footnote)
}
}
Text("@\(account.acct)")
.font(.scaledCallout)
.foregroundColor(.gray)
@ -196,12 +206,6 @@ struct AccountDetailHeaderView: View {
private var joinedAtView: some View {
if let joinedAt = viewModel.account?.createdAt.asDate {
HStack(spacing: 4) {
if account.bot {
Text("🤖")
}
if account.locked {
Text("🔒")
}
Image(systemName: "calendar")
Text("account.joined")
Text(joinedAt, style: .date)

View file

@ -35,25 +35,27 @@ struct StatusRowHeaderView: View {
AvatarView(url: status.account.avatar, size: .status)
}
VStack(alignment: .leading, spacing: 2) {
HStack(alignment: .center, spacing: 4) {
EmojiTextApp(.init(stringValue: status.account.safeDisplayName), emojis: status.account.emojis)
.font(.scaledSubheadline)
.emojiSize(Font.scaledSubheadlinePointSize)
.fontWeight(.semibold)
.lineLimit(1)
.layoutPriority(1)
HStack(alignment: .firstTextBaseline, spacing: 2) {
Group {
EmojiTextApp(.init(stringValue: status.account.safeDisplayName), emojis: status.account.emojis)
.font(.scaledSubheadline)
.emojiSize(Font.scaledSubheadlinePointSize)
.fontWeight(.semibold)
.lineLimit(1)
accountBadgeView
.font(.footnote)
}
.layoutPriority(1)
if theme.avatarPosition == .leading {
dateView
.font(.scaledFootnote)
.foregroundColor(.gray)
.lineLimit(1)
.offset(y: 1)
} else {
Text("@\(theme.displayFullUsername ? status.account.acct : status.account.username)")
.font(.scaledFootnote)
.foregroundColor(.gray)
.lineLimit(1)
.offset(y: 1)
}
}
if theme.avatarPosition == .top {
@ -71,13 +73,20 @@ struct StatusRowHeaderView: View {
}
}
}
private var accountBadgeView: Text {
if viewModel.status.account.bot {
return Text(Image(systemName: "gearshape.fill")) + Text(" ")
} else if viewModel.status.account.locked {
return Text(Image(systemName: "lock.fill")) + Text(" ")
}
return Text("")
}
private var dateView: Text {
Text(viewModel.status.account.bot ? "🤖 " : "") +
Text(viewModel.status.account.locked ? "🔒 " : "") +
Text(status.createdAt.relativeFormatted) +
Text("") +
Text(Image(systemName: viewModel.status.visibility.iconName))
Text(status.createdAt.relativeFormatted) +
Text("") +
Text(Image(systemName: viewModel.status.visibility.iconName))
}
@ViewBuilder