diff --git a/src/components/Auth.tsx b/src/components/Auth.tsx index 41c4ea7..3cc82e1 100644 --- a/src/components/Auth.tsx +++ b/src/components/Auth.tsx @@ -39,7 +39,6 @@ export const AuthCallback = (props: { onSuccess: () => void }) => { type="email" autocomplete="email" placeholder="Email" - value={email()} onInput={(e) => setEmail(e.currentTarget.value)} class="flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50" required @@ -52,7 +51,6 @@ export const AuthCallback = (props: { onSuccess: () => void }) => { type="password" autocomplete="current-password" placeholder="Password" - value={password()} onInput={(e) => setPassword(e.currentTarget.value)} class="flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50" required diff --git a/src/components/QuickEntry.tsx b/src/components/QuickEntry.tsx index ebcff95..5d9b5ed 100644 --- a/src/components/QuickEntry.tsx +++ b/src/components/QuickEntry.tsx @@ -10,6 +10,7 @@ import { TagPicker } from "@/components/TagPicker"; import { lazy, Suspense } from "solid-js"; import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover"; import { toast } from "solid-sonner"; +import { PRIORITY_OPTIONS, URGENCY_OPTIONS } from "@/lib/constants"; const TaskEditor = lazy(() => import("./TaskEditor").then(m => ({ default: m.TaskEditor }))); @@ -19,6 +20,7 @@ export const QuickEntry: Component = () => { const [isOpen, setIsOpen] = createSignal(false); const [input, setInput] = createSignal(""); + const [priority, setPriority] = createSignal("5"); const [urgency, setUrgency] = createSignal("5"); const [tags, setTags] = createSignal([]); @@ -104,9 +106,12 @@ export const QuickEntry: Component = () => { onCleanup(() => window.removeEventListener("keydown", handleKeyDown)); // When urgency changes via dropdown, update the date - const onUrgencySimpleChange = (val: string) => { - setUrgency(val); - const level = parseInt(val); + const onUrgencySimpleChange = (val: any) => { + const value = typeof val === 'object' ? val.value : val; + if (!value) return; + + setUrgency(value); + const level = parseInt(value); if (!isNaN(level)) { const newDateIso = calculateDateFromUrgency(level); // Format for datetime-local input: YYYY-MM-DDTHH:mm @@ -118,7 +123,7 @@ export const QuickEntry: Component = () => { // When date changes via input, update urgency level const onDateInputChange = (e: Event) => { - const val = (e.target as HTMLInputElement).value; + const val = (e.currentTarget as HTMLInputElement).value; setDateString(val); if (val) { const level = calculateUrgencyFromDate(new Date(val).toISOString()); @@ -278,21 +283,28 @@ export const QuickEntry: Component = () => {
- value={urgency()} - onChange={(val) => { - if (val) onUrgencySimpleChange(val); - }} - options={["10", "9", "8", "7", "6", "5", "4", "3", "2", "1"]} + onChange={(val) => onUrgencySimpleChange(val)} + options={URGENCY_OPTIONS} + optionValue="value" + optionTextValue="label" placeholder="Urgency" itemComponent={(props) => ( - {props.item.rawValue} + {props.item.rawValue.label} )} > - -
+ +
- {urgency()} + + {URGENCY_OPTIONS.find(o => o.value === urgency())?.label || urgency()} +
diff --git a/src/components/TagPicker.tsx b/src/components/TagPicker.tsx index 3d5e2e4..51b0615 100644 --- a/src/components/TagPicker.tsx +++ b/src/components/TagPicker.tsx @@ -73,7 +73,7 @@ export const TagPicker: Component = (props) => {
- + value={props.task.priority.toString()} onChange={(val: string | null) => val && updatePriority(val)} - options={["10", "9", "8", "7", "6", "5", "4", "3", "2", "1"]} + options={PRIORITY_OPTIONS} + optionValue="value" + optionTextValue="label" placeholder="Priority" - itemComponent={(props: any) => {props.item.rawValue}} + itemComponent={(props: any) => {props.item.rawValue.label}} > - -
- - {props.task.priority} + +
+ + + {PRIORITY_OPTIONS.find(o => o.value === props.task.priority.toString())?.label || props.task.priority} +
@@ -139,17 +146,21 @@ export const TaskDetail: Component = (props) => { {/* Urgency */}
- updateTemplate(template.id, { title: e.currentTarget.value })} + value={editTitle()} + onInput={(e) => setEditTitle(e.currentTarget.value)} + onBlur={handleSaveTitle} placeholder="Default task title..." />
@@ -313,8 +323,8 @@ export const SettingsView: Component = () => { value={template.priority} onChange={(e) => updateTemplate(template.id, { priority: parseInt(e.currentTarget.value) })} > - - {(v) => } + + {(opt) => }
@@ -325,8 +335,8 @@ export const SettingsView: Component = () => { value={template.urgency} onChange={(e) => updateTemplate(template.id, { urgency: parseInt(e.currentTarget.value) })} > - - {(v) => } + + {(opt) => }
@@ -360,7 +370,13 @@ export const SettingsView: Component = () => { }> updateTemplate(template.id, { content: html })} + onUpdate={(html) => { + // For the rich editor, we can use a slightly debounced store update + // to avoid losing focus if the parent re-renders, + // although Tiptap usually handles its own state well. + // But to be safe, let's just update the store. + updateTemplate(template.id, { content: html }); + }} class="min-h-[100px]" />