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(import): collapse import options by default
Elian Doranca2c5707f133
diff --git a/apps/client/src/widgets/dialogs/import/files.tsx b/apps/client/src/widgets/dialogs/import/files.tsxindex b27551322a..26242fd90c 100644--- a/apps/client/src/widgets/dialogs/import/files.tsx+++ b/apps/client/src/widgets/dialogs/import/files.tsx@@ -22,6 +22,7 @@ function FilesPanel({ parentNoteId, closeDialog, setFooter }: ImportProviderPaneconst [codeImportedAsCode, setCodeImportedAsCode] = useState(true);const [spreadsheetImportedAsSpreadsheet, setSpreadsheetImportedAsSpreadsheet] = useState(true);const [replaceUnderscoresWithSpaces, setReplaceUnderscoresWithSpaces] = useState(true);+ const [optionsShown, setOptionsShown] = useState(false);useEffect(() => {void tree.getNoteTitle(parentNoteId).then(setNoteTitle);@@ -73,37 +74,43 @@ function FilesPanel({ parentNoteId, closeDialog, setFooter }: ImportProviderPane</CardSection></Card>- <Card heading={t("import.options")}>- <CardSection>- <OptionsRowWithToggle- name="safe-import" label={t("import.safeImport")} description={<RawHtml html={t("import.safeImportTooltip")} />}- currentValue={safeImport} onChange={setSafeImport}- />- <OptionsRowWithToggle- name="explode-archives" label={<RawHtml html={t("import.explodeArchives")} />} description={<RawHtml html={t("import.explodeArchivesTooltip")} />}- currentValue={explodeArchives} onChange={setExplodeArchives}- />- <OptionsRowWithToggle- name="shrink-images" label={t("import.shrinkImages")} description={<RawHtml html={t("import.shrinkImagesTooltip")} />}- currentValue={compressImages && shrinkImages} onChange={setShrinkImages} disabled={!compressImages}- />- <OptionsRowWithToggle- name="text-imported-as-text" label={t("import.textImportedAsText")}- currentValue={textImportedAsText} onChange={setTextImportedAsText}- />- <OptionsRowWithToggle- name="code-imported-as-code" label={<RawHtml html={t("import.codeImportedAsCode")} />}- currentValue={codeImportedAsCode} onChange={setCodeImportedAsCode}- />- <OptionsRowWithToggle- name="spreadsheet-imported-as-spreadsheet" label={t("import.spreadsheetImportedAsSpreadsheet")}- currentValue={spreadsheetImportedAsSpreadsheet} onChange={setSpreadsheetImportedAsSpreadsheet}- />- <OptionsRowWithToggle- name="replace-underscores-with-spaces" label={t("import.replaceUnderscoresWithSpaces")}- currentValue={replaceUnderscoresWithSpaces} onChange={setReplaceUnderscoresWithSpaces}- />+ <Card>+ <CardSection className="import-options-toggle" highlightOnHover onAction={() => setOptionsShown((shown) => !shown)}>+ <span className={`bx ${optionsShown ? "bx-chevron-down" : "bx-chevron-right"}`} />+ <span>{t("import.options")}</span></CardSection>+ {optionsShown && (+ <CardSection>+ <OptionsRowWithToggle+ name="safe-import" label={t("import.safeImport")} description={<RawHtml html={t("import.safeImportTooltip")} />}+ currentValue={safeImport} onChange={setSafeImport}+ />+ <OptionsRowWithToggle+ name="explode-archives" label={<RawHtml html={t("import.explodeArchives")} />} description={<RawHtml html={t("import.explodeArchivesTooltip")} />}+ currentValue={explodeArchives} onChange={setExplodeArchives}+ />+ <OptionsRowWithToggle+ name="shrink-images" label={t("import.shrinkImages")} description={<RawHtml html={t("import.shrinkImagesTooltip")} />}+ currentValue={compressImages && shrinkImages} onChange={setShrinkImages} disabled={!compressImages}+ />+ <OptionsRowWithToggle+ name="text-imported-as-text" label={t("import.textImportedAsText")}+ currentValue={textImportedAsText} onChange={setTextImportedAsText}+ />+ <OptionsRowWithToggle+ name="code-imported-as-code" label={<RawHtml html={t("import.codeImportedAsCode")} />}+ currentValue={codeImportedAsCode} onChange={setCodeImportedAsCode}+ />+ <OptionsRowWithToggle+ name="spreadsheet-imported-as-spreadsheet" label={t("import.spreadsheetImportedAsSpreadsheet")}+ currentValue={spreadsheetImportedAsSpreadsheet} onChange={setSpreadsheetImportedAsSpreadsheet}+ />+ <OptionsRowWithToggle+ name="replace-underscores-with-spaces" label={t("import.replaceUnderscoresWithSpaces")}+ currentValue={replaceUnderscoresWithSpaces} onChange={setReplaceUnderscoresWithSpaces}+ />+ </CardSection>+ )}</Card></>);diff --git a/apps/client/src/widgets/dialogs/import/import_dialog.css b/apps/client/src/widgets/dialogs/import/import_dialog.cssindex af500bc8a9..262e755f49 100644--- a/apps/client/src/widgets/dialogs/import/import_dialog.css+++ b/apps/client/src/widgets/dialogs/import/import_dialog.css@@ -29,6 +29,15 @@color: var(--muted-text-color);}+ /* Collapsed-by-default options: the section header toggles the option rows below. */+ .import-options-toggle {+ display: flex;+ align-items: center;+ gap: 0.5em;+ cursor: pointer;+ font-weight: 600;+ }+/* Some option descriptions carry rich HTML (e.g. multi-paragraph hints); keep them tight. */.option-row-description p {margin: 0;