import { DashboardLayout } from "@/components/layout/sidebar";
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { Separator } from "@/components/ui/separator";
import {
CheckCircle2,
Circle,
Clock,
AlertCircle,
TrendingUp,
ExternalLink,
ArrowRight,
Calendar,
AlertTriangle,
User,
Layers,
} from "lucide-react";
import Link from "next/link";
import {
fetchRecentlyUpdatedTasks,
fetchRecentlyCompletedTasks,
fetchHighPriorityOpenTasks,
getTaskStatusCounts,
countHighPriorityTasks,
countOverdueTasks,
Task,
} from "@/lib/data/tasks";
// Force dynamic rendering to fetch fresh data from Supabase on each request
export const dynamic = "force-dynamic";
// Helper functions
function formatRelativeTime(dateString: string): string {
const date = new Date(dateString);
const now = new Date();
const diffMs = now.getTime() - date.getTime();
const diffMins = Math.floor(diffMs / (1000 * 60));
const diffHours = Math.floor(diffMs / (1000 * 60 * 60));
const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24));
if (diffMins < 60) return `${diffMins}m ago`;
if (diffHours < 24) return `${diffHours}h ago`;
if (diffDays < 7) return `${diffDays}d ago`;
return date.toLocaleDateString("en-US", { month: "short", day: "numeric" });
}
function getPriorityColor(priority: string): string {
switch (priority) {
case "urgent":
return "bg-red-500/15 text-red-400 border-red-500/30";
case "high":
return "bg-orange-500/15 text-orange-400 border-orange-500/30";
case "medium":
return "bg-yellow-500/15 text-yellow-400 border-yellow-500/30";
default:
return "bg-blue-500/15 text-blue-400 border-blue-500/30";
}
}
function getStatusIcon(status: string) {
switch (status) {
case "done":
return
{task.title}
{title}
{value}
{subtitle &&{subtitle}
}
Mission Control view of all tasks. Manage work in{" "}
gantt-board
No recently updated tasks
)}No recently completed tasks
)}No high priority open tasks
)}Task Management
Mission Control is read-only. All task creation and editing happens in gantt-board.