+
diff --git a/src/components/QuickEntryForm.tsx b/src/components/QuickEntryForm.tsx
index e881fa3..9c9eed3 100644
--- a/src/components/QuickEntryForm.tsx
+++ b/src/components/QuickEntryForm.tsx
@@ -1,6 +1,6 @@
import { type Component, createSignal, createEffect, onMount, For, Show, Suspense, lazy } from "solid-js";
-import { addTask, calculateDateFromUrgency, calculateUrgencyFromDate, store, upsertTagDefinition, type TaskTemplate } from "@/store";
-import { Search, Command, Clock, ArrowUpCircle, Copy, ChevronDown, Gauge } from "lucide-solid";
+import { addTask, calculateDateFromUrgency, calculateUrgencyFromDate, store, upsertTagDefinition, type TaskTemplate, currentTaskContext } from "@/store";
+import { Search, Command, Clock, ArrowUpCircle, Copy, ChevronDown, Gauge, RotateCcw } from "lucide-solid";
import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
import { TextField, TextFieldInput } from "@/components/ui/textfield";
@@ -21,19 +21,32 @@ interface QuickEntryFormProps {
initialTags?: string[];
}
+// Global state for QuickEntry persistence
+const [input, setInput] = createSignal("");
+const [priority, setPriority] = createSignal
("");
+const [urgency, setUrgency] = createSignal("");
+const [tags, setTags] = createSignal([]);
+const [description, setDescription] = createSignal("");
+const [size, setSize] = createSignal("3");
+const [dateString, setDateString] = createSignal("");
+
+let lastParsedTags: string[] = [];
+
+const resetQuickEntryState = () => {
+ setInput("");
+ setPriority("");
+ setUrgency("");
+ setTags([]);
+ setDescription("");
+ setSize("3");
+ setDateString("");
+ lastParsedTags = [];
+};
+
export const QuickEntryForm: Component = (props) => {
const { resolvedTheme } = useTheme();
- // Diff tracking for reactive tags
- let lastParsedTags: string[] = [];
- const [input, setInput] = createSignal(props.initialTitle || "");
- const [priority, setPriority] = createSignal("");
- const [urgency, setUrgency] = createSignal("");
- const [tags, setTags] = createSignal(props.initialTags || []);
- const [description, setDescription] = createSignal("");
const [editorInstance, setEditorInstance] = createSignal(null);
- const [size, setSize] = createSignal("3");
- const [dateString, setDateString] = createSignal("");
let inputRef: HTMLInputElement | undefined;
@@ -41,6 +54,9 @@ export const QuickEntryForm: Component = (props) => {
if (props.autoFocus) {
setTimeout(() => inputRef?.focus(), 100);
}
+ if (props.initialTitle && !input()) {
+ setInput(props.initialTitle);
+ }
});
// Reactive sync from props (handles context changes while open)
@@ -187,6 +203,33 @@ export const QuickEntryForm: Component = (props) => {
finalDueDate = new Date(dateStr);
}
+ // Apply context tags at the time of creation
+ const ctx = currentTaskContext();
+ if (store.isNotepadMode) {
+ const activeNoteId = (window as any)._activeNoteId;
+ if (activeNoteId) {
+ const note = store.notes.find(n => n.id === activeNoteId);
+ if (note && note.title) {
+ const noteTagName = note.title.trim();
+ if (noteTagName && !finalTags.includes(noteTagName)) finalTags.push(noteTagName);
+ }
+ }
+ } else if (typeof ctx === 'object') {
+ if ('bucketId' in ctx) {
+ const bucketName = ctx.name;
+ if (bucketName) {
+ const tag = `@${bucketName}`;
+ if (!finalTags.includes(tag)) finalTags.push(tag);
+ }
+ } else if ('userId' in ctx) {
+ const userName = ctx.name;
+ if (userName) {
+ const tag = `@${userName}`;
+ if (!finalTags.includes(tag)) finalTags.push(tag);
+ }
+ }
+ }
+
addTask(title.replace(/\s+/g, " ").trim(), {
priority: finalPriority,
dueDate: finalDueDate || undefined,
@@ -195,14 +238,7 @@ export const QuickEntryForm: Component = (props) => {
size: parseInt(size())
});
- setInput("");
- setPriority("");
- setUrgency("");
- setTags([]);
- setDescription("");
- setSize("3");
- lastParsedTags = [];
- setDateString("");
+ resetQuickEntryState();
const instance = editorInstance();
if (instance) instance.commands.setContent("");
@@ -420,6 +456,18 @@ export const QuickEntryForm: Component = (props) => {