alpe-temp 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/frontend-project/src/App.css +1 -0
  2. package/frontend-project/src/Auth/Login.jsx +85 -0
  3. package/frontend-project/src/Auth/Register.jsx +183 -0
  4. package/frontend-project/src/Intro.jsx +33 -0
  5. package/frontend-project/src/LayOut.jsx +38 -0
  6. package/frontend-project/src/api/ApiClient.js +92 -0
  7. package/frontend-project/src/assets/hero.png +0 -0
  8. package/frontend-project/src/assets/react.svg +1 -0
  9. package/frontend-project/src/assets/vite.svg +1 -0
  10. package/frontend-project/src/components/Aside.jsx +9 -0
  11. package/frontend-project/src/components/Button.jsx +100 -0
  12. package/frontend-project/src/components/Card.jsx +104 -0
  13. package/frontend-project/src/components/FormField.jsx +129 -0
  14. package/frontend-project/src/components/Modal.jsx +106 -0
  15. package/frontend-project/src/components/Table.jsx +127 -0
  16. package/frontend-project/src/components/Toast.jsx +64 -0
  17. package/frontend-project/src/components/index.js +14 -0
  18. package/frontend-project/src/config.js +66 -0
  19. package/frontend-project/src/design.js +115 -0
  20. package/frontend-project/src/index.css +60 -0
  21. package/frontend-project/src/layouts/BottomNav.jsx +156 -0
  22. package/frontend-project/src/layouts/TopNav.jsx +150 -0
  23. package/frontend-project/src/layouts/useShell.js +44 -0
  24. package/frontend-project/src/main.jsx +41 -0
  25. package/frontend-project/src/pages/Department.jsx +188 -0
  26. package/frontend-project/src/pages/Employee.jsx +274 -0
  27. package/frontend-project/src/pages/Home.jsx +79 -0
  28. package/frontend-project/src/pages/Profile.jsx +9 -0
  29. package/frontend-project/src/pages/Register.jsx +57 -0
  30. package/frontend-project/src/pages/Reports.jsx +91 -0
  31. package/frontend-project/src/pages/Salary.jsx +264 -0
  32. package/frontend-project/src/themes.js +175 -0
  33. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ @import "tailwindcss";
