diff --git a/pgml-dashboard/src/api/cms.rs b/pgml-dashboard/src/api/cms.rs index 5117c0a3e..d9be8a869 100644 --- a/pgml-dashboard/src/api/cms.rs +++ b/pgml-dashboard/src/api/cms.rs @@ -268,7 +268,7 @@ impl Collection { Some(cluster.context.user.clone()) }; - let mut layout = crate::templates::Layout::new(&title, Some(cluster.clone())); + let mut layout = crate::templates::Layout::new(&title, Some(cluster)); if let Some(image) = image { // translate relative url into absolute for head social sharing let parts = image.split(".gitbook/assets/").collect::>(); diff --git a/pgml-dashboard/src/components/notifications/banner/banner_controller.js b/pgml-dashboard/src/components/notifications/banner/banner_controller.js deleted file mode 100644 index a4e516972..000000000 --- a/pgml-dashboard/src/components/notifications/banner/banner_controller.js +++ /dev/null @@ -1,3 +0,0 @@ -import { Controller } from '@hotwired/stimulus' - -export default class extends Controller {} diff --git a/pgml-dashboard/src/components/notifications/banner/mod.rs b/pgml-dashboard/src/components/notifications/banner/mod.rs deleted file mode 100644 index e6c0d1af6..000000000 --- a/pgml-dashboard/src/components/notifications/banner/mod.rs +++ /dev/null @@ -1,33 +0,0 @@ -use crate::Notification; -use pgml_components::component; -use sailfish::TemplateOnce; - -#[derive(TemplateOnce, Default, Clone)] -#[template(path = "notifications/banner/template.html")] -pub struct Banner { - pub notification: Notification, - pub remove_banner: bool, -} - -impl Banner { - pub fn new() -> Banner { - Banner { - notification: Notification::default(), - remove_banner: false, - } - } - - pub fn from_notification(notification: Notification) -> Banner { - Banner { - notification, - remove_banner: false, - } - } - - pub fn remove_banner(mut self, remove_banner: bool) -> Banner { - self.remove_banner = remove_banner; - self - } -} - -component!(Banner); diff --git a/pgml-dashboard/src/components/notifications/banner/banner.scss b/pgml-dashboard/src/components/notifications/marketing/alert_banner/alert_banner.scss similarity index 53% rename from pgml-dashboard/src/components/notifications/banner/banner.scss rename to pgml-dashboard/src/components/notifications/marketing/alert_banner/alert_banner.scss index 2fbeca37b..410789b05 100644 --- a/pgml-dashboard/src/components/notifications/banner/banner.scss +++ b/pgml-dashboard/src/components/notifications/marketing/alert_banner/alert_banner.scss @@ -3,32 +3,10 @@ margin-right: calc(var(--bs-gutter-x) * -0.5); } -div[data-controller="notifications-banner"] { +div[data-controller="notifications-marketing-alert-banner"] { .btn-tertiary { border: 0px; } - .news { - background-color: #{$gray-100}; - color: #{$gray-900}; - .btn-tertiary:hover { - filter: brightness(0.9); - } - } - .blog { - background-color: #{$neon-shade-100}; - .btn-tertiary { - filter: brightness(1.5); - } - } - .launch { - background-color: #{$magenta-shade-200}; - .btn-tertiary { - filter: brightness(1.5); - } - } - .tip { - background-color: #{$gray-900}; - } .level1 { background-color: #FFFF00; color: #{$gray-900}; @@ -42,7 +20,7 @@ div[data-controller="notifications-banner"] { } .close-dark { - color: #{$gray-900}; + color: #{$gray-300}; } .close-light { color: #{$gray-100}; diff --git a/pgml-dashboard/src/components/notifications/marketing/alert_banner/mod.rs b/pgml-dashboard/src/components/notifications/marketing/alert_banner/mod.rs new file mode 100644 index 000000000..bf7a1612a --- /dev/null +++ b/pgml-dashboard/src/components/notifications/marketing/alert_banner/mod.rs @@ -0,0 +1,28 @@ +use crate::Notification; +use pgml_components::component; +use sailfish::TemplateOnce; + +#[derive(TemplateOnce, Default, Clone)] +#[template(path = "notifications/marketing/alert_banner/template.html")] +pub struct AlertBanner { + pub notification: Option, +} + +impl AlertBanner { + pub fn new() -> AlertBanner { + AlertBanner { notification: None } + } + + pub fn from_notification(notification: Option<&Notification>) -> AlertBanner { + match notification { + Some(notification) => { + return AlertBanner { + notification: Some(notification.clone()), + } + } + None => return AlertBanner { notification: None }, + } + } +} + +component!(AlertBanner); diff --git a/pgml-dashboard/src/components/notifications/banner/template.html b/pgml-dashboard/src/components/notifications/marketing/alert_banner/template.html similarity index 62% rename from pgml-dashboard/src/components/notifications/banner/template.html rename to pgml-dashboard/src/components/notifications/marketing/alert_banner/template.html index c1c23262a..0f044cbc3 100644 --- a/pgml-dashboard/src/components/notifications/banner/template.html +++ b/pgml-dashboard/src/components/notifications/marketing/alert_banner/template.html @@ -1,23 +1,19 @@ <% use crate::NotificationLevel; %> - <% if !remove_banner {%> -
+ <% if notification.is_some() {%> + <% let notification = notification.unwrap(); %> +