Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
navbar-alerts: Update demo org banner to use buttons, not links.
Lauryn Menardfb3a48415cd4
diff --git a/web/src/navbar_alerts.ts b/web/src/navbar_alerts.tsindex 8e2dc564f2c..bd35a770cf2 100644--- a/web/src/navbar_alerts.ts+++ b/web/src/navbar_alerts.ts@@ -7,6 +7,7 @@ import render_navbar_banners_testing_popover from "../templates/popovers/navbar_import * as banners from "./banners.ts";import type {AlertBanner} from "./banners.ts";+import type {ActionButton} from "./buttons.ts";import * as channel from "./channel.ts";import * as demo_organizations_ui from "./demo_organizations_ui.ts";import * as desktop_notifications from "./desktop_notifications.ts";@@ -351,6 +352,23 @@ const bankruptcy_banner = (): AlertBanner => {const demo_organization_deadline_banner = (): AlertBanner => {const days_remaining = demo_organizations_ui.get_demo_organization_deadline_days_remaining();+ let buttons: ActionButton[] = [+ {+ attention: "borderless",+ label: $t({defaultMessage: "Learn more"}),+ custom_classes: "demo-organizations-help",+ },+ ];+ if (current_user.is_owner) {+ buttons = [+ ...buttons,+ {+ attention: "quiet",+ label: $t({defaultMessage: "Convert"}),+ custom_classes: "convert-demo-organization",+ },+ ];+ }return {process: "demo-organization-deadline",intent: days_remaining <= 7 ? "danger" : "info",@@ -358,18 +376,14 @@ const demo_organization_deadline_banner = (): AlertBanner => {$t_html({defaultMessage:- "This <z-demo-link>demo organization</z-demo-link> will be automatically deleted in {days_remaining} days, unless it's <z-convert-link>converted into a permanent organization</z-convert-link>.",+ "This demo organization will be automatically deleted in {days_remaining} days, unless it's converted into a permanent organization.",},{- "z-demo-link": (content_html) =>- `<a class="banner-link" href="https://zulip.com/help/demo-organizations" target="_blank" rel="noopener noreferrer">${content_html.join("")}</a>`,- "z-convert-link": (content_html) =>- `<a class="banner-link" href="https://zulip.com/help/demo-organizations#convert-a-demo-organization-to-a-permanent-organization" target="_blank" rel="noopener noreferrer">${content_html.join("")}</a>`,days_remaining,},),),- buttons: [],+ buttons,close_button: true,custom_classes: "navbar-alert-banner",};@@ -492,6 +506,14 @@ export function initialize(): void {}, 2000);});+ $("#navbar_alerts_wrapper").on("click", ".convert-demo-organization", () => {+ demo_organizations_ui.do_convert_demo_organization();+ });++ $("#navbar_alerts_wrapper").on("click", ".demo-organizations-help", () => {+ window.open("https://zulip.com/help/demo-organizations", "_blank", "noopener,noreferrer");+ });+$("#navbar_alerts_wrapper").on("click", ".configure-outgoing-mail-instructions", () => {window.open("https://zulip.readthedocs.io/en/latest/production/email.html",