diff --git a/ka-note/VERSION b/ka-note/VERSION index 6b82d0f..109d841 100644 --- a/ka-note/VERSION +++ b/ka-note/VERSION @@ -1 +1 @@ -1.1.58 \ No newline at end of file +1.1.59 \ No newline at end of file diff --git a/ka-note/client/src/lib/components/CommandBar.svelte b/ka-note/client/src/lib/components/CommandBar.svelte index ccedd90..a995b5b 100644 --- a/ka-note/client/src/lib/components/CommandBar.svelte +++ b/ka-note/client/src/lib/components/CommandBar.svelte @@ -4,9 +4,12 @@ import { commandBarOpen } from "$lib/stores/commandBar"; import { allActiveContexts } from "$lib/stores/agenda"; import { allPages } from "$lib/stores/wiki"; + import { currentScope, scopeSettings } from "$lib/stores/scopeContext"; import { getOrCreateJournalTopic, createHistoryEntry, + createPage, + createTopic, } from "$lib/db/repositories"; import { today } from "$lib/db/helpers"; @@ -14,7 +17,7 @@ const pagesQuery = allPages(); let query = $state(""); - let inputEl: HTMLInputElement; + let inputEl = $state(); let selectedIndex = $state(0); let recentContextIds = $state([]); let isMac = $state(false); @@ -103,12 +106,45 @@ type: "action", icon: "📝", label: text - ? `Notiz im Daily Log: "${text}"` - : "Neu: Notiz (Daily Log)", + ? `Notiz (${$currentScope === "private" ? "Privat" : "Firma"}): "${text}"` + : `Neu: Notiz (${$currentScope === "private" ? "Privat" : "Firma"})`, badge: "BEFEHL", action: async () => { if (!text) return; - await executeNoteCommand(text); + const isPrivateScope = $currentScope === "private"; + await executeNoteCommand(text, isPrivateScope); + }, + }); + } + + if ("/pnote".startsWith(cmd)) { + actions.push({ + id: "cmd-pnote", + type: "action", + icon: "📝", + label: text + ? `Notiz (Privat): "${text}"` + : "Neu: Notiz (Privat)", + badge: "BEFEHL", + action: async () => { + if (!text) return; + await executeNoteCommand(text, true); + }, + }); + } + + if ("/bnote".startsWith(cmd)) { + actions.push({ + id: "cmd-bnote", + type: "action", + icon: "📝", + label: text + ? `Notiz (Firma): "${text}"` + : "Neu: Notiz (Firma)", + badge: "BEFEHL", + action: async () => { + if (!text) return; + await executeNoteCommand(text, false); }, }); } @@ -119,12 +155,218 @@ type: "action", icon: "⏰", label: text - ? `Todo (heute) im Daily Log: "${text}"` - : "Neu: Todo (Daily Log)", + ? `Todo (${$currentScope === "private" ? "Privat" : "Firma"}): "${text}"` + : `Neu: Todo (${$currentScope === "private" ? "Privat" : "Firma"})`, badge: "BEFEHL", action: async () => { if (!text) return; - await executeTodoCommand(text); + const isPrivateScope = $currentScope === "private"; + await executeTodoCommand(text, isPrivateScope); + }, + }); + } + + if ("/ptodo".startsWith(cmd)) { + actions.push({ + id: "cmd-ptodo", + type: "action", + icon: "⏰", + label: text + ? `Todo (Privat): "${text}"` + : "Neu: Todo (Privat)", + badge: "BEFEHL", + action: async () => { + if (!text) return; + await executeTodoCommand(text, true); + }, + }); + } + + if ("/btodo".startsWith(cmd)) { + actions.push({ + id: "cmd-btodo", + type: "action", + icon: "⏰", + label: text + ? `Todo (Firma): "${text}"` + : "Neu: Todo (Firma)", + badge: "BEFEHL", + action: async () => { + if (!text) return; + await executeTodoCommand(text, false); + }, + }); + } + + if ("/page".startsWith(cmd)) { + actions.push({ + id: "cmd-page", + type: "action", + icon: "📄", + label: text + ? `Wiki-Seite (${$currentScope === "private" ? "Privat" : "Firma"}): "${text}"` + : `Neu: Wiki-Seite (${$currentScope === "private" ? "Privat" : "Firma"})`, + badge: "BEFEHL", + action: async () => { + if (!text) return; + const isPrivateScope = $currentScope === "private"; + const page = await createPage(text, isPrivateScope); + closeBar(); + goto(`/wiki/${page.id}`); + }, + }); + } + + if ("/ppage".startsWith(cmd)) { + actions.push({ + id: "cmd-ppage", + type: "action", + icon: "📄", + label: text + ? `Wiki-Seite (Privat): "${text}"` + : `Neu: Wiki-Seite (Privat)`, + badge: "BEFEHL", + action: async () => { + if (!text) return; + const page = await createPage(text, true); + closeBar(); + goto(`/wiki/${page.id}`); + }, + }); + } + + if ("/bpage".startsWith(cmd)) { + actions.push({ + id: "cmd-bpage", + type: "action", + icon: "📄", + label: text + ? `Wiki-Seite (Firma): "${text}"` + : `Neu: Wiki-Seite (Firma)`, + badge: "BEFEHL", + action: async () => { + if (!text) return; + const page = await createPage(text, false); + closeBar(); + goto(`/wiki/${page.id}`); + }, + }); + } + + if ("/person".startsWith(cmd)) { + actions.push({ + id: "cmd-person", + type: "action", + icon: "👤", + label: text + ? `Person (${$currentScope === "private" ? "Privat" : "Firma"}): "${text}"` + : `Neu: Person (${$currentScope === "private" ? "Privat" : "Firma"})`, + badge: "BEFEHL", + action: async () => { + if (!text) return; + const isPrivateScope = $currentScope === "private"; + const topic = await createTopic( + text, + "person", + isPrivateScope, + ); + closeBar(); + goto(`/context/${topic.id}`); + }, + }); + } + + if ("/pperson".startsWith(cmd)) { + actions.push({ + id: "cmd-pperson", + type: "action", + icon: "👤", + label: text + ? `Person (Privat): "${text}"` + : `Neu: Person (Privat)`, + badge: "BEFEHL", + action: async () => { + if (!text) return; + const topic = await createTopic(text, "person", true); + closeBar(); + goto(`/context/${topic.id}`); + }, + }); + } + + if ("/bperson".startsWith(cmd)) { + actions.push({ + id: "cmd-bperson", + type: "action", + icon: "👤", + label: text + ? `Person (Firma): "${text}"` + : `Neu: Person (Firma)`, + badge: "BEFEHL", + action: async () => { + if (!text) return; + const topic = await createTopic(text, "person", false); + closeBar(); + goto(`/context/${topic.id}`); + }, + }); + } + + if ("/firma".startsWith(cmd)) { + actions.push({ + id: "cmd-firma", + type: "action", + icon: "🏢", + label: text + ? `Firma (${$currentScope === "private" ? "Privat" : "Firma"}): "${text}"` + : `Neu: Firma (${$currentScope === "private" ? "Privat" : "Firma"})`, + badge: "BEFEHL", + action: async () => { + if (!text) return; + const isPrivateScope = $currentScope === "private"; + const topic = await createTopic( + text, + "company", + isPrivateScope, + ); + closeBar(); + goto(`/context/${topic.id}`); + }, + }); + } + + if ("/pfirma".startsWith(cmd)) { + actions.push({ + id: "cmd-pfirma", + type: "action", + icon: "🏢", + label: text + ? `Firma (Privat): "${text}"` + : `Neu: Firma (Privat)`, + badge: "BEFEHL", + action: async () => { + if (!text) return; + const topic = await createTopic(text, "company", true); + closeBar(); + goto(`/context/${topic.id}`); + }, + }); + } + + if ("/bfirma".startsWith(cmd)) { + actions.push({ + id: "cmd-bfirma", + type: "action", + icon: "🏢", + label: text + ? `Firma (Firma): "${text}"` + : `Neu: Firma (Firma)`, + badge: "BEFEHL", + action: async () => { + if (!text) return; + const topic = await createTopic(text, "company", false); + closeBar(); + goto(`/context/${topic.id}`); }, }); } @@ -278,9 +520,16 @@ }); } - async function executeNoteCommand(text: string) { + async function executeNoteCommand(text: string, isPrivate: boolean) { const topic = await getOrCreateJournalTopic(); - await createHistoryEntry(topic.id, today(), text, null, false, false); + await createHistoryEntry( + topic.id, + today(), + text, + null, + false, + isPrivate, + ); closeBar(); if (window.location.pathname === "/context/daily-log") { // Trigger a reload or just let dexie liveQuery handle it @@ -289,9 +538,16 @@ } } - async function executeTodoCommand(text: string) { + async function executeTodoCommand(text: string, isPrivate: boolean) { const topic = await getOrCreateJournalTopic(); - await createHistoryEntry(topic.id, today(), text, null, true, false); + await createHistoryEntry( + topic.id, + today(), + text, + null, + true, + isPrivate, + ); closeBar(); if (window.location.pathname !== "/context/daily-log") { goto("/context/daily-log"); diff --git a/ka-note/server/ka-note.db-shm b/ka-note/server/ka-note.db-shm index 38aeab8..6b4cdcc 100644 Binary files a/ka-note/server/ka-note.db-shm and b/ka-note/server/ka-note.db-shm differ diff --git a/ka-note/server/ka-note.db-wal b/ka-note/server/ka-note.db-wal index 755bcd5..8105a6b 100644 Binary files a/ka-note/server/ka-note.db-wal and b/ka-note/server/ka-note.db-wal differ