Various UI fixes to the status (padding / tap areas / no card if image)

This commit is contained in:
Thomas Ricouard 2023-01-09 18:52:10 +01:00
parent 9a718bbe84
commit 70f60ee977
2 changed files with 27 additions and 15 deletions

View File

@ -16,7 +16,7 @@ public struct StatusCardView: View {
public var body: some View {
if let title = card.title {
VStack(alignment: .leading) {
if let imageURL = card.image, theme.statusDisplayStyle == .large {
if let imageURL = card.image {
LazyImage(url: imageURL) { state in
if let image = state.image {
image
@ -50,6 +50,7 @@ public struct StatusCardView: View {
Spacer()
}.padding(8)
}
.fixedSize(horizontal: false, vertical: true)
.background(theme.secondaryBackgroundColor)
.cornerRadius(16)
.overlay(

View File

@ -44,7 +44,7 @@ public struct StatusRowView: View {
statusView
if !viewModel.isCompact && !viewModel.isRemote, theme.statusActionsDisplay != .none {
StatusActionsView(viewModel: viewModel)
.padding(.vertical, 8)
.padding(.top, 8)
.tint(viewModel.isFocused ? theme.tintColor : .gray)
.contentShape(Rectangle())
.onTapGesture {
@ -148,7 +148,12 @@ public struct StatusRowView: View {
menuButton
}
}
makeStatusContentView(status: status) }
makeStatusContentView(status: status)
.contentShape(Rectangle())
.onTapGesture {
viewModel.navigateToDetail(routeurPath: routeurPath)
}
}
}
}
@ -167,11 +172,14 @@ public struct StatusRowView: View {
.buttonStyle(.bordered)
}
if !viewModel.displaySpoiler {
Text(status.content.asSafeAttributedString)
.font(.body)
.environment(\.openURL, OpenURLAction { url in
routeurPath.handleStatus(status: status, url: url)
})
HStack {
Text(status.content.asSafeAttributedString)
.font(.body)
.environment(\.openURL, OpenURLAction { url in
routeurPath.handleStatus(status: status, url: url)
})
Spacer()
}
if !reasons.contains(.placeholder) {
if !viewModel.isCompact, !viewModel.isEmbedLoading, let embed = viewModel.embededStatus {
@ -188,18 +196,21 @@ public struct StatusRowView: View {
}
if !status.mediaAttachments.isEmpty {
StatusMediaPreviewView(attachements: status.mediaAttachments, isNotifications: viewModel.isCompact)
.padding(.vertical, 4)
HStack {
StatusMediaPreviewView(attachements: status.mediaAttachments, isNotifications: viewModel.isCompact)
.padding(.vertical, 4)
Spacer()
}
}
if let card = status.card, viewModel.embededStatus?.url != status.card?.url, !viewModel.isEmbedLoading {
if let card = status.card,
viewModel.embededStatus?.url != status.card?.url,
status.mediaAttachments.isEmpty,
!viewModel.isEmbedLoading,
theme.statusDisplayStyle == .large {
StatusCardView(card: card)
}
}
}
.contentShape(Rectangle())
.onTapGesture {
viewModel.navigateToDetail(routeurPath: routeurPath)
}
}
@ViewBuilder