From afa9fe30631ae6fc5d933cfba7a1ac0b68e0a4e3 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 15 Feb 2026 13:46:47 +0200 Subject: [PATCH] refactor(badges/content): integrate title into definition --- .../widgets/layout/ActiveContentBadges.tsx | 40 +++++++------------ 1 file changed, 14 insertions(+), 26 deletions(-) diff --git a/apps/client/src/widgets/layout/ActiveContentBadges.tsx b/apps/client/src/widgets/layout/ActiveContentBadges.tsx index 0c874f72d5..023884c0d4 100644 --- a/apps/client/src/widgets/layout/ActiveContentBadges.tsx +++ b/apps/client/src/widgets/layout/ActiveContentBadges.tsx @@ -30,6 +30,7 @@ const executeOption: BookProperty = { }; const typeMappings: Record = { iconPack: { + title: t("active_content_badges.type_icon_pack"), icon: "bx bx-package", helpPage: "g1mlRoU8CsqC", }, backendScript: { + title: t("active_content_badges.type_backend_script"), icon: "bx bx-server", helpPage: "SPirpZypehBG", apiDocsPage: "MEtfsqa5VwNi", @@ -63,6 +66,7 @@ const typeMappings: Record {additionalOptions?.length && ( <> @@ -181,35 +190,14 @@ function ActiveContentBadge({ info, note }: { note: FNote, info: ActiveContentIn ); } -function getTranslationForType(type: ActiveContentInfo["type"]) { - switch (type) { - case "iconPack": - return t("active_content_badges.type_icon_pack"); - case "backendScript": - return t("active_content_badges.type_backend_script"); - case "frontendScript": - return t("active_content_badges.type_frontend_script"); - case "widget": - return t("active_content_badges.type_widget"); - case "appCss": - return t("active_content_badges.type_app_css"); - case "renderNote": - return t("active_content_badges.type_render_note"); - case "webView": - return t("active_content_badges.type_web_view"); - case "appTheme": - return t("active_content_badges.type_app_theme"); - } -} - function ActiveContentToggle({ note, info }: { note: FNote, info: ActiveContentInfo }) { - const typeTranslation = getTranslationForType(info.type); + const { title } = typeMappings[info.type]; return info && { const attrs = note.getOwnedAttributes() .filter(attr => {