From 3651748d31f452ff1305174ef238259a6ce962fb Mon Sep 17 00:00:00 2001 From: Maneesh Shukla Date: Wed, 30 Jul 2025 18:54:53 +0530 Subject: [PATCH] banners: Redesign stream info banner. Fixes part of #34252. --- web/src/stream_settings_ui.ts | 32 ++++++++++++------- .../modal_banner/stream_info_banner.hbs | 5 --- .../stream_settings_overlay.hbs | 2 +- 3 files changed, 22 insertions(+), 17 deletions(-) delete mode 100644 web/templates/modal_banner/stream_info_banner.hbs diff --git a/web/src/stream_settings_ui.ts b/web/src/stream_settings_ui.ts index 5b44499153..b5fe032da1 100644 --- a/web/src/stream_settings_ui.ts +++ b/web/src/stream_settings_ui.ts @@ -4,11 +4,11 @@ import assert from "minimalistic-assert"; import type * as tippy from "tippy.js"; import render_stream_creation_confirmation_banner from "../templates/modal_banner/stream_creation_confirmation_banner.hbs"; -import render_stream_info_banner from "../templates/modal_banner/stream_info_banner.hbs"; import render_browse_streams_list from "../templates/stream_settings/browse_streams_list.hbs"; import render_browse_streams_list_item from "../templates/stream_settings/browse_streams_list_item.hbs"; import render_stream_settings_overlay from "../templates/stream_settings/stream_settings_overlay.hbs"; +import type {Banner} from "./banners.ts"; import * as blueslip from "./blueslip.ts"; import * as browser_history from "./browser_history.ts"; import * as components from "./components.ts"; @@ -30,6 +30,7 @@ import {postprocess_content} from "./postprocess_content.ts"; import * as resize from "./resize.ts"; import * as scroll_util from "./scroll_util.ts"; import * as search_util from "./search_util.ts"; +import * as settings_banner from "./settings_banner.ts"; import * as settings_config from "./settings_config.ts"; import * as settings_data from "./settings_data.ts"; import {type GroupSettingValue, current_user, realm} from "./state_data.ts"; @@ -51,6 +52,21 @@ import type {StreamSubscription} from "./sub_store.ts"; import * as util from "./util.ts"; import * as views_util from "./views_util.ts"; +const STREAM_INFO_BANNER: Banner = { + intent: "info", + label: $t({ + defaultMessage: "Channels organize conversations based on who needs to see them.", + }), + buttons: [ + { + label: $t({defaultMessage: "Learn more"}), + custom_classes: "banner-external-link", + attention: "quiet", + }, + ], + close_button: false, +}; + export function is_sub_already_present(sub: StreamSubscription): boolean { return stream_ui_updates.row_for_stream_id(sub.stream_id).length > 0; } @@ -902,16 +918,10 @@ function setup_page(callback: () => void): void { throttled_redraw_left_panel(); }); - const context = { - banner_type: compose_banner.INFO, - classname: "stream_info", - hide_close_button: true, - button_text: $t({defaultMessage: "Learn more"}), - button_link: "/help/introduction-to-channels", - }; - - $("#channels_overlay_container .nothing-selected .stream-info-banner").html( - render_stream_info_banner(context), + settings_banner.set_up_banner( + $(".stream-info-banner"), + STREAM_INFO_BANNER, + "/help/introduction-to-channels", ); // When hitting Enter in the stream creation box, we open the diff --git a/web/templates/modal_banner/stream_info_banner.hbs b/web/templates/modal_banner/stream_info_banner.hbs deleted file mode 100644 index c9f1073acc..0000000000 --- a/web/templates/modal_banner/stream_info_banner.hbs +++ /dev/null @@ -1,5 +0,0 @@ -{{#> modal_banner . }} - -{{/modal_banner}} diff --git a/web/templates/stream_settings/stream_settings_overlay.hbs b/web/templates/stream_settings/stream_settings_overlay.hbs index 84e0f96e9e..7c4c8b5cd3 100644 --- a/web/templates/stream_settings/stream_settings_overlay.hbs +++ b/web/templates/stream_settings/stream_settings_overlay.hbs @@ -73,7 +73,7 @@
-
+
{{#unless can_create_streams}}