diff --git a/apps/client/src/widgets/ribbon/Ribbon.tsx b/apps/client/src/widgets/ribbon/Ribbon.tsx index 6473ab278..7d0bc777b 100644 --- a/apps/client/src/widgets/ribbon/Ribbon.tsx +++ b/apps/client/src/widgets/ribbon/Ribbon.tsx @@ -22,6 +22,7 @@ import NoteMapTab from "./NoteMapTab"; import OwnedAttributesTab from "./OwnedAttributesTab"; import InheritedAttributesTab from "./InheritedAttributesTab"; import CollectionPropertiesTab from "./CollectionPropertiesTab"; +import SearchDefinitionTab from "./SearchDefinitionTab"; interface TitleContext { note: FNote | null | undefined; @@ -60,9 +61,11 @@ const TAB_CONFIGURATION = numberObjectsInPlace([ (note.hasLabel("executeDescription") || note.hasLabel("executeButton")) }, { - // SearchDefinitionWidget title: t("search_definition.search_parameters"), - icon: "bx bx-search" + icon: "bx bx-search", + content: SearchDefinitionTab, + activate: true, + show: ({ note }) => note?.type === "search" }, { title: t("edited_notes.title"), diff --git a/apps/client/src/widgets/ribbon/SearchDefinitionTab.tsx b/apps/client/src/widgets/ribbon/SearchDefinitionTab.tsx new file mode 100644 index 000000000..074ac3560 --- /dev/null +++ b/apps/client/src/widgets/ribbon/SearchDefinitionTab.tsx @@ -0,0 +1,80 @@ +import { t } from "../../services/i18n"; +import Button from "../react/Button"; +import { TabContext } from "./ribbon-interface"; + +interface SearchOption { + searchOption: string; + icon: string; + label: string; + tooltip?: string; +} + +const SEARCH_OPTIONS: SearchOption[] = [ + { + searchOption: "searchString", + icon: "bx bx-text", + label: t("search_definition.search_string") + }, + { + searchOption: "searchScript", + icon: "bx bx-code", + label: t("search_definition.search_script") + }, + { + searchOption: "ancestor", + icon: "bx bx-filter-alt", + label: t("search_definition.ancestor") + }, + { + searchOption: "fastSearch", + icon: "bx bx-run", + label: t("search_definition.fast_search"), + tooltip: t("search_definition.fast_search_description") + }, + { + searchOption: "includeArchivedNotes", + icon: "bx bx-archive", + label: t("search_definition.include_archived"), + tooltip: t("search_definition.include_archived_notes_description") + }, + { + searchOption: "orderBy", + icon: "bx bx-arrow-from-top", + label: t("search_definition.order_by") + }, + { + searchOption: "limit", + icon: "bx bx-stop", + label: t("search_definition.limit"), + tooltip: t("search_definition.limit_description") + }, + { + searchOption: "debug", + icon: "bx bx-bug", + label: t("search_definition.debug"), + tooltip: t("search_definition.debug_description") + } +]; + +export default function SearchDefinitionTab({ note }: TabContext) { + return ( +
+
+ + + + + +
{t("search_definition.add_search_option")} + {SEARCH_OPTIONS.map(({ icon, label, tooltip }) => ( +
+
+
+ ) +} \ No newline at end of file diff --git a/apps/client/src/widgets/ribbon/style.css b/apps/client/src/widgets/ribbon/style.css index ef568a514..81ad0e626 100644 --- a/apps/client/src/widgets/ribbon/style.css +++ b/apps/client/src/widgets/ribbon/style.css @@ -387,4 +387,56 @@ text-overflow: clip; white-space: nowrap; } +/* #endregion */ + +/* #region Search definition */ +.search-setting-table { + margin-top: 0; + margin-bottom: 7px; + width: 100%; + border-collapse: separate; + border-spacing: 10px; +} + +.search-setting-table div { + white-space: nowrap; +} + +.search-setting-table .button-column { + /* minimal width so that table remains static sized and most space remains for middle column with settings */ + width: 50px; + white-space: nowrap; + text-align: right; +} + +.search-setting-table .title-column { + /* minimal width so that table remains static sized and most space remains for middle column with settings */ + width: 50px; + white-space: nowrap; +} + +.search-setting-table .button-column .dropdown-menu { + white-space: normal; +} + +.attribute-list hr { + height: 1px; + border-color: var(--main-border-color); + position: relative; + top: 4px; + margin-top: 5px; + margin-bottom: 0; +} + +.search-definition-widget input:invalid { + border: 3px solid red; +} + +.add-search-option button { + margin: 3px; +} + +.dropdown-header { + background-color: var(--accented-background-color); +} /* #endregion */ \ No newline at end of file diff --git a/apps/client/src/widgets/ribbon_widgets/search_definition.ts b/apps/client/src/widgets/ribbon_widgets/search_definition.ts index de459a762..073cf31da 100644 --- a/apps/client/src/widgets/ribbon_widgets/search_definition.ts +++ b/apps/client/src/widgets/ribbon_widgets/search_definition.ts @@ -22,106 +22,10 @@ import type { AttributeType } from "../../entities/fattribute.js"; import { renderReactWidget } from "../react/react_utils.jsx"; const TPL = /*html*/` -
- - -
- +
+
- -
${t("search_definition.add_search_option")} - - - - - - - - - - - - - - - - +