From 362429451df93ce0e63c5450ff103e7907917adb Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 28 Mar 2026 11:19:14 +0200 Subject: [PATCH] feat(standalone): hide share export --- apps/client/src/widgets/dialogs/export.tsx | 18 ++++---- .../src/widgets/react/FormRadioGroup.tsx | 43 +++++++++++-------- 2 files changed, 36 insertions(+), 25 deletions(-) diff --git a/apps/client/src/widgets/dialogs/export.tsx b/apps/client/src/widgets/dialogs/export.tsx index 01caa7659f..d31bf6a126 100644 --- a/apps/client/src/widgets/dialogs/export.tsx +++ b/apps/client/src/widgets/dialogs/export.tsx @@ -1,16 +1,18 @@ +import "./export.css"; + import { useState } from "preact/hooks"; + +import froca from "../../services/froca"; import { t } from "../../services/i18n"; +import open from "../../services/open"; +import toastService, { type ToastOptionsWithRequiredId } from "../../services/toast"; import tree from "../../services/tree"; +import utils, { isStandalone } from "../../services/utils"; +import ws from "../../services/ws"; import Button from "../react/Button"; import FormRadioGroup from "../react/FormRadioGroup"; -import Modal from "../react/Modal"; -import "./export.css"; -import ws from "../../services/ws"; -import toastService, { type ToastOptionsWithRequiredId } from "../../services/toast"; -import utils from "../../services/utils"; -import open from "../../services/open"; -import froca from "../../services/froca"; import { useTriliumEvent } from "../react/hooks"; +import Modal from "../react/Modal"; interface ExportDialogProps { branchId?: string | null; @@ -79,7 +81,7 @@ export default function ExportDialog() { values={[ { value: "html", label: t("export.format_html_zip") }, { value: "markdown", label: t("export.format_markdown") }, - { value: "share", label: t("export.share-format") }, + !isStandalone && { value: "share", label: t("export.share-format") }, { value: "opml", label: t("export.format_opml") } ]} /> diff --git a/apps/client/src/widgets/react/FormRadioGroup.tsx b/apps/client/src/widgets/react/FormRadioGroup.tsx index bf81b17d83..5be724a8ce 100644 --- a/apps/client/src/widgets/react/FormRadioGroup.tsx +++ b/apps/client/src/widgets/react/FormRadioGroup.tsx @@ -1,30 +1,35 @@ import type { ComponentChildren } from "preact"; + import { useUniqueName } from "./hooks"; interface FormRadioProps { name: string; currentValue?: string; - values: { + values: ({ value: string; label: string | ComponentChildren; inlineDescription?: string | ComponentChildren; - }[]; + } | false)[]; onChange(newValue: string): void; } export default function FormRadioGroup({ values, ...restProps }: FormRadioProps) { return (
- {(values || []).map(({ value, label, inlineDescription }) => ( -
- -
- ))} + {(values || []).map((el) => { + if (!el) return null; + const { value, label, inlineDescription } = el; + return ( +
+ +
+ ); + })}
); } @@ -32,9 +37,13 @@ export default function FormRadioGroup({ values, ...restProps }: FormRadioProps) export function FormInlineRadioGroup({ values, ...restProps }: FormRadioProps) { return (
- {values.map(({ value, label }) => ())} + {values.map((el) => { + if (!el) return null; + const { value, label, inlineDescription } = el; + return ; + })}
- ) + ); } function FormRadio({ name, value, label, currentValue, onChange, labelClassName, inlineDescription }: Omit & { value: string, label: ComponentChildren, inlineDescription?: ComponentChildren, labelClassName?: string }) { @@ -50,7 +59,7 @@ function FormRadio({ name, value, label, currentValue, onChange, labelClassName, /> {inlineDescription ? <>{label} - {inlineDescription} - : label} + : label} - ) -} \ No newline at end of file + ); +}