fixed urgency-date connection and added urgency-date guidance. fixed password extension break. fixed template saving.
This commit is contained in:
@@ -7,6 +7,7 @@ import { cn } from "@/lib/utils";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { toast } from "solid-sonner";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger } from "@/components/ui/select";
|
||||
import { PRIORITY_OPTIONS, URGENCY_OPTIONS } from "@/lib/constants";
|
||||
import { pb } from "@/lib/pocketbase";
|
||||
|
||||
const TaskEditor = lazy(() => import("../components/TaskEditor").then(m => ({ default: m.TaskEditor })));
|
||||
@@ -221,6 +222,8 @@ export const SettingsView: Component = () => {
|
||||
{(template) => {
|
||||
const [isEditingName, setIsEditingName] = createSignal(false);
|
||||
const [editName, setEditName] = createSignal(template.name);
|
||||
const [editTitle, setEditTitle] = createSignal(template.title);
|
||||
|
||||
const isExpanded = () => expandedTemplateId() === template.id;
|
||||
|
||||
const handleSaveName = () => {
|
||||
@@ -230,6 +233,12 @@ export const SettingsView: Component = () => {
|
||||
setIsEditingName(false);
|
||||
};
|
||||
|
||||
const handleSaveTitle = () => {
|
||||
if (editTitle() !== template.title) {
|
||||
updateTemplate(template.id, { title: editTitle() });
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div class={cn(
|
||||
"flex flex-col rounded-2xl border transition-all overflow-hidden shadow-sm",
|
||||
@@ -269,7 +278,7 @@ export const SettingsView: Component = () => {
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
class="h-8 w-8 hover:bg-primary/10 hover:text-primary rounded-xl"
|
||||
onClick={(e) => {
|
||||
onClick={(e: MouseEvent) => {
|
||||
e.stopPropagation();
|
||||
setIsEditingName(true);
|
||||
}}
|
||||
@@ -280,7 +289,7 @@ export const SettingsView: Component = () => {
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
class="h-8 w-8 hover:bg-red-500/10 hover:text-red-600 rounded-xl"
|
||||
onClick={(e) => {
|
||||
onClick={(e: MouseEvent) => {
|
||||
e.stopPropagation();
|
||||
if (confirm(`Delete template "${template.name}"?`)) {
|
||||
removeTemplate(template.id);
|
||||
@@ -300,8 +309,9 @@ export const SettingsView: Component = () => {
|
||||
<label class="text-[10px] font-bold uppercase tracking-wider text-muted-foreground ml-1">Title Placeholder</label>
|
||||
<input
|
||||
class="flex h-9 w-full rounded-lg border border-input bg-background px-3 py-1 text-sm shadow-sm focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring"
|
||||
value={template.title}
|
||||
onInput={(e) => updateTemplate(template.id, { title: e.currentTarget.value })}
|
||||
value={editTitle()}
|
||||
onInput={(e) => setEditTitle(e.currentTarget.value)}
|
||||
onBlur={handleSaveTitle}
|
||||
placeholder="Default task title..."
|
||||
/>
|
||||
</div>
|
||||
@@ -313,8 +323,8 @@ export const SettingsView: Component = () => {
|
||||
value={template.priority}
|
||||
onChange={(e) => updateTemplate(template.id, { priority: parseInt(e.currentTarget.value) })}
|
||||
>
|
||||
<For each={["10", "9", "8", "7", "6", "5", "4", "3", "2", "1"]}>
|
||||
{(v) => <option value={v}>{v}</option>}
|
||||
<For each={PRIORITY_OPTIONS}>
|
||||
{(opt) => <option value={opt.value}>{opt.label}</option>}
|
||||
</For>
|
||||
</select>
|
||||
</div>
|
||||
@@ -325,8 +335,8 @@ export const SettingsView: Component = () => {
|
||||
value={template.urgency}
|
||||
onChange={(e) => updateTemplate(template.id, { urgency: parseInt(e.currentTarget.value) })}
|
||||
>
|
||||
<For each={["10", "9", "8", "7", "6", "5", "4", "3", "2", "1"]}>
|
||||
{(v) => <option value={v}>{v}</option>}
|
||||
<For each={URGENCY_OPTIONS}>
|
||||
{(opt) => <option value={opt.value}>{opt.label}</option>}
|
||||
</For>
|
||||
</select>
|
||||
</div>
|
||||
@@ -360,7 +370,13 @@ export const SettingsView: Component = () => {
|
||||
<Suspense fallback={<div class="h-20 animate-pulse bg-muted/20 rounded-lg" />}>
|
||||
<TaskEditor
|
||||
content={template.content}
|
||||
onUpdate={(html) => 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]"
|
||||
/>
|
||||
</Suspense>
|
||||
|
||||
Reference in New Issue
Block a user