Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
feat(standalone): hide share export
Elian Doran362429451df9
diff --git a/apps/client/src/widgets/dialogs/export.tsx b/apps/client/src/widgets/dialogs/export.tsxindex 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.tsxindex 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 (<div role="group">- {(values || []).map(({ value, label, inlineDescription }) => (- <div className="form-checkbox">- <FormRadio- value={value}- label={label} inlineDescription={inlineDescription}- labelClassName="form-check-label"- {...restProps}- />- </div>- ))}+ {(values || []).map((el) => {+ if (!el) return null;+ const { value, label, inlineDescription } = el;+ return (+ <div className="form-checkbox">+ <FormRadio+ value={value}+ label={label} inlineDescription={inlineDescription}+ labelClassName="form-check-label"+ {...restProps}+ />+ </div>+ );+ })}</div>);}@@ -32,9 +37,13 @@ export default function FormRadioGroup({ values, ...restProps }: FormRadioProps)export function FormInlineRadioGroup({ values, ...restProps }: FormRadioProps) {return (<div role="group">- {values.map(({ value, label }) => (<FormRadio value={value} label={label} {...restProps} />))}+ {values.map((el) => {+ if (!el) return null;+ const { value, label, inlineDescription } = el;+ return <FormRadio value={value} label={label} inlineDescription={inlineDescription} {...restProps} />;+ })}</div>- )+ );}function FormRadio({ name, value, label, currentValue, onChange, labelClassName, inlineDescription }: Omit<FormRadioProps, "values"> & { value: string, label: ComponentChildren, inlineDescription?: ComponentChildren, labelClassName?: string }) {@@ -50,7 +59,7 @@ function FormRadio({ name, value, label, currentValue, onChange, labelClassName,/>{inlineDescription ?<><strong>{label}</strong> - {inlineDescription}</>- : label}+ : label}</label>- )-}\ No newline at end of file+ );+}