From 2ab52d3d3e11242bec4b9a152a98ea4293ca91f1 Mon Sep 17 00:00:00 2001 From: Thomas Ricouard Date: Wed, 26 Jun 2024 09:43:27 +0200 Subject: [PATCH] Optimize some text --- .../Row/Subviews/StatusRowHeaderView.swift | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/Packages/StatusKit/Sources/StatusKit/Row/Subviews/StatusRowHeaderView.swift b/Packages/StatusKit/Sources/StatusKit/Row/Subviews/StatusRowHeaderView.swift index 19438d3a..2a706560 100644 --- a/Packages/StatusKit/Sources/StatusKit/Row/Subviews/StatusRowHeaderView.swift +++ b/Packages/StatusKit/Sources/StatusKit/Row/Subviews/StatusRowHeaderView.swift @@ -27,7 +27,7 @@ struct StatusRowHeaderView: View { } } .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 { 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 { - 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 { - return Text(Image(systemName: "lock.fill")) + Text(" ") + return Text("\(Image(systemName: "lock.fill")) ") } - return Text("") + return nil } private var dateView: some View { - Group { - Text(Image(systemName: viewModel.finalStatus.visibility.iconName)) + - Text(" ⸱ ") + - Text(viewModel.finalStatus.createdAt.relativeFormatted) - } + Text("\(Image(systemName: viewModel.finalStatus.visibility.iconName)) ⸱ \(viewModel.finalStatus.createdAt.relativeFormatted)") .fixedSize(horizontal: false, vertical: true) .font(.scaledFootnote) .foregroundStyle(.secondary)