Seth0330 commited on
Commit
a79917c
·
verified ·
1 Parent(s): cd32c03

Create frontend/src/Layout.jsx

Browse files
Files changed (1) hide show
  1. frontend/src/Layout.jsx +129 -0
frontend/src/Layout.jsx ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import React, { useState } from "react";
2
+ import { Link } from "react-router-dom";
3
+ import { createPageUrl } from "./utils";
4
+ import {
5
+ ScanText,
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 (
23
+ <div className="min-h-screen bg-[#FAFAFA] flex">
24
+ {/* Sidebar */}
25
+ <aside
26
+ className={cn(
27
+ "fixed left-0 top-0 h-screen bg-white border-r border-slate-200/80 z-50 transition-all duration-300 ease-out flex flex-col",
28
+ collapsed ? "w-[72px]" : "w-[260px]"
29
+ )}
30
+ >
31
+ {/* Logo */}
32
+ <div
33
+ className={cn(
34
+ "h-16 flex items-center border-b border-slate-100 px-4",
35
+ collapsed ? "justify-center" : "justify-between"
36
+ )}
37
+ >
38
+ <Link to={createPageUrl("Dashboard")} className="flex items-center gap-3">
39
+ <div className="h-9 w-9 rounded-xl bg-gradient-to-br from-indigo-500 to-violet-600 flex items-center justify-center shadow-lg shadow-indigo-500/25">
40
+ <ScanText className="h-5 w-5 text-white" />
41
+ </div>
42
+ {!collapsed && (
43
+ <div className="flex flex-col">
44
+ <span className="font-semibold text-slate-900 tracking-tight">EZOFIS AI</span>
45
+ <span className="text-[10px] text-slate-400 font-medium tracking-wide uppercase">
46
+ Agentic Extract
47
+ </span>
48
+ </div>
49
+ )}
50
+ </Link>
51
+ {!collapsed && (
52
+ <button
53
+ onClick={() => setCollapsed(true)}
54
+ className="h-7 w-7 rounded-lg hover:bg-slate-100 flex items-center justify-center text-slate-400 hover:text-slate-600 transition-colors"
55
+ >
56
+ <ChevronLeft className="h-4 w-4" />
57
+ </button>
58
+ )}
59
+ </div>
60
+
61
+ {/* Navigation */}
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}
69
+ to={createPageUrl(item.page)}
70
+ className={cn(
71
+ "flex items-center gap-3 px-3 py-2.5 rounded-xl transition-all duration-200 group",
72
+ isActive
73
+ ? "bg-gradient-to-r from-indigo-50 to-violet-50 text-indigo-600"
74
+ : "text-slate-500 hover:bg-slate-50 hover:text-slate-700"
75
+ )}
76
+ >
77
+ <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 && <span className="font-medium text-sm">{item.name}</span>}
84
+ </Link>
85
+ );
86
+ })}
87
+ </nav>
88
+
89
+ {/* Expand button when collapsed */}
90
+ {collapsed && (
91
+ <button
92
+ onClick={() => setCollapsed(false)}
93
+ className="m-3 h-10 rounded-xl bg-slate-50 hover:bg-slate-100 flex items-center justify-center text-slate-400 hover:text-slate-600 transition-colors"
94
+ >
95
+ <ChevronLeft className="h-4 w-4 rotate-180" />
96
+ </button>
97
+ )}
98
+
99
+ {/* Pro badge */}
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">
103
+ <div className="flex items-center gap-2 mb-2">
104
+ <Sparkles className="h-4 w-4 text-amber-400" />
105
+ <span className="text-xs font-semibold tracking-wide">UPGRADE TO PRO</span>
106
+ </div>
107
+ <p className="text-xs text-slate-400 mb-3">
108
+ Unlock unlimited extractions &amp; API access
109
+ </p>
110
+ <button className="w-full py-2 px-3 rounded-lg bg-white text-slate-900 text-sm font-semibold hover:bg-slate-100 transition-colors">
111
+ Upgrade Now
112
+ </button>
113
+ </div>
114
+ </div>
115
+ )}
116
+ </aside>
117
+
118
+ {/* Main content */}
119
+ <main
120
+ className={cn(
121
+ "flex-1 transition-all duration-300",
122
+ collapsed ? "ml-[72px]" : "ml-[260px]"
123
+ )}
124
+ >
125
+ {children}
126
+ </main>
127
+ </div>
128
+ );
129
+ }