Activities list: UI improvements

This commit is contained in:
Thomas Ricouard 2023-01-17 07:54:59 +01:00
parent dd6483dd37
commit 0c071e7ad5
5 changed files with 15 additions and 5 deletions

View file

@ -82,8 +82,12 @@ struct NotificationRowView: View {
private func makeContent(type: Models.Notification.NotificationType) -> some View {
if let status = notification.status {
HStack {
StatusRowView(viewModel: .init(status: status, isCompact: true))
.foregroundColor(type == .mention ? theme.labelColor : .gray)
if type == .mention {
StatusRowView(viewModel: .init(status: status, isCompact: true, showActions: true))
} else {
StatusRowView(viewModel: .init(status: status, isCompact: true, showActions: false))
.foregroundColor(.gray)
}
Spacer()
}
} else {

View file

@ -17,7 +17,7 @@ public struct StatusEmbededView: View {
HStack {
VStack(alignment: .leading) {
makeAccountView(account: status.reblog?.account ?? status.account)
StatusRowView(viewModel: .init(status: status, isCompact: true))
StatusRowView(viewModel: .init(status: status, isCompact: true, showActions: false))
}
Spacer()
}

View file

@ -22,6 +22,9 @@ public struct StatusMediaPreviewView: View {
private var imageMaxHeight: CGFloat {
if isNotifications {
if UIDevice.current.userInterfaceIdiom == .pad {
return 150
}
return 50
}
if theme.statusDisplayStyle == .compact {

View file

@ -44,7 +44,7 @@ public struct StatusRowView: View {
replyView
}
statusView
if !viewModel.isCompact && !viewModel.isRemote, theme.statusActionsDisplay != .none {
if viewModel.showActions && !viewModel.isRemote, theme.statusActionsDisplay != .none {
StatusActionsView(viewModel: viewModel)
.padding(.top, 8)
.tint(viewModel.isFocused ? theme.tintColor : .gray)

View file

@ -9,6 +9,7 @@ public class StatusRowViewModel: ObservableObject {
let isCompact: Bool
let isFocused: Bool
let isRemote: Bool
let showActions: Bool
@Published var favouritesCount: Int
@Published var isFavourited: Bool
@ -31,11 +32,13 @@ public class StatusRowViewModel: ObservableObject {
public init(status: Status,
isCompact: Bool = false,
isFocused: Bool = false,
isRemote: Bool = false) {
isRemote: Bool = false,
showActions: Bool = true) {
self.status = status
self.isCompact = isCompact
self.isFocused = isFocused
self.isRemote = isRemote
self.showActions = showActions
if let reblog = status.reblog {
self.isFavourited = reblog.favourited == true
self.isReblogged = reblog.reblogged == true