diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json
index cc468ff597..d2fdb2f4b9 100644
--- a/apps/client/src/translations/en/translation.json
+++ b/apps/client/src/translations/en/translation.json
@@ -2292,6 +2292,7 @@
"active_content_badges": {
"type_icon_pack": "Icon pack",
"type_backend_script": "Backend script",
+ "type_frontend_script": "Frontend script",
"toggle_tooltip_enable_tooltip": "Click to enable this {{type}}.",
"toggle_tooltip_disable_tooltip": "Click to disable this {{type}}.",
"menu_docs": "Open documentation",
@@ -2300,6 +2301,8 @@
"menu_run_disabled": "Manually",
"menu_run_backend_startup": "When the backend starts up",
"menu_run_hourly": "Hourly",
- "menu_run_daily": "Daily"
+ "menu_run_daily": "Daily",
+ "menu_run_frontend_startup": "When the desktop frontend starts up",
+ "menu_run_mobile_startup": "When the mobile frontend starts up"
}
}
diff --git a/apps/client/src/widgets/layout/ActiveContentBadges.tsx b/apps/client/src/widgets/layout/ActiveContentBadges.tsx
index a0b3af16c7..4d00cbca26 100644
--- a/apps/client/src/widgets/layout/ActiveContentBadges.tsx
+++ b/apps/client/src/widgets/layout/ActiveContentBadges.tsx
@@ -64,7 +64,7 @@ function ActiveContentBadge({ info, note }: { note: FNote, info: ActiveContentIn
icon="bx bx-play"
triggerCommand="runActiveNote"
>{t("active_content_badges.menu_execute_now")}
-
+
>
)}
@@ -82,18 +82,18 @@ function ActiveContentBadge({ info, note }: { note: FNote, info: ActiveContentIn
);
}
-function ScriptRunOptions({ note }: { note: FNote }) {
+function ScriptRunOptions({ info, note }: { note: FNote, info: ActiveContentInfo }) {
const [ run, setRun ] = useNoteLabel(note, "run");
const options: {
title: string;
value: string | null;
- type: "backendScript" | "frontendScript";
- }[] = [
+ type: "both" | "backendScript" | "frontendScript";
+ }[] = ([
{
title: t("active_content_badges.menu_run_disabled"),
value: null,
- type: "backendScript"
+ type: "both"
},
{
title: t("active_content_badges.menu_run_backend_startup"),
@@ -110,7 +110,17 @@ function ScriptRunOptions({ note }: { note: FNote }) {
value: "hourly",
type: "backendScript"
},
- ];
+ {
+ title: t("active_content_badges.menu_run_frontend_startup"),
+ value: "frontendStartup",
+ type: "frontendScript"
+ },
+ {
+ title: t("active_content_badges.menu_run_mobile_startup"),
+ value: "mobileStartup",
+ type: "frontendScript"
+ }
+ ] as const).filter(option => option.type === "both" || option.type === info.type);
return (
@@ -131,6 +141,8 @@ function getTranslationForType(type: ActiveContentInfo["type"]) {
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");
}
}
@@ -186,6 +198,8 @@ function useActiveContentInfo(note: FNote | null | undefined) {
if (note.type === "code" && note.mime === "application/javascript;env=backend") {
type = "backendScript";
+ } else if (note.type === "code" && note.mime === "application/javascript;env=frontend") {
+ type = "frontendScript";
}
for (const labelToCheck of activeContentLabels ) {