Skip to content

Build your personal knowledge base with Trilium Notes

Merge remote-tracking branch 'origin/main' into feature/mobile_improvements_v2

Elian Dorane1cec3404ab1
diff --cc apps/client/src/widgets/mobile_widgets/mobile_detail_menu.tsx
index 06c6f8e11c,358a61ffc3..f35137b77a
--- a/apps/client/src/widgets/mobile_widgets/mobile_detail_menu.tsx
+++ b/apps/client/src/widgets/mobile_widgets/mobile_detail_menu.tsx
@@@ -1,6 -1,5 +1,7 @@@
+import "./mobile_detail_menu.css";
+
- import { createPortal, useState } from "preact/compat";
+ import { Dropdown as BootstrapDropdown } from "bootstrap";
+ import { createPortal, useRef, useState } from "preact/compat";
import FNote, { NotePathRecord } from "../../entities/fnote";
import { t } from "../../services/i18n";
@@@ -16,10 -12,9 +17,11 @@@ import { NoteTypeCodeNoteList, useLangu
import { NoteContextMenu } from "../ribbon/NoteActions";
import NoteActionsCustom from "../ribbon/NoteActionsCustom";
import { NotePathsWidget, useSortedNotePaths } from "../ribbon/NotePathsTab";
+import SimilarNotesTab from "../ribbon/SimilarNotesTab";
+import { useProcessedLocales } from "../type_widgets/options/components/LocaleSelector";
export default function MobileDetailMenu() {
+ const dropdownRef = useRef<BootstrapDropdown | null>(null);
const { note, noteContext, parentComponent, ntxId, viewScope, hoistedNoteId } = useNoteContext();
const subContexts = noteContext?.getMainContext().getSubContexts() ?? [];
const isMainContext = noteContext?.isMainContext();
@@@ -174,58 -134,3 +182,57 @@@ function NotePathsModal({ note, modalSh
</Modal>
);
}
+
+function NoteInfoModal({ note, modalShown, setModalShown }: { note: FNote | null | undefined } & WithModal) {
+ return (
+ <Modal
+ className="note-info-modal"
+ size="md"
+ title={t("note_info_widget.title")}
+ show={modalShown}
+ onHidden={() => setModalShown(false)}
+ >
+ {note && <NoteInfoContent note={note} noteType={note.type} />}
+ </Modal>
+ );
+}
+
+function SimilarNotesModal({ note, modalShown, setModalShown }: { note: FNote | null | undefined } & WithModal) {
+ return (
+ <Modal
+ className="similar-notes-modal"
+ size="md"
+ title={t("similar_notes.title")}
+ show={modalShown}
+ onHidden={() => setModalShown(false)}
+ >
+ <SimilarNotesTab note={note} />
+ </Modal>
+ );
+}
+
+function CodeNoteSwitcherModal({ note, modalShown, setModalShown }: { note: FNote | null | undefined } & WithModal) {
+ const currentNoteMime = useNoteProperty(note, "mime");
+ const mimeTypes = useMimeTypes();
+
+ return (
+ <Modal
+ className="code-note-switcher-modal"
+ size="md"
+ title={t("status_bar.code_note_switcher")}
+ show={modalShown}
+ onHidden={() => setModalShown(false)}
+ >
+ <div className="dropdown-menu static show">
+ {note && <NoteTypeCodeNoteList
+ currentMimeType={currentNoteMime}
+ mimeTypes={mimeTypes}
+ changeNoteType={(type, mime) => {
+ server.put(`notes/${note.noteId}/type`, { type, mime });
+ setModalShown(false);
+ }}
- // setModalShown={() => setModalShown(true)}
+ />}
+ </div>
+ </Modal>
+ );
+}