Optimize some text

This commit is contained in:
Thomas Ricouard 2024-06-26 09:43:27 +02:00
parent cd60e0ce1a
commit 2ab52d3d3e

View file

@ -27,7 +27,7 @@ struct StatusRowHeaderView: View {
} }
} }
.accessibilityElement(children: .combine) .accessibilityElement(children: .combine)
.accessibilityLabel(Text("\(viewModel.finalStatus.account.safeDisplayName)") + Text(", ") + Text(viewModel.finalStatus.createdAt.relativeFormatted)) .accessibilityLabel(Text("\(viewModel.finalStatus.account.safeDisplayName), \(viewModel.finalStatus.createdAt.relativeFormatted)"))
.accessibilityAction { .accessibilityAction {
viewModel.navigateToAccountDetail(account: viewModel.finalStatus.account) viewModel.navigateToAccountDetail(account: viewModel.finalStatus.account)
} }
@ -84,21 +84,17 @@ struct StatusRowHeaderView: View {
} }
} }
private var accountBadgeView: Text { private var accountBadgeView: Text? {
if (viewModel.status.reblogAsAsStatus ?? viewModel.status).account.bot { if (viewModel.status.reblogAsAsStatus ?? viewModel.status).account.bot {
return Text(Image(systemName: "poweroutlet.type.b.fill")) + Text(" ") return Text("\(Image(systemName: "poweroutlet.type.b.fill")) ")
} else if (viewModel.status.reblogAsAsStatus ?? viewModel.status).account.locked { } else if (viewModel.status.reblogAsAsStatus ?? viewModel.status).account.locked {
return Text(Image(systemName: "lock.fill")) + Text(" ") return Text("\(Image(systemName: "lock.fill")) ")
} }
return Text("") return nil
} }
private var dateView: some View { private var dateView: some View {
Group { Text("\(Image(systemName: viewModel.finalStatus.visibility.iconName))\(viewModel.finalStatus.createdAt.relativeFormatted)")
Text(Image(systemName: viewModel.finalStatus.visibility.iconName)) +
Text("") +
Text(viewModel.finalStatus.createdAt.relativeFormatted)
}
.fixedSize(horizontal: false, vertical: true) .fixedSize(horizontal: false, vertical: true)
.font(.scaledFootnote) .font(.scaledFootnote)
.foregroundStyle(.secondary) .foregroundStyle(.secondary)