Skip to content

Build your personal knowledge base with Trilium Notes

feat(layout): integrate search parameters ribbon tab

Elian Doran6b9b9a96c306
diff --git a/apps/client/src/widgets/layout/NoteTitleActions.css b/apps/client/src/widgets/layout/NoteTitleActions.css
index 52aea7a90c..a189480c87 100644
--- a/apps/client/src/widgets/layout/NoteTitleActions.css
+++ b/apps/client/src/widgets/layout/NoteTitleActions.css
@@ -14,6 +14,10 @@ body.experimental-feature-new-layout {
padding-bottom: 0.2em;
font-size: 0.8em;
+ .collapsible-title {
+ font-size: 1rem;
+ }
+
.dropdown-menu {
input.form-control {
padding: 2px 8px;
diff --git a/apps/client/src/widgets/layout/NoteTitleActions.tsx b/apps/client/src/widgets/layout/NoteTitleActions.tsx
index 765eefca10..6325e9a31c 100644
--- a/apps/client/src/widgets/layout/NoteTitleActions.tsx
+++ b/apps/client/src/widgets/layout/NoteTitleActions.tsx
@@ -1,15 +1,31 @@
+import "./NoteTitleActions.css";
+
+import FNote from "../../entities/fnote";
+import { t } from "../../services/i18n";
import CollectionProperties from "../note_bars/CollectionProperties";
+import Collapsible from "../react/Collapsible";
import { useNoteContext, useNoteProperty } from "../react/hooks";
-import "./NoteTitleActions.css";
+import SearchDefinitionTab from "../ribbon/SearchDefinitionTab";
export default function NoteTitleActions() {
- const { note } = useNoteContext();
+ const { note, ntxId } = useNoteContext();
const isHiddenNote = note && note.noteId !== "_search" && note.noteId.startsWith("_");
const noteType = useNoteProperty(note, "type");
return (
<div className="title-actions">
+ {note && noteType === "search" && <SearchProperties note={note} ntxId={ntxId} />}
{note && !isHiddenNote && noteType === "book" && <CollectionProperties note={note} />}
</div>
);
}
+
+function SearchProperties({ note, ntxId }: { note: FNote, ntxId: string | null | undefined }) {
+ return (
+ <Collapsible
+ title={t("search_definition.search_parameters")}
+ >
+ <SearchDefinitionTab note={note} ntxId={ntxId} hidden={false} />
+ </Collapsible>
+ );
+}
diff --git a/apps/client/src/widgets/ribbon/RibbonDefinition.ts b/apps/client/src/widgets/ribbon/RibbonDefinition.ts
index 178b022d3d..59920e017b 100644
--- a/apps/client/src/widgets/ribbon/RibbonDefinition.ts
+++ b/apps/client/src/widgets/ribbon/RibbonDefinition.ts
@@ -47,7 +47,7 @@ export const RIBBON_TAB_DEFINITIONS: TabConfiguration[] = [
icon: "bx bx-search",
content: SearchDefinitionTab,
activate: true,
- show: ({ note }) => note?.type === "search"
+ show: ({ note }) => !isNewLayout && 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
index bf285caef5..273adbfef7 100644
--- a/apps/client/src/widgets/ribbon/SearchDefinitionTab.tsx
+++ b/apps/client/src/widgets/ribbon/SearchDefinitionTab.tsx
@@ -24,7 +24,7 @@ import { ParentComponent } from "../react/react_utils";
import { TabContext } from "./ribbon-interface";
import { SEARCH_OPTIONS, SearchOption } from "./SearchDefinitionOptions";
-export default function SearchDefinitionTab({ note, ntxId, hidden }: TabContext) {
+export default function SearchDefinitionTab({ note, ntxId, hidden }: Pick<TabContext, "note" | "ntxId" | "hidden">) {
const parentComponent = useContext(ParentComponent);
const [ searchOptions, setSearchOptions ] = useState<{ availableOptions: SearchOption[], activeOptions: SearchOption[] }>();
const [ error, setError ] = useState<{ message: string }>();