refactor(frontend): move views into app and pages structure
Reorganize the frontend around app-level routing and page modules so the runtime and feature screens share a clearer navigation and composition layout for future work. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
21
frontend/src/app/router/index.ts
Normal file
21
frontend/src/app/router/index.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { routes } from './routes'
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes,
|
||||
})
|
||||
|
||||
router.beforeEach((to, _from, next) => {
|
||||
const auth = useAuthStore()
|
||||
if (to.meta.requiresAuth && !auth.isAuthenticated) {
|
||||
next('/login')
|
||||
} else if (to.meta.guest && auth.isAuthenticated) {
|
||||
next('/chat')
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
})
|
||||
|
||||
export default router
|
||||
80
frontend/src/app/router/routes.ts
Normal file
80
frontend/src/app/router/routes.ts
Normal file
@@ -0,0 +1,80 @@
|
||||
import type { RouteRecordRaw } from 'vue-router'
|
||||
|
||||
const appChildren: RouteRecordRaw[] = [
|
||||
{
|
||||
path: '',
|
||||
redirect: '/chat',
|
||||
},
|
||||
{
|
||||
path: 'chat',
|
||||
name: 'chat',
|
||||
component: () => import('@/pages/chat/index.vue'),
|
||||
},
|
||||
{
|
||||
path: 'knowledge',
|
||||
name: 'knowledge',
|
||||
component: () => import('@/pages/knowledge/index.vue'),
|
||||
},
|
||||
{
|
||||
path: 'graph',
|
||||
name: 'graph',
|
||||
component: () => import('@/pages/graph/index.vue'),
|
||||
},
|
||||
{
|
||||
path: 'kanban',
|
||||
name: 'kanban',
|
||||
component: () => import('@/pages/kanban/index.vue'),
|
||||
},
|
||||
{
|
||||
path: 'forum',
|
||||
name: 'forum',
|
||||
component: () => import('@/pages/forum/index.vue'),
|
||||
},
|
||||
{
|
||||
path: 'agents',
|
||||
name: 'agents',
|
||||
component: () => import('@/pages/agents/index.vue'),
|
||||
},
|
||||
{
|
||||
path: 'stats',
|
||||
name: 'stats',
|
||||
component: () => import('@/pages/stats/index.vue'),
|
||||
},
|
||||
{
|
||||
path: 'skills',
|
||||
name: 'skills',
|
||||
component: () => import('@/pages/skills/index.vue'),
|
||||
},
|
||||
{
|
||||
path: 'todo',
|
||||
name: 'todo',
|
||||
component: () => import('@/pages/todo/index.vue'),
|
||||
},
|
||||
{
|
||||
path: 'settings',
|
||||
name: 'settings',
|
||||
component: () => import('@/pages/settings/index.vue'),
|
||||
},
|
||||
{
|
||||
path: 'logs',
|
||||
name: 'logs',
|
||||
component: () => import('@/pages/logs/index.vue'),
|
||||
},
|
||||
]
|
||||
|
||||
export const routes: RouteRecordRaw[] = [
|
||||
{
|
||||
path: '/login',
|
||||
name: 'login',
|
||||
component: () => import('@/pages/login/index.vue'),
|
||||
meta: { guest: true },
|
||||
},
|
||||
{
|
||||
path: '/',
|
||||
component: () => import('@/pages/app/layout.vue'),
|
||||
meta: { requiresAuth: true },
|
||||
children: appChildren,
|
||||
},
|
||||
]
|
||||
|
||||
export { appChildren }
|
||||
Reference in New Issue
Block a user