diff --git a/src/pages/Index.tsx b/src/pages/Index.tsx
index 8c77fe0..376a442 100644
--- a/src/pages/Index.tsx
+++ b/src/pages/Index.tsx
@@ -1,7 +1,8 @@
-import { TimeTrackingProvider } from "@/contexts/TimeTrackingContext";
import { useTimeTracking } from "@/hooks/useTimeTracking";
import { DaySummary } from "@/components/DaySummary";
import { StartDayDialog } from "@/components/StartDayDialog";
+import { TaskItem } from "@/components/TaskItem";
+import { NewTaskForm } from "@/components/NewTaskForm";
import { Button } from "@/components/ui/button";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { CirclePlay, CircleStop, Archive as Play, ClipboardList } from "lucide-react";
@@ -9,7 +10,6 @@ import { DashboardIcon } from "@radix-ui/react-icons";
import { PageLayout } from "@/components/PageLayout";
import { TaskTrackingPanel } from "@/components/TaskTrackingPanel";
import { useState, useMemo } from "react";
-import { Link, useNavigate } from "react-router-dom";
// Stable epoch constant — avoids creating new Date(0) on every render
const EPOCH = new Date(0);
@@ -18,17 +18,21 @@ const TimeTrackerContent = () => {
const {
isDayStarted,
dayStartTime,
+ currentTask,
tasks,
archivedDays,
startDay,
endDay,
postDay,
+ deleteTask,
+ startNewTask,
getTotalDayDuration,
- getTotalHoursForPeriod
+ getTotalHoursForPeriod,
+ getCurrentTaskDuration,
} = useTimeTracking();
- const navigate = useNavigate();
const [showStartDayDialog, setShowStartDayDialog] = useState(false);
+ const [showAddTaskForm, setShowAddTaskForm] = useState(false);
const handleStartDay = () => {
setShowStartDayDialog(true);
@@ -36,7 +40,6 @@ const TimeTrackerContent = () => {
const handleStartDayWithDateTime = (startDateTime: Date) => {
startDay(startDateTime);
- navigate("/tasks");
};
const handleEndDay = () => {
@@ -47,6 +50,17 @@ const TimeTrackerContent = () => {
postDay();
};
+ const handleNewTask = (
+ title: string,
+ description?: string,
+ project?: string,
+ client?: string,
+ category?: string
+ ) => {
+ startNewTask(title, description, project, client, category);
+ setShowAddTaskForm(false);
+ };
+
const totalHours = useMemo(
() => archivedDays.length > 0 ? getTotalHoursForPeriod(EPOCH, new Date()) : 0,
[archivedDays, getTotalHoursForPeriod]
@@ -141,30 +155,48 @@ const TimeTrackerContent = () => {
<>
- Started at {dayStartTime.toLocaleTimeString()}
-
- {tasks.length === 0
- ? "No tasks tracked yet — go to Tasks to start your first task."
- : `${tasks.length} task${tasks.length === 1 ? "" : "s"} tracked today.`}
-