@@ -0,0 +1,85 @@
1
+ import React, { useState } from 'react';
2
+ import { useNavigate, Link } from 'react-router-dom';
3
+ import { Eye, EyeOff, LogIn } from 'lucide-react';
4
+ import { authApi } from '../api/ApiClient';
5
+ import Button from '../components/Button';
6
+ import FormField from '../components/FormField';
7
+ import { useToast } from '../components/Toast';
8
+
9
+ export default function Login() {
10
+ const [email, setEmail] = useState('');
11
+ const [password, setPassword] = useState('');
12
+ const [showPwd, setShowPwd] = useState(false);
13
+ const [loading, setLoading] = useState(false);
14
+ const navigate = useNavigate();
15
+ const toast = useToast();
16
+
17
+ const handleLogin = async () => {
18
+ if (!email || !password) { toast.error('Please fill in all fields'); return; }
19
+ setLoading(true);
20
+ try {
21
+ const data = await authApi.login({ email: email.trim(), password });
22
+ localStorage.setItem('token', data.data?.accessToken ?? '');
23
+ localStorage.setItem('user', JSON.stringify(data.data?.user ?? {}));
24
+ toast.success('Login successful');
25
+ navigate('/dashboard/overview');
26
+ } catch (err) {
27
+ toast.error(err.message ?? 'Login failed');
28
+ } finally {
29
+ setLoading(false);
30
+ }
31
+ };
32
+
33
+ const handleKey = (e) => { if (e.key === 'Enter') handleLogin(); };
34
+
35
+ return (
36
+ <div className="min-h-screen flex items-center justify-center p-4">
37
+ <div className="w-full max-w-[760px] flex h-[500px] overflow-hidden">
38
+ <div className="hidden bg-[#008A75] sm:flex flex-col w-5/12 p-10 text-white">
39
+ <div className="mb-auto">
40
+ <div className="flex items-center gap-2 mb-1">
41
+ <img src="/logo.png" alt="EPMS" className="w-8 h-10" />
42
+ <h1 className="text-[22px] font-bold tracking-tight mt-3">EPMS</h1>
43
+ </div>
44
+ <p className="text-[10px] text-white/60 font-medium uppercase tracking-widest">Employee Payroll Management System</p>
45
+ </div>
46
+ <div className="mt-10">
47
+ <p className="text-[18px] font-semibold leading-snug">
48
+ Welcome back.<br />
49
+ <span className="text-white/60">Manage your workforce.</span>
50
+ </p>
51
+ <p className="text-[12px] text-white/50 mt-3 leading-relaxed">
52
+ Sign in to manage employees, departments, and payroll records.
53
+ </p>
54
+ </div>
55
+ <div className="mt-auto pt-10 border-t border-white/20">
56
+ <p className="text-[11px] text-white/40">© {new Date().getFullYear()} EPMS · All rights reserved</p>
57
+ </div>
58
+ </div>
59
+ <div className="flex-1 bg-white p-8 sm:p-10 flex flex-col justify-center">
60
+ <div className="mb-6">
61
+ <h2 className="text-[20px] font-bold text-gray-800">Sign in</h2>
62
+ <p className="text-[13px] text-gray-400 mt-1">
63
+ Don't have an account?{' '}
64
+ <Link to="/register" className="text-[#008A75] font-semibold hover:underline">Create one</Link>
65
+ </p>
66
+ </div>
67
+ <div className="space-y-3">
68
+ <FormField label="Email address" required>
69
+ <FormField.Input type="email" value={email} onChange={(v) => setEmail(v)} placeholder="you@company.com" onKeyDown={handleKey} autoComplete="email" className='rounded-none' />
70
+ </FormField>
71
+ <FormField label="Password" required>
72
+ <div className="relative">
73
+ <FormField.Input type={showPwd ? 'text' : 'password'} value={password} onChange={(v) => setPassword(v)} placeholder="Enter password" onKeyDown={handleKey} className='rounded-none' autoComplete="current-password" className="pr-10" />
74
+ <button type="button" onClick={() => setShowPwd((v) => !v)} className="absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors">
75
+ {showPwd ? <EyeOff className="w-4 h-4" /> : <Eye className="w-4 h-4" />}
76
+ </button>
77
+ </div>
78
+ </FormField>
79
+ </div>
80
+ <Button className="mt-5 rounded-none" fullWidth size="lg" loading={loading} icon={<LogIn className="w-4 h-4" />} onClick={handleLogin}>Sign in</Button>
81
+ </div>
82
+ </div>
83
+ </div>
84
+ );
85
+ }
@@ -0,0 +1,183 @@
1
+ /**
2
+ * Register.jsx – Account creation page.
3
+ * Matches Login's split-panel layout.
4
+ * Backend: POST /api/auth/signup → { name, email, password }
5
+ */
6
+
7
+ import React, { useState } from 'react';
8
+ import { useNavigate, Link } from 'react-router-dom';
9
+ import { Eye, EyeOff, UserPlus } from 'lucide-react';
10
+ import { authApi } from '../api/ApiClient';
11
+ import Button from '../components/Button';
12
+ import FormField from '../components/FormField';
13
+ import { useToast } from '../components/Toast';
14
+
15
+ export default function Register() {
16
+ const [name, setName] = useState('');
17
+ const [email, setEmail] = useState('');
18
+ const [password, setPassword] = useState('');
19
+ const [confirm, setConfirm] = useState('');
20
+ const [showPwd, setShowPwd] = useState(false);
21
+ const [loading, setLoading] = useState(false);
22
+ const [errors, setErrors] = useState({});
23
+ const navigate = useNavigate();
24
+ const toast = useToast();
25
+
26
+ const validate = () => {
27
+ const e = {};
28
+ if (!name.trim()) e.name = 'Full name is required';
29
+ if (!email.trim()) e.email = 'Email is required';
30
+ else if (!/\S+@\S+\.\S+/.test(email)) e.email = 'Enter a valid email';
31
+ if (!password) e.password = 'Password is required';
32
+ else if (password.length < 6) e.password = 'Minimum 6 characters';
33
+ if (!confirm) e.confirm = 'Please confirm your password';
34
+ else if (confirm !== password) e.confirm = 'Passwords do not match';
35
+ setErrors(e);
36
+ return Object.keys(e).length === 0;
37
+ };
38
+
39
+ const handleRegister = async () => {
40
+ if (!validate()) return;
41
+ try {
42
+ setLoading(true);
43
+ const data = await authApi.signup({
44
+ name: name.trim(),
45
+ email: email.trim(),
46
+ password: password,
47
+ });
48
+
49
+ localStorage.setItem('token', data.data?.accessToken ?? '');
50
+ localStorage.setItem('user', JSON.stringify(data.data?.user ?? {}));
51
+
52
+ toast.success('Account created — welcome!');
53
+ navigate('/dashboard/overview');
54
+ } catch (err) {
55
+ toast.error(err.message ?? 'Registration failed. Please try again.');
56
+ } finally {
57
+ setLoading(false);
58
+ }
59
+ };
60
+
61
+ const handleKey = (e) => { if (e.key === 'Enter') handleRegister(); };
62
+
63
+ return (
64
+ <div className="min-h-screen flex items-center justify-center p-4">
65
+ <div className="w-full max-w-[760px] flex rounded-none h-[540px] overflow-hidden ">
66
+
67
+ {/* ── Left panel ── */}
68
+ <div className="hidden sm:flex bg-[#008A75] flex-col w-5/12 p-10 text-white">
69
+ <div className="mb-auto">
70
+ <div className="flex items-center gap-2 mb-1">
71
+ <img src="/logo.png" alt="EPMS" className="w-8 h-10" />
72
+ <h1 className="text-[22px] font-bold tracking-tight mt-3">EPMS</h1>
73
+ </div>
74
+ <p className="text-[10px] text-white/60 font-medium uppercase tracking-widest">Employee Payroll Management System</p>
75
+ </div>
76
+
77
+ <div className="mt-10">
78
+ <p className="text-[18px] font-semibold leading-snug">
79
+ Get started today.<br />
80
+ <span className="text-white/60">Your team awaits.</span>
81
+ </p>
82
+ <p className="text-[12px] text-white/50 mt-3 leading-relaxed">
83
+ Create your admin account and start managing employees, departments, and payroll.
84
+ </p>
85
+ </div>
86
+
87
+ <div className="mt-auto pt-10 border-t border-white/20">
88
+ <p className="text-[11px] text-white/40">
89
+ © {new Date().getFullYear()} EPMS · All rights reserved
90
+ </p>
91
+ </div>
92
+ </div>
93
+
94
+ {/* ── Right panel ── */}
95
+ <div className="flex-1 p-8 sm:p-10 flex flex-col justify-center overflow-y-auto">
96
+ <div className="mb-6">
97
+ <h2 className="text-[20px] font-bold text-gray-800">Create account</h2>
98
+ <p className="text-[13px] text-gray-400 mt-1">
99
+ Already have an account?{' '}
100
+ <Link to="/login" className="text-[#008A75] font-semibold hover:underline">
101
+ Sign in
102
+ </Link>
103
+ </p>
104
+ </div>
105
+
106
+ <div className="space-y-3">
107
+ <FormField label="Full name" required error={errors.name}>
108
+ <FormField.Input
109
+ type="text"
110
+ value={name}
111
+ onChange={(v) => setName(v)}
112
+ placeholder="Jane Doe"
113
+ onKeyDown={handleKey}
114
+ autoComplete="name"
115
+ className='rounded-none'
116
+ />
117
+ </FormField>
118
+
119
+ <FormField label="Email address" required error={errors.email}>
120
+ <FormField.Input
121
+ type="email"
122
+ value={email}
123
+ onChange={(v) => setEmail(v)}
124
+ placeholder="you@company.com"
125
+ onKeyDown={handleKey}
126
+ autoComplete="email"
127
+ className='rounded-none'
128
+ />
129
+ </FormField>
130
+
131
+ <FormField label="Password" required error={errors.password}>
132
+ <div className="relative">
133
+ <FormField.Input
134
+ type={showPwd ? 'text' : 'password'}
135
+ value={password}
136
+ onChange={(v) => setPassword(v)}
137
+ placeholder="Min. 6 characters"
138
+ onKeyDown={handleKey}
139
+ autoComplete="new-password"
140
+ className="pr-10 rounded-none"
141
+ />
142
+ <button
143
+ type="button"
144
+ onClick={() => setShowPwd((v) => !v)}
145
+ className="absolute right-3 top-1/2 -translate-y-1/2 text-gray-400 hover:text-gray-600 transition-colors"
146
+ >
147
+ {showPwd ? <EyeOff className="w-4 h-4" /> : <Eye className="w-4 h-4" />}
148
+ </button>
149
+ </div>
150
+ </FormField>
151
+
152
+ <FormField label="Confirm password" required error={errors.confirm}>
153
+ <FormField.Input
154
+ type={showPwd ? 'text' : 'password'}
155
+ value={confirm}
156
+ onChange={(v) => setConfirm(v)}
157
+ placeholder="Repeat your password"
158
+ onKeyDown={handleKey}
159
+ autoComplete="new-password"
160
+ className='rounded-none'
161
+ />
162
+ </FormField>
163
+ </div>
164
+
165
+ <Button
166
+ className="mt-5 rounded-none"
167
+ fullWidth
168
+ size="lg"
169
+ loading={loading}
170
+ icon={<UserPlus className="w-4 h-4" />}
171
+ onClick={handleRegister}
172
+ >
173
+ Create account
174
+ </Button>
175
+
176
+ <p className="text-[11px] text-gray-400 text-center mt-4">
177
+ Protected by JWT authentication
178
+ </p>
179
+ </div>
180
+ </div>
181
+ </div>
182
+ );
183
+ }
@@ -0,0 +1,33 @@
1
+ import { useEffect } from 'react'
2
+ import { useNavigate } from 'react-router-dom'
3
+
4
+ export default function Intro() {
5
+ const navigate = useNavigate()
6
+
7
+ useEffect(() => {
8
+ const timer = setTimeout(() => {
9
+ const token = localStorage.getItem('token')
10
+ navigate(token ? '/dashboard/overview' : '/login', { replace: true })
11
+ }, 2800)
12
+ return () => clearTimeout(timer)
13
+ }, [navigate])
14
+
15
+ return (
16
+ <div className="fixed inset-0 z-50 flex flex-col items-center justify-center bg-white">
17
+ <div className="flex flex-col items-center gap-6">
18
+ <img src="/logo.png" alt="EPMS" className="w-16 h-20" />
19
+
20
+ <div className="flex flex-col items-center">
21
+ <span className="text-4xl font-bold tracking-tight text-zinc-800">
22
+ EP<span className="text-[#008A75]">MS</span>
23
+ </span>
24
+ <span className="text-xs text-zinc-800/60 font-medium uppercase tracking-[0.2em] mt-1">
25
+ Employee Payroll Management System
26
+ </span>
27
+ </div>
28
+
29
+ <div className="w-6 h-6 border-2 border-zinc-200 border-t-[#008A75] rounded-full animate-spin mt-2" />
30
+ </div>
31
+ </div>
32
+ )
33
+ }
@@ -0,0 +1,38 @@
1
+ // ═══════════════════════════════════════════════════════════════════════════
2
+ // 🏗️ LAYOUT — The app shell (reads config, picks the right layout)
3
+ // ═══════════════════════════════════════════════════════════════════════════
4
+ //
5
+ // WHAT THIS FILE DOES:
6
+ // 1. Reads your config.js settings
7
+ // 2. Applies the chosen theme as CSS variables on the root div
8
+ // 3. Renders the correct navigation layout (top or bottom)
9
+ //
10
+ // HOW TO CUSTOMIZE:
11
+ // Change config.js values and everything updates automatically.
12
+ // - navigation: 'topnav' | 'bottomnav'
13
+ // - theme: any theme name from themes.js
14
+ // - rounded: 'none' | 'sm' | 'md' | 'lg' | 'xl' | 'full'
15
+ // - fontSize: 'normal' | 'large'
16
+ //
17
+ // ═══════════════════════════════════════════════════════════════════════════
18
+
19
+ import React from 'react';
20
+ import { config } from './config';
21
+ import { getDesignTokens } from './design';
22
+ import TopNav from './layouts/TopNav';
23
+ import BottomNav from './layouts/BottomNav';
24
+
25
+ export default function Layout() {
26
+ // ─── Read config and generate design tokens ───────────────────────────────
27
+ const tokens = getDesignTokens(config);
28
+
29
+ // ─── Apply CSS variables as inline styles on the root wrapper ─────────────
30
+ // Every child component can use: var(--color-primary), var(--radius), etc.
31
+ //
32
+ return (
33
+ <div style={tokens.cssVars}>
34
+ {/* Pick the right navigation layout based on config */}
35
+ {config.navigation === 'bottomnav' ? <BottomNav /> : <TopNav />}
36
+ </div>
37
+ );
38
+ }
@@ -0,0 +1,92 @@
1
+ import axios from 'axios';
2
+
3
+ const BASE_URL = import.meta.env.VITE_API_URL ?? 'http://localhost:3000';
4
+
5
+ const api = axios.create({
6
+ baseURL: BASE_URL,
7
+ headers: { 'Content-Type': 'application/json' },
8
+ });
9
+
10
+ api.interceptors.request.use((config) => {
11
+ const token = localStorage.getItem('token');
12
+ if (token) config.headers.Authorization = `Bearer ${token}`;
13
+ return config;
14
+ });
15
+
16
+ api.interceptors.response.use(
17
+ (res) => res,
18
+ (err) => {
19
+ const msg = err.response?.data?.message || err.message || 'Request failed';
20
+ return Promise.reject(new Error(msg));
21
+ }
22
+ );
23
+
24
+ export const authApi = {
25
+ login: (body) => api.post('/api/auth/login', body).then(r => r.data),
26
+ signup: (body) => api.post('/api/auth/signup', body).then(r => r.data),
27
+ refresh:(body) => api.post('/api/auth/refresh', body).then(r => r.data),
28
+ me: () => api.get('/api/auth/me').then(r => r.data),
29
+ logout: () => api.post('/api/auth/logout').then(r => r.data),
30
+ };
31
+
32
+ export const employeeApi = {
33
+ list: () => api.get('/api/employees').then(r => r.data),
34
+ count: () => api.get('/api/employees/count').then(r => r.data),
35
+ create: (body) => api.post('/api/employees', body).then(r => r.data),
36
+ update: (id, b) => api.put(`/api/employees/${id}`, b).then(r => r.data),
37
+ remove: (id) => api.delete(`/api/employees/${id}`).then(r => r.data),
38
+ };
39
+
40
+ export const departmentApi = {
41
+ list: () => api.get('/api/departments').then(r => r.data),
42
+ create: (body) => api.post('/api/departments', body).then(r => r.data),
43
+ update: (id, b) => api.put(`/api/departments/${id}`, b).then(r => r.data),
44
+ remove: (id) => api.delete(`/api/departments/${id}`).then(r => r.data),
45
+ };
46
+
47
+ export const salaryApi = {
48
+ list: () => api.get('/api/salaries').then(r => r.data),
49
+ create: (body) => api.post('/api/salaries', body).then(r => r.data),
50
+ update: (id, b) => api.put(`/api/salaries/${id}`, b).then(r => r.data),
51
+ remove: (id) => api.delete(`/api/salaries/${id}`).then(r => r.data),
52
+ average: () => api.get('/api/salaries/avg').then(r => r.data),
53
+ };
54
+
55
+ export const reportsApi = {
56
+ monthlyPayroll: (month) => api.get('/api/reports/payroll', { params: { month } }).then(r => r.data),
57
+ };
58
+
59
+ export const excelApi = {
60
+ async download(path, filename = 'export') {
61
+ const token = localStorage.getItem('token');
62
+ const res = await fetch(`${BASE_URL}${path}`, {
63
+ headers: { ...(token ? { Authorization: `Bearer ${token}` } : {}) },
64
+ });
65
+ const blob = await res.blob();
66
+ const url = URL.createObjectURL(blob);
67
+ const a = Object.assign(document.createElement('a'), { href: url, download: `${filename}.xlsx` });
68
+ document.body.appendChild(a);
69
+ a.click();
70
+ a.remove();
71
+ URL.revokeObjectURL(url);
72
+ },
73
+ exportUsers: () => excelApi.download('/api/excel/export/users', 'employees-report'),
74
+ exportCustom: async (sheetName, data, filename) => {
75
+ const token = localStorage.getItem('token');
76
+ const res = await fetch(`${BASE_URL}/api/excel/export/custom`, {
77
+ method: 'POST',
78
+ headers: { 'Content-Type': 'application/json', ...(token ? { Authorization: `Bearer ${token}` } : {}) },
79
+ body: JSON.stringify({ sheetName, data }),
80
+ });
81
+ if (!res.ok) throw new Error(await res.text());
82
+ const blob = await res.blob();
83
+ const url = URL.createObjectURL(blob);
84
+ const a = Object.assign(document.createElement('a'), { href: url, download: `${filename ?? sheetName}.xlsx` });
85
+ document.body.appendChild(a);
86
+ a.click();
87
+ a.remove();
88
+ URL.revokeObjectURL(url);
89
+ },
90
+ };
91
+
92
+ export default api;
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="77" height="47" fill="none" aria-labelledby="vite-logo-title" viewBox="0 0 77 47"><title id="vite-logo-title">Vite</title><style>.parenthesis{fill:#000}@media (prefers-color-scheme:dark){.parenthesis{fill:#fff}}</style><path fill="#9135ff" d="M40.151 45.71c-.663.844-2.02.374-2.02-.699V34.708a2.26 2.26 0 0 0-2.262-2.262H24.493c-.92 0-1.457-1.04-.92-1.788l7.479-10.471c1.07-1.498 0-3.578-1.842-3.578H15.443c-.92 0-1.456-1.04-.92-1.788l9.696-13.576c.213-.297.556-.474.92-.474h28.894c.92 0 1.456 1.04.92 1.788l-7.48 10.472c-1.07 1.497 0 3.578 1.842 3.578h11.376c.944 0 1.474 1.087.89 1.83L40.153 45.712z"/><mask id="a" width="48" height="47" x="14" y="0" maskUnits="userSpaceOnUse" style="mask-type:alpha"><path fill="#000" d="M40.047 45.71c-.663.843-2.02.374-2.02-.699V34.708a2.26 2.26 0 0 0-2.262-2.262H24.389c-.92 0-1.457-1.04-.92-1.788l7.479-10.472c1.07-1.497 0-3.578-1.842-3.578H15.34c-.92 0-1.456-1.04-.92-1.788l9.696-13.575c.213-.297.556-.474.92-.474H53.93c.92 0 1.456 1.04.92 1.788L47.37 13.03c-1.07 1.498 0 3.578 1.842 3.578h11.376c.944 0 1.474 1.088.89 1.831L40.049 45.712z"/></mask><g mask="url(#a)"><g filter="url(#b)"><ellipse cx="5.508" cy="14.704" fill="#eee6ff" rx="5.508" ry="14.704" transform="rotate(269.814 20.96 11.29)scale(-1 1)"/></g><g filter="url(#c)"><ellipse cx="10.399" cy="29.851" fill="#eee6ff" rx="10.399" ry="29.851" transform="rotate(89.814 -16.902 -8.275)scale(1 -1)"/></g><g filter="url(#d)"><ellipse cx="5.508" cy="30.487" fill="#8900ff" rx="5.508" ry="30.487" transform="rotate(89.814 -19.197 -7.127)scale(1 -1)"/></g><g filter="url(#e)"><ellipse cx="5.508" cy="30.599" fill="#8900ff" rx="5.508" ry="30.599" transform="rotate(89.814 -25.928 4.177)scale(1 -1)"/></g><g filter="url(#f)"><ellipse cx="5.508" cy="30.599" fill="#8900ff" rx="5.508" ry="30.599" transform="rotate(89.814 -25.738 5.52)scale(1 -1)"/></g><g filter="url(#g)"><ellipse cx="14.072" cy="22.078" fill="#eee6ff" rx="14.072" ry="22.078" transform="rotate(93.35 31.245 55.578)scale(-1 1)"/></g><g filter="url(#h)"><ellipse cx="3.47" cy="21.501" fill="#8900ff" rx="3.47" ry="21.501" transform="rotate(89.009 35.419 55.202)scale(-1 1)"/></g><g filter="url(#i)"><ellipse cx="3.47" cy="21.501" fill="#8900ff" rx="3.47" ry="21.501" transform="rotate(89.009 35.419 55.202)scale(-1 1)"/></g><g filter="url(#j)"><ellipse cx="14.592" cy="9.743" fill="#8900ff" rx="4.407" ry="29.108" transform="rotate(39.51 14.592 9.743)"/></g><g filter="url(#k)"><ellipse cx="61.728" cy="-5.321" fill="#8900ff" rx="4.407" ry="29.108" transform="rotate(37.892 61.728 -5.32)"/></g><g filter="url(#l)"><ellipse cx="55.618" cy="7.104" fill="#00c2ff" rx="5.971" ry="9.665" transform="rotate(37.892 55.618 7.104)"/></g><g filter="url(#m)"><ellipse cx="12.326" cy="39.103" fill="#8900ff" rx="4.407" ry="29.108" transform="rotate(37.892 12.326 39.103)"/></g><g filter="url(#n)"><ellipse cx="12.326" cy="39.103" fill="#8900ff" rx="4.407" ry="29.108" transform="rotate(37.892 12.326 39.103)"/></g><g filter="url(#o)"><ellipse cx="49.857" cy="30.678" fill="#8900ff" rx="4.407" ry="29.108" transform="rotate(37.892 49.857 30.678)"/></g><g filter="url(#p)"><ellipse cx="52.623" cy="33.171" fill="#00c2ff" rx="5.971" ry="15.297" transform="rotate(37.892 52.623 33.17)"/></g></g><path d="M6.919 0c-9.198 13.166-9.252 33.575 0 46.789h6.215c-9.25-13.214-9.196-33.623 0-46.789zm62.424 0h-6.215c9.198 13.166 9.252 33.575 0 46.789h6.215c9.25-13.214 9.196-33.623 0-46.789" class="parenthesis"/><defs><filter id="b" width="60.045" height="41.654" x="-5.564" y="16.92" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="7.659"/></filter><filter id="c" width="90.34" height="51.437" x="-40.407" y="-6.762" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="7.659"/></filter><filter id="d" width="79.355" height="29.4" x="-35.435" y="2.801" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="4.596"/></filter><filter id="e" width="79.579" height="29.4" x="-30.84" y="20.8" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="4.596"/></filter><filter id="f" width="79.579" height="29.4" x="-29.307" y="21.949" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="4.596"/></filter><filter id="g" width="74.749" height="58.852" x="29.961" y="-17.13" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="7.659"/></filter><filter id="h" width="61.377" height="25.362" x="37.754" y="3.055" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="4.596"/></filter><filter id="i" width="61.377" height="25.362" x="37.754" y="3.055" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="4.596"/></filter><filter id="j" width="56.045" height="63.649" x="-13.43" y="-22.082" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="4.596"/></filter><filter id="k" width="54.814" height="64.646" x="34.321" y="-37.644" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="4.596"/></filter><filter id="l" width="33.541" height="35.313" x="38.847" y="-10.552" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="4.596"/></filter><filter id="m" width="54.814" height="64.646" x="-15.081" y="6.78" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="4.596"/></filter><filter id="n" width="54.814" height="64.646" x="-15.081" y="6.78" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="4.596"/></filter><filter id="o" width="54.814" height="64.646" x="22.45" y="-1.645" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="4.596"/></filter><filter id="p" width="39.409" height="43.623" x="32.919" y="11.36" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17286" stdDeviation="4.596"/></filter></defs></svg>
@@ -0,0 +1,9 @@
1
+ import React from 'react'
2
+
3
+ function Aside() {
4
+ return (
5
+ <div>Aside</div>
6
+ )
7
+ }
8
+
9
+ export default Aside
@@ -0,0 +1,100 @@
1
+ // ═══════════════════════════════════════════════════════════════════════════
2
+ // 🔘 BUTTON — Reusable button with config-driven defaults
3
+ // ═══════════════════════════════════════════════════════════════════════════
4
+ //
5
+ // HOW TO USE:
6
+ // <Button onClick={...}>Click me</Button>
7
+ // <Button variant="danger" size="lg">Delete</Button>
8
+ // <Button loading icon={<Save />}>Save</Button>
9
+ //
10
+ // PROPS:
11
+ // variant: 'primary' | 'dark' | 'danger' | 'outline' | 'ghost' | 'success'
12
+ // size: 'xs' | 'sm' | 'md' | 'lg'
13
+ // loading: show spinner instead of icon
14
+ // icon: icon component to show on the left
15
+ // iconRight: icon component to show on the right
16
+ // fullWidth: make button fill container width
17
+ // className: additional CSS classes
18
+ //
19
+ // CONFIG INTEGRATION:
20
+ // - Rounded corners come from config.js → --radius CSS variable
21
+ // - Primary color from config.js theme
22
+ //
23
+ // ═══════════════════════════════════════════════════════════════════════════
24
+
25
+ import React from 'react';
26
+ import { Loader2 } from 'lucide-react';
27
+ import { config } from '../config';
28
+ import { getRoundedClass } from '../design';
29
+
30
+ const BASE =
31
+ 'inline-flex items-center justify-center gap-2 font-medium ' +
32
+ 'transition-all duration-200 focus:outline-none focus:ring-2 focus:ring-offset-1 ' +
33
+ 'disabled:opacity-50 disabled:cursor-not-allowed select-none';
34
+
35
+ const VARIANTS = {
36
+ primary:
37
+ 'text-white hover:opacity-90 active:scale-[0.98] focus:ring-[var(--color-primary)]',
38
+ dark:
39
+ 'bg-black text-white hover:bg-gray-900 focus:ring-gray-600 active:scale-[0.98]',
40
+ danger:
41
+ 'bg-red-500 text-white hover:bg-red-600 focus:ring-red-400 active:scale-[0.98]',
42
+ outline:
43
+ 'border text-gray-600 bg-white hover:bg-gray-50 focus:ring-gray-300 active:scale-[0.98]',
44
+ ghost:
45
+ 'text-gray-600 hover:bg-gray-100 focus:ring-gray-200 active:scale-[0.98]',
46
+ success:
47
+ 'bg-emerald-500 text-white hover:bg-emerald-600 focus:ring-emerald-400 active:scale-[0.98]',
48
+ };
49
+
50
+ const SIZES = {
51
+ xs: 'text-[11px] px-2.5 py-1',
52
+ sm: 'text-[12px] px-3 py-1.5',
53
+ md: 'text-[13px] px-4 py-2',
54
+ lg: 'text-[14px] px-5 py-2.5',
55
+ };
56
+
57
+ export default function Button({
58
+ children,
59
+ variant = 'primary',
60
+ size = 'md',
61
+ loading = false,
62
+ icon,
63
+ iconRight,
64
+ fullWidth = false,
65
+ className = '',
66
+ disabled,
67
+ ...rest
68
+ }) {
69
+ // ─── Get rounded class from config ────────────────────────────────────────
70
+ const roundClass = getRoundedClass(config.rounded);
71
+
72
+ // ─── Primary variant gets its background from CSS variable ─────────────────
73
+ const variantStyle =
74
+ variant === 'primary'
75
+ ? { backgroundColor: 'var(--color-primary)' }
76
+ : {};
77
+
78
+ // ─── Outline variant gets its border color from CSS variable ───────────────
79
+ const borderStyle =
80
+ variant === 'outline'
81
+ ? { borderColor: 'var(--color-border)' }
82
+ : {};
83
+
84
+ return (
85
+ <button
86
+ className={`${BASE} ${VARIANTS[variant] ?? VARIANTS.primary} ${SIZES[size] ?? SIZES.md} ${fullWidth ? 'w-full' : ''} ${roundClass} ${className}`}
87
+ style={{ ...variantStyle, ...borderStyle }}
88
+ disabled={disabled || loading}
89
+ {...rest}
90
+ >
91
+ {loading ? (
92
+ <Loader2 className="w-4 h-4 animate-spin" />
93
+ ) : icon ? (
94
+ <span className="w-4 h-4 flex-shrink-0">{icon}</span>
95
+ ) : null}
96
+ {children}
97
+ {!loading && iconRight && <span className="w-4 h-4 flex-shrink-0">{iconRight}</span>}
98
+ </button>
99
+ );
100
+ }