diff --git a/src/components/TaskCard.tsx b/src/components/TaskCard.tsx
index 3a397fc..018b5d3 100644
--- a/src/components/TaskCard.tsx
+++ b/src/components/TaskCard.tsx
@@ -1,12 +1,12 @@
import { type Component, createMemo, For, Show } from "solid-js";
-import { type Task, calculateUrgencyFromDate, setActiveTaskId, store, copyTask, updateTask, currentTaskContext } from "@/store";
+import { type Task, calculateUrgencyFromDate, setActiveTaskId, store, copyTask, updateTask, currentTaskContext, now } from "@/store";
import { cn } from "@/lib/utils";
import { Clock, ArrowUpCircle, Copy, Users2 } from "lucide-solid";
import { Badge } from "@/components/ui/badge";
import { useTheme } from "./ThemeProvider";
import { getThemeAdjustedColor } from "@/lib/colors";
import { Select, SelectContent, SelectItem, SelectTrigger } from "@/components/ui/select";
-import { STATUS_OPTIONS } from "@/lib/constants";
+import { getStatusOptionsForTask } from "@/lib/constants";
import { StatusCircle } from "./StatusCircle";
export const TaskCard: Component<{ task: Task }> = (props) => {
@@ -40,17 +40,20 @@ export const TaskCard: Component<{ task: Task }> = (props) => {
return tags;
});
- const isDueToday = createMemo(() => {
+ const isDueWithin12Hours = createMemo(() => {
if (!props.task.dueDate) return false;
try {
- const todayStr = new Date().toLocaleDateString('en-CA');
- const dueStr = new Date(props.task.dueDate).toLocaleDateString('en-CA');
- return todayStr === dueStr;
+ const dueMs = new Date(props.task.dueDate).getTime();
+ const diffMs = dueMs - now();
+ const twelveHoursMs = 12 * 60 * 60 * 1000;
+ return Math.abs(diffMs) <= twelveHoursMs;
} catch {
return false;
}
});
+ const statusOptions = createMemo(() => getStatusOptionsForTask(props.task.recurrence));
+
return (
= (props) => {
onClick={() => setActiveTaskId(props.task.id)}
>
{/* Today indicator */}
-
+
{/* Status Dropdown */}
@@ -74,7 +77,7 @@ export const TaskCard: Component<{ task: Task }> = (props) => {
if (!isNaN(s)) updateTask(props.task.id, { status: s });
}
}}
- options={STATUS_OPTIONS}
+ options={statusOptions()}
optionValue="value"
optionTextValue="label"
placeholder="Status"
diff --git a/src/components/TaskDetail.tsx b/src/components/TaskDetail.tsx
index 793ea49..0a87834 100644
--- a/src/components/TaskDetail.tsx
+++ b/src/components/TaskDetail.tsx
@@ -9,7 +9,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, SIZE_OPTIONS, STATUS_OPTIONS } from "@/lib/constants";
+import { PRIORITY_OPTIONS, URGENCY_OPTIONS, SIZE_OPTIONS, getStatusOptionsForTask } from "@/lib/constants";
import { store } from "@/store";
import { cn } from "@/lib/utils";
import { toast } from "solid-sonner";
@@ -136,6 +136,8 @@ export const TaskDetail: Component = (props) => {
return tags;
});
+ const statusOptions = createMemo(() => getStatusOptionsForTask(props.task.recurrence));
+
return (
{
if (!open) {
@@ -164,7 +166,7 @@ export const TaskDetail: Component = (props) => {