Better notifications UI

This commit is contained in:
Thomas Ricouard 2022-12-23 17:50:51 +01:00
parent 2f7653d05c
commit d01bbda5dc
3 changed files with 23 additions and 22 deletions

View file

@ -3,6 +3,6 @@ import Foundation
public struct DS {
public enum Constants {
public static let layoutPadding: CGFloat = 20
public static let dividerPadding: CGFloat = 8
public static let dividerPadding: CGFloat = 4
}
}

View file

@ -19,14 +19,18 @@ struct NotificationRowView: View {
}
VStack(alignment: .leading, spacing: 0) {
HStack(spacing: 0) {
if type.displayAccountName() {
notification.account.displayNameWithEmojis
Text(notification.account.displayName)
.font(.subheadline)
.fontWeight(.semibold)
Text(" ")
}
.fontWeight(.semibold) +
Text(" ") +
Text(type.label())
.font(.subheadline)
.font(.subheadline) +
Text("")
.font(.footnote)
.foregroundColor(.gray) +
Text(notification.createdAt.formatted)
.font(.footnote)
.foregroundColor(.gray)
Spacer()
}
if let status = notification.status {
@ -52,15 +56,6 @@ struct NotificationRowView: View {
}
extension Models.Notification.NotificationType {
func displayAccountName() -> Bool {
switch self {
case .status, .mention, .reblog, .follow, .follow_request, .favourite:
return true
case .poll, .update:
return false
}
}
func label() -> String {
switch self {
case .status:

View file

@ -18,9 +18,11 @@ public struct StatusRowView: View {
VStack(alignment: .leading) {
reblogView
statusView
if !viewModel.isEmbed {
StatusActionsView(viewModel: viewModel)
.padding(.vertical, 8)
}
}
.onAppear {
viewModel.client = client
}
@ -64,10 +66,14 @@ public struct StatusRowView: View {
})
if !status.mediaAttachments.isEmpty {
if viewModel.isEmbed {
Image(systemName: "paperclip")
} else {
StatusMediaPreviewView(attachements: status.mediaAttachments)
.padding(.vertical, 4)
}
if let card = status.card {
}
if let card = status.card, !viewModel.isEmbed {
StatusCardView(card: card)
}
}