mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-26 02:01:02 +00:00
Better notifications UI
This commit is contained in:
parent
2f7653d05c
commit
d01bbda5dc
3 changed files with 23 additions and 22 deletions
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue