diff --git a/frontend/src/components/QuickAdd.vue b/frontend/src/components/QuickAdd.vue index 982fda1..1d0f8ce 100644 --- a/frontend/src/components/QuickAdd.vue +++ b/frontend/src/components/QuickAdd.vue @@ -2,6 +2,7 @@ import { onBeforeUnmount, onMounted, nextTick, ref } from "vue"; import { useNotesStore } from "../stores/notes"; import ColorPicker from "./ColorPicker.vue"; +import Icon from "./Icon.vue"; import type { NoteColor } from "../notes/colors"; const props = withDefaults(defineProps<{ autofocus?: boolean }>(), { autofocus: false }); @@ -13,9 +14,17 @@ const saving = ref(false); const title = ref(""); const body = ref(""); const color = ref("default"); +// 'text' = freeform note; 'list' = checklist (each body line becomes an item). +const mode = ref<"text" | "list">("text"); const root = ref(null); const bodyInput = ref(null); +function toggleMode() { + mode.value = mode.value === "list" ? "text" : "list"; + bodyInput.value?.focus(); + void nextTick(autoGrow); +} + async function open() { expanded.value = true; await nextTick(); @@ -45,7 +54,16 @@ async function persist(): Promise { if (!hasContent()) return; saving.value = true; try { - await notes.create({ title: title.value, body: body.value, color: color.value }); + if (mode.value === "list") { + // Each non-empty body line becomes a checklist item. + const items = body.value + .split("\n") + .map((l) => l.trim()) + .filter(Boolean); + await notes.create({ title: title.value, body: "", color: color.value, kind: "list", items }); + } else { + await notes.create({ title: title.value, body: body.value, color: color.value }); + } } finally { saving.value = false; } @@ -56,6 +74,7 @@ async function commit() { await persist(); clearFields(); expanded.value = false; + mode.value = "text"; // next capture starts as a plain note } // Shift+Enter: save the current note and immediately start a fresh one, staying @@ -102,7 +121,7 @@ defineExpose({ open });
- +
+ + +