upd kano-bar
This commit is contained in:
parent
fae8385e99
commit
a88b2ea93e
|
|
@ -1 +1 @@
|
||||||
1.1.58
|
1.1.59
|
||||||
|
|
@ -4,9 +4,12 @@
|
||||||
import { commandBarOpen } from "$lib/stores/commandBar";
|
import { commandBarOpen } from "$lib/stores/commandBar";
|
||||||
import { allActiveContexts } from "$lib/stores/agenda";
|
import { allActiveContexts } from "$lib/stores/agenda";
|
||||||
import { allPages } from "$lib/stores/wiki";
|
import { allPages } from "$lib/stores/wiki";
|
||||||
|
import { currentScope, scopeSettings } from "$lib/stores/scopeContext";
|
||||||
import {
|
import {
|
||||||
getOrCreateJournalTopic,
|
getOrCreateJournalTopic,
|
||||||
createHistoryEntry,
|
createHistoryEntry,
|
||||||
|
createPage,
|
||||||
|
createTopic,
|
||||||
} from "$lib/db/repositories";
|
} from "$lib/db/repositories";
|
||||||
import { today } from "$lib/db/helpers";
|
import { today } from "$lib/db/helpers";
|
||||||
|
|
||||||
|
|
@ -14,7 +17,7 @@
|
||||||
const pagesQuery = allPages();
|
const pagesQuery = allPages();
|
||||||
|
|
||||||
let query = $state("");
|
let query = $state("");
|
||||||
let inputEl: HTMLInputElement;
|
let inputEl = $state<HTMLInputElement>();
|
||||||
let selectedIndex = $state(0);
|
let selectedIndex = $state(0);
|
||||||
let recentContextIds = $state<string[]>([]);
|
let recentContextIds = $state<string[]>([]);
|
||||||
let isMac = $state(false);
|
let isMac = $state(false);
|
||||||
|
|
@ -103,12 +106,45 @@
|
||||||
type: "action",
|
type: "action",
|
||||||
icon: "📝",
|
icon: "📝",
|
||||||
label: text
|
label: text
|
||||||
? `Notiz im Daily Log: "${text}"`
|
? `Notiz (${$currentScope === "private" ? "Privat" : "Firma"}): "${text}"`
|
||||||
: "Neu: Notiz (Daily Log)",
|
: `Neu: Notiz (${$currentScope === "private" ? "Privat" : "Firma"})`,
|
||||||
badge: "BEFEHL",
|
badge: "BEFEHL",
|
||||||
action: async () => {
|
action: async () => {
|
||||||
if (!text) return;
|
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",
|
type: "action",
|
||||||
icon: "⏰",
|
icon: "⏰",
|
||||||
label: text
|
label: text
|
||||||
? `Todo (heute) im Daily Log: "${text}"`
|
? `Todo (${$currentScope === "private" ? "Privat" : "Firma"}): "${text}"`
|
||||||
: "Neu: Todo (Daily Log)",
|
: `Neu: Todo (${$currentScope === "private" ? "Privat" : "Firma"})`,
|
||||||
badge: "BEFEHL",
|
badge: "BEFEHL",
|
||||||
action: async () => {
|
action: async () => {
|
||||||
if (!text) return;
|
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();
|
const topic = await getOrCreateJournalTopic();
|
||||||
await createHistoryEntry(topic.id, today(), text, null, false, false);
|
await createHistoryEntry(
|
||||||
|
topic.id,
|
||||||
|
today(),
|
||||||
|
text,
|
||||||
|
null,
|
||||||
|
false,
|
||||||
|
isPrivate,
|
||||||
|
);
|
||||||
closeBar();
|
closeBar();
|
||||||
if (window.location.pathname === "/context/daily-log") {
|
if (window.location.pathname === "/context/daily-log") {
|
||||||
// Trigger a reload or just let dexie liveQuery handle it
|
// 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();
|
const topic = await getOrCreateJournalTopic();
|
||||||
await createHistoryEntry(topic.id, today(), text, null, true, false);
|
await createHistoryEntry(
|
||||||
|
topic.id,
|
||||||
|
today(),
|
||||||
|
text,
|
||||||
|
null,
|
||||||
|
true,
|
||||||
|
isPrivate,
|
||||||
|
);
|
||||||
closeBar();
|
closeBar();
|
||||||
if (window.location.pathname !== "/context/daily-log") {
|
if (window.location.pathname !== "/context/daily-log") {
|
||||||
goto("/context/daily-log");
|
goto("/context/daily-log");
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue