Skip to content

Commit bdb0b34

Browse files
committed
add FilePreviewer in App
1 parent 13109ff commit bdb0b34

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

src/app.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ use crate::{
2222
shared::{callout_tooltip::{
2323
CalloutTooltipWidgetRefExt,
2424
TooltipAction,
25-
}, confirmation_modal::ConfirmationModalWidgetRefExt, image_viewer::{ImageViewerAction, LoadState}}, sliding_sync::current_user_id, utils::RoomNameId, verification::VerificationAction, verification_modal::{
25+
}, confirmation_modal::ConfirmationModalWidgetRefExt, file_previewer::FilePreviewerAction, image_viewer::{ImageViewerAction, LoadState}}, sliding_sync::current_user_id, utils::RoomNameId, verification::VerificationAction, verification_modal::{
2626
VerificationModalAction,
2727
VerificationModalWidgetRefExt,
2828
}
@@ -44,6 +44,7 @@ live_design! {
4444
use crate::home::new_message_context_menu::*;
4545
use crate::shared::callout_tooltip::CalloutTooltip;
4646
use crate::shared::image_viewer::ImageViewer;
47+
use crate::shared::file_previewer::FilePreviewer;
4748
use link::tsp_link::TspVerificationModal;
4849

4950

@@ -106,6 +107,11 @@ live_design! {
106107
image_viewer_modal_inner = <ImageViewer> {}
107108
}
108109
}
110+
file_upload_modal = <Modal> {
111+
content: {
112+
file_upload_modal_inner = <FilePreviewer> {}
113+
}
114+
}
109115
<PopupList> {}
110116

111117
// Context menus should be shown in front of other UI elements,
@@ -452,6 +458,17 @@ impl MatchEvent for App {
452458
}
453459
_ => {}
454460
}
461+
match action.downcast_ref() {
462+
Some(FilePreviewerAction::Show { .. }) => {
463+
self.ui.modal(ids!(file_upload_modal)).open(cx);
464+
continue;
465+
}
466+
Some(FilePreviewerAction::Hide) => {
467+
self.ui.modal(ids!(file_upload_modal)).close(cx);
468+
continue;
469+
}
470+
_ => {}
471+
}
455472
// Handle actions to open/close the TSP verification modal.
456473
#[cfg(feature = "tsp")] {
457474
use std::ops::Deref;

0 commit comments

Comments
 (0)