import { Link } from "react-router-dom"; import { Clock, Calendar, Briefcase, TrendingUp } from "lucide-react"; import { useTimeEntries } from "@/hooks/useTimeEntries"; import { ProjectColorDot } from "@/components/ProjectColorDot"; import { StatCard } from "@/components/StatCard"; import { formatDate, formatDurationFromDates, formatDurationHoursMinutes, calculateDuration, } from "@/utils/dateUtils"; import { startOfDay, endOfDay } from "date-fns"; export function DashboardPage() { const today = new Date(); const { data: todayEntries } = useTimeEntries({ startDate: startOfDay(today).toISOString(), endDate: endOfDay(today).toISOString(), limit: 5, }); const { data: recentEntries } = useTimeEntries({ limit: 10, }); const totalTodaySeconds = todayEntries?.entries.reduce((total, entry) => { return total + calculateDuration(entry.startTime, entry.endTime); }, 0) || 0; return (
{/* Page Header */}

Dashboard

Overview of your time tracking activity

{/* Stats Grid */}
e.projectId), ).size.toString() || "0" } color="purple" />
{/* Recent Activity */}

Recent Activity

View all →
{recentEntries?.entries.length === 0 ? (

No time entries yet. Start tracking time using the timer below.

) : (
{recentEntries?.entries.slice(0, 5).map((entry) => ( ))}
Project Date Duration
{entry.project.name}
{entry.project.client.name}
{formatDate(entry.startTime)} {formatDurationFromDates(entry.startTime, entry.endTime)}
)}
); }