Better visibility for DM in notifications list close #1064

This commit is contained in:
Thomas Ricouard 2023-02-25 18:12:31 +01:00
parent b036e90ce4
commit d82453c513
4 changed files with 13 additions and 6 deletions

View file

@ -184,7 +184,7 @@ public struct ExploreView: View {
Section("explore.section.trending.posts") { Section("explore.section.trending.posts") {
ForEach(viewModel.trendingStatuses ForEach(viewModel.trendingStatuses
.prefix(upTo: viewModel.trendingStatuses.count > 3 ? 3 : viewModel.trendingStatuses.count)) { status in .prefix(upTo: viewModel.trendingStatuses.count > 3 ? 3 : viewModel.trendingStatuses.count)) { status in
StatusRowView(viewModel: { .init(status: status, client: client, routerPath: routerPath) }) StatusRowView(viewModel: { .init(status: status, client: client, routerPath: routerPath) })
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
.padding(.vertical, 8) .padding(.vertical, 8)
} }

View file

@ -55,11 +55,12 @@ struct NotificationRowView: View {
ZStack(alignment: .center) { ZStack(alignment: .center) {
Circle() Circle()
.strokeBorder(Color.white, lineWidth: 1) .strokeBorder(Color.white, lineWidth: 1)
.background(Circle().foregroundColor(type.tintColor())) .background(Circle().foregroundColor(type.tintColor(isPrivate: notification.status?.visibility == .priv)))
.frame(width: 24, height: 24) .frame(width: 24, height: 24)
Image(systemName: type.iconName()) Image(systemName: type.iconName(isPrivate: notification.status?.visibility == .priv))
.resizable() .resizable()
.scaledToFit()
.frame(width: 12, height: 12) .frame(width: 12, height: 12)
.foregroundColor(.white) .foregroundColor(.white)
} }

View file

@ -45,7 +45,10 @@ extension Models.Notification.NotificationType {
} }
} }
func iconName() -> String { func iconName(isPrivate: Bool) -> String {
if isPrivate {
return "tray.fill"
}
switch self { switch self {
case .status: case .status:
return "pencil" return "pencil"
@ -64,7 +67,10 @@ extension Models.Notification.NotificationType {
} }
} }
func tintColor() -> Color { func tintColor(isPrivate: Bool) -> Color {
if isPrivate {
return Color.orange.opacity(0.80)
}
switch self { switch self {
case .status, .mention, .update, .poll: case .status, .mention, .update, .poll:
return Theme.shared.tintColor.opacity(0.80) return Theme.shared.tintColor.opacity(0.80)

View file

@ -43,7 +43,7 @@ public struct NotificationsListView: View {
Button { Button {
viewModel.selectedType = type viewModel.selectedType = type
} label: { } label: {
Label(type.menuTitle(), systemImage: type.iconName()) Label(type.menuTitle(), systemImage: type.iconName(isPrivate: false))
} }
} }
} }