From 0ea7ba1a392cd1576f62d772e8c39201ca959ea5 Mon Sep 17 00:00:00 2001 From: Sam Liu Date: Thu, 6 Jun 2024 11:10:24 +0000 Subject: [PATCH] split route and navbar --- README.md | 7 ++++ frontend/package.json | 3 ++ frontend/src/components/Navbar/Navbar.jsx | 27 ++++++++++-- frontend/src/pages/Home.jsx | 5 +-- frontend/src/pages/WareHouse.jsx | 4 +- frontend/src/routes/routes.js | 51 +++++++---------------- frontend/vite.config.js | 11 ++--- 7 files changed, 58 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index 4231480..c0a2a69 100644 --- a/README.md +++ b/README.md @@ -18,12 +18,19 @@ install `Taskfile` first with this command line: ```bash npm install -g @go-task/cli ``` +more information : [Link](https://taskfile.dev/installation/) install `pnpm` for front-end with command line: ```bash npm i pnpm -g ``` +install `poetry` for back-end with command line: +```bash +curl -sSL https://install.python-poetry.org | python3 - +``` +for more information please see here : [Link](https://python-poetry.org/docs/#installing-with-the-official-installer) + # Common CLI ### alembic diff --git a/frontend/package.json b/frontend/package.json index 41b8677..8f060a4 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -3,6 +3,9 @@ "private": true, "version": "0.0.0", "type": "module", + "engines": { + "node": ">=18.20.2" + }, "scripts": { "dev": "vite", "build": "vite build", diff --git a/frontend/src/components/Navbar/Navbar.jsx b/frontend/src/components/Navbar/Navbar.jsx index c6031f1..bfeb854 100644 --- a/frontend/src/components/Navbar/Navbar.jsx +++ b/frontend/src/components/Navbar/Navbar.jsx @@ -1,12 +1,33 @@ import { useSiteContext } from '@context/SiteContext' import useAuth from '@hooks/useAuth' -import { NAV_ROUTES } from '@routes/routes' +import useLanguage from '@hooks/useLanguage' import { A } from '@solidjs/router' -import { IconLogout, IconTriangle } from '@tabler/icons-solidjs' +import { IconDashboard, IconLogout, IconTriangle } from '@tabler/icons-solidjs' +import UserHelper from '@utils/auth' import { For, Show } from 'solid-js' import { Dynamic } from 'solid-js/web' import './navbar.scss' +const language = useLanguage() +const userHelper = new UserHelper() + +console.log(userHelper.isAdmin) + +const NAV_ITEM = [ + { + path: '/dashboard', + show: false, + icon: IconDashboard, + text: language?.ui.dashboard, + }, + { + path: '/ware-house', + show: true, + icon: IconDashboard, + text: language?.ui.houses, + }, +] + export default function Navbar() { const { store, setAuth } = useSiteContext() const { clickLogOut } = useAuth(setAuth) @@ -49,7 +70,7 @@ export default function Navbar() {