mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Polls refinements (#1608)
* Refine focus behavior * Begin draft mode * Add alert on poll form * Add poll ended asset * Add fallback text for ended poll event * Cleanup * Fix assets * Remove poll feature flags * Fix UI tests * Fix ui tests * Refine discard poll alert * Remove unused import * Rename hasDraftContent -> hasContent * Restore createPoll-2 ref screenshots
This commit is contained in:
@@ -21,6 +21,7 @@ struct PollRoomTimelineView: View {
|
||||
@Environment(\.timelineStyle) var timelineStyle
|
||||
@EnvironmentObject private var context: RoomScreenViewModel.Context
|
||||
@ScaledMetric private var summaryPadding = 32
|
||||
@ScaledMetric private var iconSize = 22
|
||||
|
||||
var body: some View {
|
||||
TimelineStyler(timelineItem: timelineItem) {
|
||||
@@ -58,7 +59,11 @@ struct PollRoomTimelineView: View {
|
||||
|
||||
private var questionView: some View {
|
||||
HStack(alignment: .top, spacing: 12) {
|
||||
Image(Asset.Images.timelinePoll.name)
|
||||
let asset = poll.hasEnded ? Asset.Images.timelineEndedPoll : Asset.Images.timelinePoll
|
||||
|
||||
Image(asset.name)
|
||||
.resizable()
|
||||
.frame(width: iconSize, height: iconSize)
|
||||
|
||||
Text(poll.question)
|
||||
.multilineTextAlignment(.leading)
|
||||
|
||||
@@ -97,19 +97,31 @@ enum TimelineItemMenuAction: Identifiable, Hashable {
|
||||
}
|
||||
|
||||
/// The action's label.
|
||||
@ViewBuilder
|
||||
var label: some View {
|
||||
switch self {
|
||||
case .copy: return Label(L10n.actionCopy, systemImage: "doc.on.doc")
|
||||
case .edit: return Label(L10n.actionEdit, systemImage: "pencil.line")
|
||||
case .copyPermalink: return Label(L10n.actionCopyLinkToMessage, systemImage: "link")
|
||||
case .reply: return Label(L10n.actionReply, systemImage: "arrowshape.turn.up.left")
|
||||
case .forward: return Label(L10n.actionForward, systemImage: "arrowshape.turn.up.right")
|
||||
case .redact: return Label(L10n.actionRemove, systemImage: "trash")
|
||||
case .viewSource: return Label(L10n.actionViewSource, systemImage: "doc.text.below.ecg")
|
||||
case .retryDecryption: return Label(L10n.actionRetryDecryption, systemImage: "arrow.down.message")
|
||||
case .report: return Label(L10n.actionReportContent, systemImage: "exclamationmark.bubble")
|
||||
case .react: return Label(L10n.actionReact, systemImage: "hand.thumbsup")
|
||||
case .endPoll: return Label { Text(L10n.actionEndPoll) } icon: { Image.compound.check.resizable() }
|
||||
case .copy:
|
||||
Label(L10n.actionCopy, systemImage: "doc.on.doc")
|
||||
case .edit:
|
||||
Label(L10n.actionEdit, systemImage: "pencil.line")
|
||||
case .copyPermalink:
|
||||
Label(L10n.actionCopyLinkToMessage, systemImage: "link")
|
||||
case .reply:
|
||||
Label(L10n.actionReply, systemImage: "arrowshape.turn.up.left")
|
||||
case .forward:
|
||||
Label(L10n.actionForward, systemImage: "arrowshape.turn.up.right")
|
||||
case .redact:
|
||||
Label(L10n.actionRemove, systemImage: "trash")
|
||||
case .viewSource:
|
||||
Label(L10n.actionViewSource, systemImage: "doc.text.below.ecg")
|
||||
case .retryDecryption:
|
||||
Label(L10n.actionRetryDecryption, systemImage: "arrow.down.message")
|
||||
case .report:
|
||||
Label(L10n.actionReportContent, systemImage: "exclamationmark.bubble")
|
||||
case .react:
|
||||
Label(L10n.actionReact, systemImage: "hand.thumbsup")
|
||||
case .endPoll:
|
||||
Label { Text(L10n.actionEndPoll) } icon: { CompoundIcon(customImage: Asset.Images.endedPoll.swiftUIImage) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user