Spaces:
Running
Running
Update frontend/src/Layout.jsx
Browse files- frontend/src/Layout.jsx +12 -10
frontend/src/Layout.jsx
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
|
|
|
|
|
| 1 |
import React, { useState } from "react";
|
| 2 |
import { Link } from "react-router-dom";
|
| 3 |
import { createPageUrl } from "./utils";
|
|
@@ -6,17 +8,16 @@ import {
|
|
| 6 |
LayoutDashboard,
|
| 7 |
History as HistoryIcon,
|
| 8 |
ChevronLeft,
|
| 9 |
-
Sparkles
|
| 10 |
} from "lucide-react";
|
| 11 |
-
|
| 12 |
-
import { cn } from "./lib/utils";
|
| 13 |
|
| 14 |
export default function Layout({ children, currentPageName }) {
|
| 15 |
const [collapsed, setCollapsed] = useState(false);
|
| 16 |
|
| 17 |
const navItems = [
|
| 18 |
{ name: "Dashboard", icon: LayoutDashboard, page: "Dashboard" },
|
| 19 |
-
{ name: "History", icon: HistoryIcon, page: "History" }
|
| 20 |
];
|
| 21 |
|
| 22 |
return (
|
|
@@ -62,7 +63,6 @@ export default function Layout({ children, currentPageName }) {
|
|
| 62 |
<nav className="flex-1 p-3 space-y-1">
|
| 63 |
{navItems.map((item) => {
|
| 64 |
const isActive = currentPageName === item.page;
|
| 65 |
-
const Icon = item.icon;
|
| 66 |
return (
|
| 67 |
<Link
|
| 68 |
key={item.name}
|
|
@@ -74,19 +74,21 @@ export default function Layout({ children, currentPageName }) {
|
|
| 74 |
: "text-slate-500 hover:bg-slate-50 hover:text-slate-700"
|
| 75 |
)}
|
| 76 |
>
|
| 77 |
-
<
|
| 78 |
className={cn(
|
| 79 |
"h-5 w-5 flex-shrink-0",
|
| 80 |
isActive ? "text-indigo-600" : "text-slate-400 group-hover:text-slate-600"
|
| 81 |
)}
|
| 82 |
/>
|
| 83 |
-
{!collapsed &&
|
|
|
|
|
|
|
| 84 |
</Link>
|
| 85 |
);
|
| 86 |
})}
|
| 87 |
</nav>
|
| 88 |
|
| 89 |
-
{/*
|
| 90 |
{collapsed && (
|
| 91 |
<button
|
| 92 |
onClick={() => setCollapsed(false)}
|
|
@@ -96,7 +98,7 @@ export default function Layout({ children, currentPageName }) {
|
|
| 96 |
</button>
|
| 97 |
)}
|
| 98 |
|
| 99 |
-
{/* Pro
|
| 100 |
{!collapsed && (
|
| 101 |
<div className="p-3">
|
| 102 |
<div className="p-4 rounded-2xl bg-gradient-to-br from-slate-900 to-slate-800 text-white">
|
|
@@ -115,7 +117,7 @@ export default function Layout({ children, currentPageName }) {
|
|
| 115 |
)}
|
| 116 |
</aside>
|
| 117 |
|
| 118 |
-
{/* Main
|
| 119 |
<main
|
| 120 |
className={cn(
|
| 121 |
"flex-1 transition-all duration-300",
|
|
|
|
| 1 |
+
// frontend/src/Layout.jsx
|
| 2 |
+
|
| 3 |
import React, { useState } from "react";
|
| 4 |
import { Link } from "react-router-dom";
|
| 5 |
import { createPageUrl } from "./utils";
|
|
|
|
| 8 |
LayoutDashboard,
|
| 9 |
History as HistoryIcon,
|
| 10 |
ChevronLeft,
|
| 11 |
+
Sparkles,
|
| 12 |
} from "lucide-react";
|
| 13 |
+
import { cn } from "@/lib/utils";
|
|
|
|
| 14 |
|
| 15 |
export default function Layout({ children, currentPageName }) {
|
| 16 |
const [collapsed, setCollapsed] = useState(false);
|
| 17 |
|
| 18 |
const navItems = [
|
| 19 |
{ name: "Dashboard", icon: LayoutDashboard, page: "Dashboard" },
|
| 20 |
+
{ name: "History", icon: HistoryIcon, page: "History" },
|
| 21 |
];
|
| 22 |
|
| 23 |
return (
|
|
|
|
| 63 |
<nav className="flex-1 p-3 space-y-1">
|
| 64 |
{navItems.map((item) => {
|
| 65 |
const isActive = currentPageName === item.page;
|
|
|
|
| 66 |
return (
|
| 67 |
<Link
|
| 68 |
key={item.name}
|
|
|
|
| 74 |
: "text-slate-500 hover:bg-slate-50 hover:text-slate-700"
|
| 75 |
)}
|
| 76 |
>
|
| 77 |
+
<item.icon
|
| 78 |
className={cn(
|
| 79 |
"h-5 w-5 flex-shrink-0",
|
| 80 |
isActive ? "text-indigo-600" : "text-slate-400 group-hover:text-slate-600"
|
| 81 |
)}
|
| 82 |
/>
|
| 83 |
+
{!collapsed && (
|
| 84 |
+
<span className="font-medium text-sm">{item.name}</span>
|
| 85 |
+
)}
|
| 86 |
</Link>
|
| 87 |
);
|
| 88 |
})}
|
| 89 |
</nav>
|
| 90 |
|
| 91 |
+
{/* Collapse Toggle (when collapsed) */}
|
| 92 |
{collapsed && (
|
| 93 |
<button
|
| 94 |
onClick={() => setCollapsed(false)}
|
|
|
|
| 98 |
</button>
|
| 99 |
)}
|
| 100 |
|
| 101 |
+
{/* Pro Badge */}
|
| 102 |
{!collapsed && (
|
| 103 |
<div className="p-3">
|
| 104 |
<div className="p-4 rounded-2xl bg-gradient-to-br from-slate-900 to-slate-800 text-white">
|
|
|
|
| 117 |
)}
|
| 118 |
</aside>
|
| 119 |
|
| 120 |
+
{/* Main Content */}
|
| 121 |
<main
|
| 122 |
className={cn(
|
| 123 |
"flex-1 transition-all duration-300",
|