Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
components: Restructure component type declarations.
Sayam Samal203ca084466b
diff --git a/web/src/banners.ts b/web/src/banners.tsindex f550d6345e0..917a57cd49d 100644--- a/web/src/banners.ts+++ b/web/src/banners.ts@@ -3,15 +3,8 @@ import $ from "jquery";import render_banner from "../templates/components/banner.hbs";-type ComponentIntent = "neutral" | "brand" | "info" | "success" | "warning" | "danger";--type ActionButton = {- attention: "primary" | "quiet" | "borderless";- intent?: ComponentIntent;- label: string;- icon?: string;- custom_classes?: string;-};+import type {ActionButton} from "./buttons.ts";+import type {ComponentIntent} from "./types.ts";export type Banner = {intent: ComponentIntent;diff --git a/web/src/buttons.ts b/web/src/buttons.tsindex 84f6b30de9c..3067b611cb1 100644--- a/web/src/buttons.ts+++ b/web/src/buttons.ts@@ -1,6 +1,19 @@import $ from "jquery";import * as loading from "./loading.ts";+import type {ComponentIntent} from "./types.ts";++export const ACTION_BUTTON_ATTENTION_VALUES = ["primary", "quiet", "borderless"] as const;++export type ActionButtonAttention = (typeof ACTION_BUTTON_ATTENTION_VALUES)[number];++export type ActionButton = {+ attention: ActionButtonAttention;+ intent?: ComponentIntent;+ label: string;+ icon?: string;+ custom_classes?: string;+};let loading_indicator_count = 0;export function show_button_loading_indicator($button: JQuery): void {diff --git a/web/src/types.ts b/web/src/types.tsindex 149060b28ca..35700a5f266 100644--- a/web/src/types.ts+++ b/web/src/types.ts@@ -16,3 +16,14 @@ export const anonymous_group_schema = z.object({});export const group_setting_value_schema = z.union([z.number(), anonymous_group_schema]);++export const COMPONENT_INTENT_VALUES = [+ "neutral",+ "brand",+ "info",+ "success",+ "warning",+ "danger",+] as const;++export type ComponentIntent = (typeof COMPONENT_INTENT_VALUES)[number];