chore(client/ts): port services/note_types

This commit is contained in:
Elian Doran 2024-12-19 22:29:03 +02:00
parent f7dc9ea8e4
commit 4505564f13
No known key found for this signature in database

View File

@ -2,8 +2,18 @@ import server from "./server.js";
import froca from "./froca.js"; import froca from "./froca.js";
import { t } from "./i18n.js"; import { t } from "./i18n.js";
async function getNoteTypeItems(command) { type NoteTypeItem = {
const items = [ title: string;
command: string;
type: string;
uiIcon: string;
templateNoteId?: string;
} | {
title: "----"
};
async function getNoteTypeItems(command: string) {
const items: NoteTypeItem[] = [
{ title: t("note_types.text"), command: command, type: "text", uiIcon: "bx bx-note" }, { title: t("note_types.text"), command: command, type: "text", uiIcon: "bx bx-note" },
{ title: t("note_types.code"), command: command, type: "code", uiIcon: "bx bx-code" }, { title: t("note_types.code"), command: command, type: "code", uiIcon: "bx bx-code" },
{ title: t("note_types.saved-search"), command: command, type: "search", uiIcon: "bx bx-file-find" }, { title: t("note_types.saved-search"), command: command, type: "search", uiIcon: "bx bx-file-find" },
@ -17,7 +27,7 @@ async function getNoteTypeItems(command) {
{ title: t("note_types.mind-map"), command, type: "mindMap", uiIcon: "bx bx-sitemap" } { title: t("note_types.mind-map"), command, type: "mindMap", uiIcon: "bx bx-sitemap" }
]; ];
const templateNoteIds = await server.get("search-templates"); const templateNoteIds = await server.get<string[]>("search-templates");
const templateNotes = await froca.getNotes(templateNoteIds); const templateNotes = await froca.getNotes(templateNoteIds);
if (templateNotes.length > 0) { if (templateNotes.length > 0) {