diff --git a/moxin-frontend/src/shared/download_notification_popup.rs b/moxin-frontend/src/shared/download_notification_popup.rs index fdbfb2f..5ca15cf 100644 --- a/moxin-frontend/src/shared/download_notification_popup.rs +++ b/moxin-frontend/src/shared/download_notification_popup.rs @@ -1,2 +1,189 @@ -use makepad_widgets::*; \ No newline at end of file +use makepad_widgets::*; +use moxin_protocol::data::{File, FileID}; + +use crate::shared::actions::DownloadAction; + +use super::modal::ModalAction; + +live_design! { + import makepad_widgets::base::*; + import makepad_widgets::theme_desktop_dark::*; + + import crate::shared::styles::*; + import crate::shared::resource_imports::*; + import crate::landing::shared::*; + import makepad_draw::shader::std::*; + + SUCCESS_ICON = dep("crate://self/resources/images/success_icon.png") + FAILURE_ICON = dep("crate://self/resources/images/failure_icon.png") + + PRIMARY_LINK_FONT_COLOR = #x0E7090 + SECONDARY_LINK_FONT_COLOR = #667085 + + PopupActionLink = { + width: Fit, + draw_text: { + text_style: {font_size: 9}, + fn get_color(self) -> vec4 { + return mix( + mix( + PRIMARY_LINK_FONT_COLOR, + PRIMARY_LINK_FONT_COLOR, + self.hover + ), + PRIMARY_LINK_FONT_COLOR, + self.pressed + ) + } + } + } + + PopupSecondaryActionLink = { + width: Fit, + draw_text: { + text_style: {font_size: 9}, + fn get_color(self) -> vec4 { + return mix( + mix( + SECONDARY_LINK_FONT_COLOR, + SECONDARY_LINK_FONT_COLOR, + self.hover + ), + SECONDARY_LINK_FONT_COLOR, + self.pressed + ) + } + } + } + + PopupDialog = { + width: 350 + height: Fit + margin: {top: 20, right: 20} + padding: {top: 20, right: 20 bottom: 20 left: 20} + spacing: 15 + + show_bg: true + draw_bg: { + color: #fff + instance border_radius: 4.0 + fn pixel(self) -> vec4 { + let border_color = #d4; + let border_width = 1; + let sdf = Sdf2d::viewport(self.pos * self.rect_size); + let body = #fff + + sdf.box( + 1., + 1., + self.rect_size.x - 2.0, + self.rect_size.y - 2.0, + self.border_radius + ) + sdf.fill_keep(body) + + sdf.stroke( + border_color, + border_width + ) + return sdf.result + } + } + } + + PopupCloseButton = { + width: Fit, + height: Fit, + align: {x: 0.5, y: 0.5} + cursor: Hand + + button_icon = { + draw_icon: { + svg_file: (ICON_CLOSE), + fn get_color(self) -> vec4 { + return #000; + } + } + icon_walk: {width: 10, height: 10} + } + } + + NotificationIcons = { + width: Fit, + height: Fit, + margin: {top: -10, left: -10} + success_icon = { + width: Fit, + height: Fit, + { + source: (SUCCESS_ICON), + width: 35, + height: 35, + } + } + failure_icon = { + visible: false, + width: Fit, + height: Fit, + { + source: (FAILURE_ICON), + width: 35, + height: 35, + } + } + } + + NotificationContent = { + width: Fill, + height: Fit, + flow: Down, + spacing: 10 + + title =