2025-12-14 20:34:55 +02:00
|
|
|
import "./NoteTitleActions.css";
|
|
|
|
|
|
|
|
|
|
import FNote from "../../entities/fnote";
|
|
|
|
|
import { t } from "../../services/i18n";
|
2025-12-13 11:46:42 +02:00
|
|
|
import CollectionProperties from "../note_bars/CollectionProperties";
|
2025-12-14 20:34:55 +02:00
|
|
|
import Collapsible from "../react/Collapsible";
|
2025-12-13 11:46:42 +02:00
|
|
|
import { useNoteContext, useNoteProperty } from "../react/hooks";
|
2025-12-14 20:34:55 +02:00
|
|
|
import SearchDefinitionTab from "../ribbon/SearchDefinitionTab";
|
2025-12-09 22:22:28 +02:00
|
|
|
|
2025-12-13 11:46:42 +02:00
|
|
|
export default function NoteTitleActions() {
|
2025-12-14 20:34:55 +02:00
|
|
|
const { note, ntxId } = useNoteContext();
|
2025-12-12 20:21:55 +02:00
|
|
|
const isHiddenNote = note && note.noteId !== "_search" && note.noteId.startsWith("_");
|
2025-12-11 18:53:48 +02:00
|
|
|
const noteType = useNoteProperty(note, "type");
|
2025-12-09 22:22:28 +02:00
|
|
|
|
2025-12-11 18:53:48 +02:00
|
|
|
return (
|
2025-12-13 11:46:42 +02:00
|
|
|
<div className="title-actions">
|
2025-12-14 20:34:55 +02:00
|
|
|
{note && noteType === "search" && <SearchProperties note={note} ntxId={ntxId} />}
|
2025-12-12 20:21:55 +02:00
|
|
|
{note && !isHiddenNote && noteType === "book" && <CollectionProperties note={note} />}
|
2025-12-09 22:22:28 +02:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
2025-12-14 20:34:55 +02:00
|
|
|
|
|
|
|
|
function SearchProperties({ note, ntxId }: { note: FNote, ntxId: string | null | undefined }) {
|
2025-12-14 21:29:10 +02:00
|
|
|
return (note &&
|
2025-12-14 20:34:55 +02:00
|
|
|
<Collapsible
|
|
|
|
|
title={t("search_definition.search_parameters")}
|
2025-12-14 21:29:10 +02:00
|
|
|
initiallyExpanded={note.isInHiddenSubtree()} // not saved searches
|
2025-12-14 20:34:55 +02:00
|
|
|
>
|
|
|
|
|
<SearchDefinitionTab note={note} ntxId={ntxId} hidden={false} />
|
|
|
|
|
</Collapsible>
|
|
|
|
|
);
|
|
|
|
|
}
|