Pinned Events Timeline actions and differentiation (#3182)

This commit is contained in:
Mauro
2024-08-22 17:35:44 +02:00
committed by GitHub
parent d54e08e815
commit 4eb1ed5d09
44 changed files with 671 additions and 200 deletions
@@ -63,6 +63,7 @@ enum TimelineItemMenuAction: Identifiable, Hashable {
case endPoll(pollStartID: String)
case pin
case unpin
case viewInRoomTimeline
var id: Self { self }
@@ -106,6 +107,15 @@ enum TimelineItemMenuAction: Identifiable, Hashable {
}
}
var canAppearInPinnedEventsTimeline: Bool {
switch self {
case .viewInRoomTimeline, .pin, .unpin, .forward, .redact:
return true
default:
return false
}
}
/// The action's label.
@ViewBuilder
var label: some View {
@@ -139,6 +149,8 @@ enum TimelineItemMenuAction: Identifiable, Hashable {
Label(L10n.actionPin, icon: \.pin)
case .unpin:
Label(L10n.actionUnpin, icon: \.unpin)
case .viewInRoomTimeline:
Label(L10n.actionViewInTimeline, icon: \.visibilityOn)
}
}
}