From 2103be9d2850beeba005dac786d196cb5a7ff413 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 15 Feb 2026 16:11:52 +0200 Subject: [PATCH] refactor(client): extract learn more into component --- apps/client/src/translations/en/translation.json | 3 +++ apps/client/src/widgets/type_widgets/WebView.tsx | 13 ++++--------- .../src/widgets/type_widgets/helpers/SetupForm.tsx | 14 +++++++++++++- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json index 7b38c0dd8d..341e3ed579 100644 --- a/apps/client/src/translations/en/translation.json +++ b/apps/client/src/translations/en/translation.json @@ -2314,5 +2314,8 @@ "menu_change_to_widget": "Change to widget", "menu_change_to_frontend_script": "Change to frontend script", "menu_theme_base": "Theme base" + }, + "setup_form": { + "more_info": "Learn more" } } diff --git a/apps/client/src/widgets/type_widgets/WebView.tsx b/apps/client/src/widgets/type_widgets/WebView.tsx index 90db7000d2..d61725d064 100644 --- a/apps/client/src/widgets/type_widgets/WebView.tsx +++ b/apps/client/src/widgets/type_widgets/WebView.tsx @@ -6,16 +6,16 @@ import FNote from "../../entities/fnote"; import attributes from "../../services/attributes"; import { t } from "../../services/i18n"; import toast from "../../services/toast"; -import utils, { openInAppHelpFromUrl } from "../../services/utils"; +import utils from "../../services/utils"; import Button from "../react/Button"; import FormGroup from "../react/FormGroup"; import FormTextBox from "../react/FormTextBox"; import { useNoteLabel } from "../react/hooks"; -import LinkButton from "../react/LinkButton"; import SetupForm from "./helpers/SetupForm"; import { TypeWidgetProps } from "./type_widget"; const isElectron = utils.isElectron(); +const HELP_PAGE = "1vHRoWCEjj0L"; export default function WebView({ note }: TypeWidgetProps) { const [ webViewSrc ] = useNoteLabel(note, "webViewSrc"); @@ -60,7 +60,7 @@ function SetupWebView({note}: {note: FNote}) { return ( submit(src)} > @@ -83,7 +83,7 @@ function SetupWebView({note}: {note: FNote}) { function DisabledWebView({ note, url }: { note: FNote, url: string }) { return ( - + attributes.toggleDangerousAttribute(note, "label", "webViewSrc", true)} primary /> - - openInAppHelpFromUrl("1vHRoWCEjj0L")} - /> ); } diff --git a/apps/client/src/widgets/type_widgets/helpers/SetupForm.tsx b/apps/client/src/widgets/type_widgets/helpers/SetupForm.tsx index 121b4bb692..69e491fb6c 100644 --- a/apps/client/src/widgets/type_widgets/helpers/SetupForm.tsx +++ b/apps/client/src/widgets/type_widgets/helpers/SetupForm.tsx @@ -3,19 +3,31 @@ import "./SetupForm.css"; import clsx from "clsx"; import { ComponentChildren } from "preact"; +import { t } from "../../../services/i18n"; +import { openInAppHelpFromUrl } from "../../../services/utils"; +import LinkButton from "../../react/LinkButton"; + interface SetupFormProps { icon: string; onSubmit?: () => void; children: ComponentChildren; + inAppHelpPage?: string; } -export default function SetupForm({ icon, children, onSubmit }: SetupFormProps) { +export default function SetupForm({ icon, children, onSubmit, inAppHelpPage }: SetupFormProps) { return (
{children} + + {inAppHelpPage && ( + openInAppHelpFromUrl("1vHRoWCEjj0L")} + /> + )}
);