From 222581c6a3a8f95091f11848e6f86a75148797b6 Mon Sep 17 00:00:00 2001 From: parsaaghayi Date: Fri, 12 Jun 2026 13:34:09 +0330 Subject: [PATCH] feat: setup admin layout and base routing --- frontend/admin-panel/src/App.tsx | 134 +++--------------- .../admin-panel/src/components/Layout.tsx | 17 +++ .../admin-panel/src/components/Sidebar.tsx | 52 +++++++ .../admin-panel/src/components/Topbar.tsx | 34 +++++ frontend/admin-panel/src/pages/Dashboard.tsx | 40 ++++++ 5 files changed, 160 insertions(+), 117 deletions(-) create mode 100644 frontend/admin-panel/src/components/Layout.tsx create mode 100644 frontend/admin-panel/src/components/Sidebar.tsx create mode 100644 frontend/admin-panel/src/components/Topbar.tsx create mode 100644 frontend/admin-panel/src/pages/Dashboard.tsx diff --git a/frontend/admin-panel/src/App.tsx b/frontend/admin-panel/src/App.tsx index a66b5ef..4dc32b5 100644 --- a/frontend/admin-panel/src/App.tsx +++ b/frontend/admin-panel/src/App.tsx @@ -1,122 +1,22 @@ -import { useState } from 'react' -import reactLogo from './assets/react.svg' -import viteLogo from './assets/vite.svg' -import heroImg from './assets/hero.png' -import './App.css' +import { BrowserRouter, Routes, Route } from 'react-router-dom'; +import Layout from './components/Layout'; +import Dashboard from './pages/Dashboard'; function App() { - const [count, setCount] = useState(0) - return ( - <> -
-
- - React logo - Vite logo -
-
-

Get started

-

- Edit src/App.tsx and save to test HMR -

-
- -
- -
- -
-
- -

Documentation

-

Your questions, answered

- -
-
- -

Connect with us

-

Join the Vite community

- -
-
- -
-
- - ) + + + }> + } /> + مدیریت کاربران} /> + مدیریت محصولات} /> + مدیریت سفارشات} /> + کدهای تخفیف} /> + تنظیمات سیستم} /> + + + + ); } -export default App +export default App; diff --git a/frontend/admin-panel/src/components/Layout.tsx b/frontend/admin-panel/src/components/Layout.tsx new file mode 100644 index 0000000..1a35f1a --- /dev/null +++ b/frontend/admin-panel/src/components/Layout.tsx @@ -0,0 +1,17 @@ +import { Outlet } from 'react-router-dom'; +import Sidebar from './Sidebar'; +import Topbar from './Topbar'; + +export default function Layout() { + return ( +
+ +
+ +
+ +
+
+
+ ); +} diff --git a/frontend/admin-panel/src/components/Sidebar.tsx b/frontend/admin-panel/src/components/Sidebar.tsx new file mode 100644 index 0000000..af68070 --- /dev/null +++ b/frontend/admin-panel/src/components/Sidebar.tsx @@ -0,0 +1,52 @@ +import { Link, useLocation } from 'react-router-dom'; +import { Home, Users, ShoppingBag, ShoppingCart, Tag, Settings, LogOut } from 'lucide-react'; + +const menuItems = [ + { icon: Home, label: 'داشبورد', path: '/' }, + { icon: Users, label: 'کاربران', path: '/users' }, + { icon: ShoppingBag, label: 'محصولات', path: '/products' }, + { icon: ShoppingCart, label: 'سفارشات', path: '/orders' }, + { icon: Tag, label: 'تخفیف‌ها', path: '/coupons' }, + { icon: Settings, label: 'تنظیمات', path: '/settings' }, +]; + +export default function Sidebar() { + const location = useLocation(); + + return ( + + ); +} diff --git a/frontend/admin-panel/src/components/Topbar.tsx b/frontend/admin-panel/src/components/Topbar.tsx new file mode 100644 index 0000000..91bdb5b --- /dev/null +++ b/frontend/admin-panel/src/components/Topbar.tsx @@ -0,0 +1,34 @@ +import { Bell, Search, UserCircle } from 'lucide-react'; + +export default function Topbar() { + return ( +
+
+
+
+ +
+ +
+
+ +
+ +
+
+

مدیر سیستم

+

ادمین ارشد

+
+ +
+
+
+ ); +} diff --git a/frontend/admin-panel/src/pages/Dashboard.tsx b/frontend/admin-panel/src/pages/Dashboard.tsx new file mode 100644 index 0000000..a5a58e9 --- /dev/null +++ b/frontend/admin-panel/src/pages/Dashboard.tsx @@ -0,0 +1,40 @@ +import { DollarSign, ShoppingCart, Users, Activity } from 'lucide-react'; + +export default function Dashboard() { + const stats = [ + { title: 'درآمد کل', value: '۴۵,۰۰۰,۰۰۰ تومان', icon: DollarSign, color: 'text-green-600', bg: 'bg-green-100' }, + { title: 'سفارشات جدید', value: '۱۲', icon: ShoppingCart, color: 'text-blue-600', bg: 'bg-blue-100' }, + { title: 'کاربران فعال', value: '۱,۰۲۴', icon: Users, color: 'text-purple-600', bg: 'bg-purple-100' }, + { title: 'بازدید امروز', value: '۳۴۲', icon: Activity, color: 'text-orange-600', bg: 'bg-orange-100' }, + ]; + + return ( +
+
+

داشبورد

+

خلاصه‌ای از وضعیت فروشگاه کانی‌نا

+
+ +
+ {stats.map((stat, i) => { + const Icon = stat.icon; + return ( +
+
+ +
+
+

{stat.title}

+

{stat.value}

+
+
+ ); + })} +
+ +
+

بخش نمودارها (در فاز بعدی اضافه می‌شود)

+
+
+ ); +}