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 { calculateDateFromUrgency, calculateUrgencyFromDate } from "@/store";
|
||||
import { Button } from "./ui/button";
|
||||
import { TagPicker } from "./TagPicker";
|
||||
import { Badge } from "./ui/badge";
|
||||
import { PRIORITY_OPTIONS, URGENCY_OPTIONS } from "@/lib/constants";
|
||||
import { store } from "@/store";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { toast } from "solid-sonner";
|
||||
@@ -49,15 +50,17 @@ export const TaskDetail: Component<TaskDetailProps> = (props) => {
|
||||
updateTask(props.task.id, { title: val });
|
||||
};
|
||||
|
||||
const updatePriority = (val: string) => {
|
||||
const p = parseInt(val);
|
||||
const updatePriority = (val: any) => {
|
||||
const value = typeof val === 'object' ? val.value : val;
|
||||
const p = parseInt(value);
|
||||
if (!isNaN(p)) {
|
||||
updateTask(props.task.id, { priority: p });
|
||||
}
|
||||
};
|
||||
|
||||
const updateUrgency = (val: string) => {
|
||||
const u = parseInt(val);
|
||||
const updateUrgency = (val: any) => {
|
||||
const value = typeof val === 'object' ? val.value : val;
|
||||
const u = parseInt(value);
|
||||
if (!isNaN(u)) {
|
||||
const newDate = calculateDateFromUrgency(u);
|
||||
updateTask(props.task.id, { dueDate: newDate });
|
||||
@@ -119,17 +122,21 @@ export const TaskDetail: Component<TaskDetailProps> = (props) => {
|
||||
{/* Priority */}
|
||||
<div class="flex items-center gap-1 group shrink-0">
|
||||
<span class="text-[10px] uppercase font-bold tracking-wider text-muted-foreground/70 hidden sm:inline">Priority</span>
|
||||
<Select
|
||||
<Select<any>
|
||||
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) => <SelectItem item={props.item}>{props.item.rawValue}</SelectItem>}
|
||||
itemComponent={(props: any) => <SelectItem item={props.item}>{props.item.rawValue.label}</SelectItem>}
|
||||
>
|
||||
<SelectTrigger class="h-8 min-w-[40px] bg-transparent border-transparent hover:bg-muted/50 px-1 sm:px-2 shadow-none focus:ring-0 shrink-0">
|
||||
<div class="flex items-center gap-1 sm:gap-1.5 text-foreground font-medium">
|
||||
<ArrowUpCircle size={14} class="text-primary opacity-70 group-hover:opacity-100 transition-opacity" />
|
||||
<span class="text-xs sm:text-sm">{props.task.priority}</span>
|
||||
<SelectTrigger class="h-8 min-w-[40px] max-w-[180px] bg-transparent border-transparent hover:bg-muted/50 px-1 sm:px-2 shadow-none focus:ring-0 shrink-0 overflow-hidden">
|
||||
<div class="flex items-center gap-1 sm:gap-1.5 text-foreground font-medium truncate">
|
||||
<ArrowUpCircle size={14} class="text-primary opacity-70 group-hover:opacity-100 transition-opacity shrink-0" />
|
||||
<span class="text-xs sm:text-sm truncate">
|
||||
{PRIORITY_OPTIONS.find(o => o.value === props.task.priority.toString())?.label || props.task.priority}
|
||||
</span>
|
||||
</div>
|
||||
</SelectTrigger>
|
||||
<SelectContent />
|
||||
@@ -139,17 +146,21 @@ export const TaskDetail: Component<TaskDetailProps> = (props) => {
|
||||
{/* Urgency */}
|
||||
<div class="flex items-center gap-1 group shrink-0">
|
||||
<span class="text-[10px] uppercase font-bold tracking-wider text-muted-foreground/70 hidden sm:inline">Time</span>
|
||||
<Select
|
||||
<Select<any>
|
||||
value={currentUrgency()}
|
||||
onChange={(val: string | null) => val && updateUrgency(val)}
|
||||
options={["10", "9", "8", "7", "6", "5", "4", "3", "2", "1"]}
|
||||
options={URGENCY_OPTIONS}
|
||||
optionValue="value"
|
||||
optionTextValue="label"
|
||||
placeholder="Urgency"
|
||||
itemComponent={(props: any) => <SelectItem item={props.item}>{props.item.rawValue}</SelectItem>}
|
||||
itemComponent={(props: any) => <SelectItem item={props.item}>{props.item.rawValue.label}</SelectItem>}
|
||||
>
|
||||
<SelectTrigger class="h-8 min-w-[40px] bg-transparent border-transparent hover:bg-muted/50 px-1 sm:px-2 shadow-none focus:ring-0 shrink-0">
|
||||
<div class="flex items-center gap-1 sm:gap-1.5 text-foreground font-medium">
|
||||
<Clock size={14} class="text-primary opacity-70 group-hover:opacity-100 transition-opacity" />
|
||||
<span class="text-xs sm:text-sm">{currentUrgency()}</span>
|
||||
<SelectTrigger class="h-8 min-w-[40px] max-w-[180px] bg-transparent border-transparent hover:bg-muted/50 px-1 sm:px-2 shadow-none focus:ring-0 shrink-0 overflow-hidden">
|
||||
<div class="flex items-center gap-1 sm:gap-1.5 text-foreground font-medium truncate">
|
||||
<Clock size={14} class="text-primary opacity-70 group-hover:opacity-100 transition-opacity shrink-0" />
|
||||
<span class="text-xs sm:text-sm truncate">
|
||||
{URGENCY_OPTIONS.find(o => o.value === currentUrgency())?.label || currentUrgency()}
|
||||
</span>
|
||||
</div>
|
||||
</SelectTrigger>
|
||||
<SelectContent />
|
||||
|
||||
Reference in New Issue
Block a user