diff --git a/app/create-location/page.tsx b/app/location/page.tsx similarity index 99% rename from app/create-location/page.tsx rename to app/location/page.tsx index cd61819..5d9bb6d 100644 --- a/app/create-location/page.tsx +++ b/app/location/page.tsx @@ -28,7 +28,7 @@ import { } from "@/lib/api" import { toast } from "sonner" -export default function CreateLocationPage() { +export default function LocationPage() { const [locations, setLocations] = useState([]) const [projects, setProjects] = useState([]) const [packages, setPackages] = useState([]) diff --git a/app/map/page.tsx b/app/map/page.tsx deleted file mode 100644 index 740ccfa..0000000 --- a/app/map/page.tsx +++ /dev/null @@ -1,49 +0,0 @@ -"use client" - -import { NavigationMenu } from "@/components/navigation-menu" -import { DashboardMap } from "@/components/dashboard/dashboard-map" -import { PoweredBy } from "@/components/powered-by" - -export default function MapPage() { - return ( -
- {/* Navigation Menu */} - - -
- {/* Header */} -
-
-
-

- Detection Map -

-

- View all detected potholes and signboards on the map -

-
-
-
- - {/* Map */} -
- -
- - {/* Legend */} -
-
-
- Pothole -
-
-
- Signboard -
-
- - -
-
- ) -} diff --git a/app/create-package/page.tsx b/app/package/page.tsx similarity index 98% rename from app/create-package/page.tsx rename to app/package/page.tsx index 6e154e8..02221a1 100644 --- a/app/create-package/page.tsx +++ b/app/package/page.tsx @@ -25,7 +25,7 @@ import { import { toast } from "sonner" import { PoweredBy } from "@/components/powered-by" -export default function CreatePackagePage() { +export default function PackagePage() { const [packages, setPackages] = useState([]) const [projects, setProjects] = useState([]) const [isLoading, setIsLoading] = useState(true) @@ -216,7 +216,7 @@ export default function CreatePackagePage() { {/* Error Message */} {error && !isModalOpen && (
-
+
!

{error}

@@ -270,7 +270,7 @@ export default function CreatePackagePage() { {/* Error Message in Modal */} {error && (
-
+
!

{error}

diff --git a/app/create-project/page.tsx b/app/project/page.tsx similarity index 99% rename from app/create-project/page.tsx rename to app/project/page.tsx index ae4033c..982e9b6 100644 --- a/app/create-project/page.tsx +++ b/app/project/page.tsx @@ -14,7 +14,7 @@ import { createProject, fetchProjects, updateProject, deleteProject, type Projec import { toast } from "sonner" import { PoweredBy } from "@/components/powered-by" -export default function CreateProjectPage() { +export default function ProjectPage() { const [projects, setProjects] = useState([]) const [isLoading, setIsLoading] = useState(true) const [isModalOpen, setIsModalOpen] = useState(false) diff --git a/components/dashboard/detection-chart.tsx b/components/dashboard/detection-chart.tsx deleted file mode 100644 index 05c0f85..0000000 --- a/components/dashboard/detection-chart.tsx +++ /dev/null @@ -1,116 +0,0 @@ -"use client" - -import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" - -interface DetectionChartProps { - potholes: number - signboards: number - isLoading?: boolean -} - -export function DetectionChart({ potholes, signboards, isLoading }: DetectionChartProps) { - const total = potholes + signboards - const potholePercent = total > 0 ? (potholes / total) * 100 : 50 - const signboardPercent = total > 0 ? (signboards / total) * 100 : 50 - - return ( - - - Detection Distribution - - - {isLoading ? ( -
-
-
- ) : total === 0 ? ( -
- No detections yet -
- ) : ( -
- {/* Donut Chart */} -
- - {/* Background circle */} - - {/* Potholes arc */} - - {/* Signboards arc */} - - - - - - - - - - - - -
-
-

{total}

-

Total

-
-
-
- - {/* Legend */} -
-
-
-
- Potholes -
-
-

{potholes}

-

{potholePercent.toFixed(0)}%

-
-
-
-
-
- Signboards -
-
-

{signboards}

-

{signboardPercent.toFixed(0)}%

-
-
-
-
- )} - - - ) -} diff --git a/components/dashboard/recent-analyses-table.tsx b/components/dashboard/recent-analyses-table.tsx deleted file mode 100644 index 965247e..0000000 --- a/components/dashboard/recent-analyses-table.tsx +++ /dev/null @@ -1,130 +0,0 @@ -"use client" - -import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" -import { Button } from "@/components/ui/button" -import { Badge } from "@/components/ui/badge" -import { Eye, AlertCircle } from "lucide-react" -import { type Video } from "@/lib/api" -import { Skeleton } from "@/components/ui/skeleton" - -interface RecentAnalysesTableProps { - videos: Video[] - isLoading?: boolean - onViewResults?: (videoId: string, detectionType: string) => void -} - -export function RecentAnalysesTable({ videos, isLoading, onViewResults }: RecentAnalysesTableProps) { - const formatDate = (dateString: string) => { - const date = new Date(dateString) - return date.toLocaleDateString("en-IN", { - day: "2-digit", - month: "short", - year: "numeric", - hour: "2-digit", - minute: "2-digit" - }) - } - - const getStatusBadge = (status: string) => { - switch (status) { - case "completed": - return Completed - case "processing": - return Processing - case "pending": - return Pending - case "failed": - return Failed - default: - return {status} - } - } - - const getDetectionTypeBadge = (type: string) => { - if (type === "pothole-detection") { - return Pothole - } - if (type === "pot-sign-detection") { - return Pothole & Sign - } - return Signboard - } - - return ( - - - Recent Analyses - - - {isLoading ? ( -
- {[1, 2, 3, 4, 5].map((i) => ( -
-
- - -
-
- - -
- -
- ))} -
- ) : videos.length === 0 ? ( -
- -

No analyses found

-

Start a new analysis to see results here

-
- ) : ( -
- {videos.slice(0, 8).map((video) => ( -
-
-
-

- {video.filename || `Video ${video.id.slice(0, 8)}...`} -

-

- {formatDate(video.created_at)} -

-
-
- {getDetectionTypeBadge(video.detection_type)} - {getStatusBadge(video.status)} -
-
-

- {video.detection_type === "pothole-detection" - ? video.unique_pothole ?? 0 - : video.detection_type === "pot-sign-detection" - ? (video.unique_pothole ?? 0) + (video.unique_defected_sign_board ?? 0) + (video.unique_good_sign_board ?? 0) - : (video.unique_defected_sign_board ?? 0) + (video.unique_good_sign_board ?? 0)} -

-

Detections

-
-
- {video.status === "completed" && onViewResults && ( - - )} -
- ))} -
- )} -
-
- ) -} \ No newline at end of file diff --git a/components/dashboard/stats-card.tsx b/components/dashboard/stats-card.tsx deleted file mode 100644 index c525bdb..0000000 --- a/components/dashboard/stats-card.tsx +++ /dev/null @@ -1,38 +0,0 @@ -"use client" - -import { Card, CardContent } from "@/components/ui/card" -import { LucideIcon } from "lucide-react" - -interface StatsCardProps { - title: string - value: string | number - icon: LucideIcon - gradient: string - isLoading?: boolean -} - -export function StatsCard({ title, value, icon: Icon, gradient, isLoading }: StatsCardProps) { - return ( - - -
-
-

- {title} -

- {isLoading ? ( -
- ) : ( -

- {value} -

- )} -
-
- -
-
- - - ) -} diff --git a/components/navigation-menu.tsx b/components/navigation-menu.tsx deleted file mode 100644 index 75ef694..0000000 --- a/components/navigation-menu.tsx +++ /dev/null @@ -1,150 +0,0 @@ -"use client" - -import { useState } from "react" -import { useRouter, usePathname } from "next/navigation" -import { - Sheet, - SheetContent, - SheetHeader, - SheetTitle, - SheetTrigger, -} from "@/components/ui/sheet" -import { Button } from "@/components/ui/button" -import { - Menu, - LayoutDashboard, - ChevronRight, - PlusCircle, - FolderPlus, - Package, - MapPin, - Map -} from "lucide-react" -import { PoweredBy } from "@/components/powered-by" - -interface NavItem { - title: string - description: string - href: string - icon: React.ElementType -} - -const navItems: NavItem[] = [ - { - title: "Dashboard", - description: "View analytics, statistics, and recent analyses", - href: "/dashboard", - icon: LayoutDashboard - }, - { - title: "New Analysis", - description: "Start a new road analysis project", - href: "/new-analysis", - icon: PlusCircle - }, - { - title: "Create Project", - description: "Create a new infrastructure project", - href: "/create-project", - icon: FolderPlus - }, - { - title: "Create Package", - description: "Add a package under an existing project", - href: "/create-package", - icon: Package - }, - { - title: "Create Location", - description: "Add a location under a project & package", - href: "/create-location", - icon: MapPin - }, - { - title: "Show Map", - description: "View all detections on an interactive map", - href: "/map", - icon: Map - } -] - -export function NavigationMenu() { - const [isOpen, setIsOpen] = useState(false) - const router = useRouter() - const pathname = usePathname() - - const handleNavigation = (href: string) => { - setIsOpen(false) - router.push(href) - } - - return ( - - - - - - - - VisionRoad - -

- AI-Powered Road Detection System -

-
- - {/* Navigation Items */} - - -
- -
-
-
- ) -} diff --git a/components/powered-by.tsx b/components/powered-by.tsx index 2ead5c7..bf7b505 100644 --- a/components/powered-by.tsx +++ b/components/powered-by.tsx @@ -2,7 +2,7 @@ import Image from "next/image" export function PoweredBy() { return ( -
+
Powered by diff --git a/components/sidebar-navigation.tsx b/components/sidebar-navigation.tsx index 2dc3013..34e8ec3 100644 --- a/components/sidebar-navigation.tsx +++ b/components/sidebar-navigation.tsx @@ -21,19 +21,19 @@ const navItems: NavItem[] = [ }, { title: "Project", - href: "/create-project", + href: "/project", icon: FolderPlus, gradient: "from-blue-400 to-blue-600" }, { title: "Package", - href: "/create-package", + href: "/package", icon: Package, gradient: "from-violet-400 to-purple-500" }, { title: "Location", - href: "/create-location", + href: "/location", icon: MapPin, gradient: "from-amber-400 to-orange-500" }, diff --git a/components/summary-section.tsx b/components/summary-section.tsx deleted file mode 100644 index dcbfb4c..0000000 --- a/components/summary-section.tsx +++ /dev/null @@ -1,112 +0,0 @@ -"use client" - -import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card" -import { Target, AlertTriangle, Film, Activity, Gauge, Monitor, SignpostBig } from "lucide-react" -import type { DetectionData } from "@/lib/types" - -type SummarySectionProps = { - data: DetectionData -} - -export function SummarySection({ data }: SummarySectionProps) { - const stats = [ - { - label: "Total Road Damage", - value: data.summary.total_road_damage || 0, - icon: Target, - color: "text-purple-500", - bgColor: "bg-purple-50 dark:bg-purple-950/30", - }, - { - label: "Defected Signboards", - value: data.summary.unique_defected_sign_board || 0, - icon: SignpostBig, - color: "text-blue-500", - bgColor: "bg-blue-50 dark:bg-blue-950/30", - }, - { - label: "Unique Potholes", - value: data.summary.unique_pothole || 0, - icon: AlertTriangle, - color: "text-red-500", - bgColor: "bg-red-50 dark:bg-red-950/30", - }, - { - label: "Road Cracks", - value: data.summary.unique_road_crack || 0, - icon: AlertTriangle, - color: "text-orange-500", - bgColor: "bg-orange-50 dark:bg-orange-950/30", - }, - { - label: "Damaged Markings", - value: data.summary.unique_damaged_road_marking || 0, - icon: Activity, - color: "text-indigo-500", - bgColor: "bg-indigo-50 dark:bg-indigo-950/30", - }, - { - label: "Good Signboards", - value: data.summary.unique_good_sign_board || 0, - icon: SignpostBig, - color: "text-emerald-500", - bgColor: "bg-emerald-50 dark:bg-emerald-950/30", - }, - { - label: "Detection Rate", - value: `${(data.summary.detection_rate || 0).toFixed(1)}%`, - icon: Activity, - color: "text-green-500", - bgColor: "bg-green-50 dark:bg-green-950/30", - }, - { - label: "Video FPS", - value: (data.video_info.fps || 0).toFixed(1), - icon: Gauge, - color: "text-orange-500", - bgColor: "bg-orange-50 dark:bg-orange-950/30", - }, - { - label: "Resolution", - value: `${data.video_info.width}×${data.video_info.height}`, - icon: Monitor, - color: "text-blue-500", - bgColor: "bg-blue-50 dark:bg-blue-950/30", - }, - { - label: "Total Frames", - value: data.summary.total_frames || data.video_info.total_frames, - icon: Film, - color: "text-purple-500", - bgColor: "bg-purple-50 dark:bg-purple-950/30", - }, - ] - - return ( - - - Detection Summary - Overview of road analysis results - - -
- {stats.map((stat, index) => { - const Icon = stat.icon - return ( -
-
- -
-
{stat.value}
-
{stat.label}
-
- ) - })} -
-
-
- ) -}