Make status action button areas bigger

This commit is contained in:
Thomas Ricouard 2024-01-02 19:35:14 +01:00
parent f6b7b9807f
commit f699c33dfb

View file

@ -189,44 +189,43 @@ struct StatusRowActionsView: View {
} }
private func actionButton(action: Action) -> some View { private func actionButton(action: Action) -> some View {
HStack(spacing: 2) { Button {
Button { handleAction(action: action)
handleAction(action: action) } label: {
} label: { HStack(spacing: 2) {
if action == .boost { if action == .boost {
action action
.image(dataController: statusDataController, privateBoost: privateBoost()) .image(dataController: statusDataController, privateBoost: privateBoost())
.imageScale(.medium) .imageScale(.medium)
.font(.scaledBody) .font(.scaledBody)
.fontWeight(.black) .fontWeight(.black)
.contentShape(Rectangle())
} else { } else {
action action
.image(dataController: statusDataController, privateBoost: privateBoost()) .image(dataController: statusDataController, privateBoost: privateBoost())
.font(.scaledBody) .font(.scaledBody)
.contentShape(Rectangle()) }
if !isNarrow,
let count = action.count(dataController: statusDataController,
isFocused: isFocused,
theme: theme), !viewModel.isRemote
{
Text("\(count)")
.contentTransition(.numericText(value: Double(count)))
.foregroundColor(Color(UIColor.secondaryLabel))
.font(.scaledFootnote)
.monospacedDigit()
} }
} }
.buttonStyle( .contentShape(Rectangle())
.statusAction(
isOn: action.isOn(dataController: statusDataController),
tintColor: action.tintColor(theme: theme)
)
)
.disabled(action == .boost &&
(viewModel.status.visibility == .direct || viewModel.status.visibility == .priv && viewModel.status.account.id != currentAccount.account?.id))
if !isNarrow,
let count = action.count(dataController: statusDataController,
isFocused: isFocused,
theme: theme), !viewModel.isRemote
{
Text("\(count)")
.contentTransition(.numericText(value: Double(count)))
.foregroundColor(Color(UIColor.secondaryLabel))
.font(.scaledFootnote)
.monospacedDigit()
}
} }
.buttonStyle(
.statusAction(
isOn: action.isOn(dataController: statusDataController),
tintColor: action.tintColor(theme: theme)
)
)
.disabled(action == .boost &&
(viewModel.status.visibility == .direct || viewModel.status.visibility == .priv && viewModel.status.account.id != currentAccount.account?.id))
.accessibilityElement(children: .combine) .accessibilityElement(children: .combine)
.accessibilityLabel(action.accessibilityLabel(dataController: statusDataController, privateBoost: privateBoost())) .accessibilityLabel(action.accessibilityLabel(dataController: statusDataController, privateBoost: privateBoost()))
} }