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

View File

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