split route and navbar
This commit is contained in:
parent
56fc427eae
commit
0ea7ba1a39
@ -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
|
||||
|
@ -3,6 +3,9 @@
|
||||
"private": true,
|
||||
"version": "0.0.0",
|
||||
"type": "module",
|
||||
"engines": {
|
||||
"node": ">=18.20.2"
|
||||
},
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build",
|
||||
|
@ -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() {
|
||||
</div>
|
||||
</Show>
|
||||
<ul class="scrollnavbar menu p-4 w-80 text-base-content py-6 px-4">
|
||||
<For each={NAV_ROUTES}>
|
||||
<For each={NAV_ITEM}>
|
||||
{(item) =>
|
||||
item.show && (
|
||||
<li class="mb-2">
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { NAV_ROUTES } from '@routes/routes'
|
||||
import { useNavigate } from '@solidjs/router'
|
||||
import { onMount } from 'solid-js'
|
||||
|
||||
@ -6,8 +5,8 @@ export default function Home() {
|
||||
const navigate = useNavigate()
|
||||
|
||||
onMount(() => {
|
||||
const first = NAV_ROUTES.filter((item) => item.show)[0]?.path || '/me'
|
||||
navigate(first, { replace: true })
|
||||
// const first = NAV_ROUTES.filter((item) => item.show)[0]?.path || '/me'
|
||||
navigate('/me', { replace: true })
|
||||
})
|
||||
|
||||
return <></>
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { NAV_ROUTES } from '@routes/routes'
|
||||
import { useNavigate } from '@solidjs/router'
|
||||
import { onMount } from 'solid-js'
|
||||
|
||||
@ -6,8 +5,7 @@ export default function WareHouse() {
|
||||
const navigate = useNavigate()
|
||||
|
||||
onMount(() => {
|
||||
const first = NAV_ROUTES.filter((item) => item.show)[0]?.path || '/me'
|
||||
navigate(first, { replace: true })
|
||||
navigate('/me', { replace: true })
|
||||
})
|
||||
|
||||
return <></>
|
||||
|
@ -1,47 +1,26 @@
|
||||
import useLanguage from '@hooks/useLanguage'
|
||||
import { IconDashboard } from '@tabler/icons-solidjs'
|
||||
import UserHelper from '@utils/auth'
|
||||
import { lazy } from 'solid-js'
|
||||
|
||||
const language = useLanguage()
|
||||
const userHelper = new UserHelper()
|
||||
|
||||
console.log(userHelper.isAdmin)
|
||||
|
||||
export const NAV_ROUTES = [
|
||||
{
|
||||
path: '/dashboard',
|
||||
components: lazy(() => import('@pages/Dashboard')),
|
||||
filter: {},
|
||||
show: false,
|
||||
icon: IconDashboard,
|
||||
text: language?.ui.dashboard,
|
||||
},
|
||||
{
|
||||
path: '/profile',
|
||||
components: lazy(() => import('@pages/Profile')),
|
||||
filter: {},
|
||||
show: true,
|
||||
icon: IconDashboard,
|
||||
text: language?.ui.profile,
|
||||
},
|
||||
{
|
||||
path: '/ware-house',
|
||||
components: lazy(() => import('@pages/WareHouse')),
|
||||
filter: {},
|
||||
show: true,
|
||||
icon: IconDashboard,
|
||||
text: language?.ui.houses,
|
||||
},
|
||||
]
|
||||
|
||||
export const ROUTES = [
|
||||
{
|
||||
path: '/',
|
||||
components: lazy(() => import('@pages/Home')),
|
||||
filter: {},
|
||||
},
|
||||
...NAV_ROUTES,
|
||||
{
|
||||
path: '/dashboard',
|
||||
components: lazy(() => import('@pages/Dashboard')),
|
||||
filter: {},
|
||||
},
|
||||
{
|
||||
path: '/profile',
|
||||
components: lazy(() => import('@pages/Profile')),
|
||||
filter: {},
|
||||
},
|
||||
{
|
||||
path: '/ware-house',
|
||||
components: lazy(() => import('@pages/WareHouse')),
|
||||
filter: {},
|
||||
},
|
||||
{
|
||||
path: '/me',
|
||||
components: lazy(() => import('@pages/Profile')),
|
||||
|
@ -1,7 +1,7 @@
|
||||
import path, { dirname } from 'path'
|
||||
import { fileURLToPath } from 'url'
|
||||
import { defineConfig, loadEnv } from 'vite'
|
||||
import mkcert from 'vite-plugin-mkcert'
|
||||
// import mkcert from 'vite-plugin-mkcert'
|
||||
import solid from 'vite-plugin-solid'
|
||||
|
||||
const _dirname = dirname(fileURLToPath(import.meta.url))
|
||||
@ -28,9 +28,9 @@ export default defineConfig(({ mode }) => {
|
||||
'@context': path.resolve(_dirname, './src/context'),
|
||||
},
|
||||
},
|
||||
plugins: [solid(), mkcert()],
|
||||
plugins: [solid()],
|
||||
server: {
|
||||
https: true,
|
||||
https: false,
|
||||
host: true,
|
||||
port: 5001,
|
||||
strictPort: true,
|
||||
@ -56,9 +56,10 @@ export default defineConfig(({ mode }) => {
|
||||
'@context': path.resolve(_dirname, './src/context'),
|
||||
},
|
||||
},
|
||||
plugins: [solid(), mkcert()],
|
||||
// plugins: [solid(), mkcert()],
|
||||
plugins: [solid()],
|
||||
server: {
|
||||
https: true,
|
||||
https: false,
|
||||
host: true,
|
||||
port: 5001,
|
||||
strictPort: true,
|
||||
|
Loading…
x
Reference in New Issue
Block a user