feat(app): Added sidebar navigation and new page routes

- Added Nodes and Settings page routes
- Updated component import paths
- Imported database connection dependencies
This commit is contained in:
2025-10-10 09:09:19 +08:00
parent 4aba63cb93
commit 2a18061700
11 changed files with 96 additions and 32 deletions

View File

@@ -22,4 +22,6 @@ tauri = { version = "2", features = [] }
tauri-plugin-opener = "2" tauri-plugin-opener = "2"
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
serde_json = "1" serde_json = "1"
sea-orm = { version = "2.0.0-rc", features = [ "sqlx-sqlite", "runtime-tokio-native-tls", "macros" ] }
once_cell = "1.21.3"

0
src-tauri/src/entity.rs Normal file
View File

View File

@@ -1,6 +1,14 @@
// Prevents additional console window on Windows in release, DO NOT REMOVE!! // Prevents additional console window on Windows in release, DO NOT REMOVE!!
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] #![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
use once_cell::sync::OnceCell;
use sea_orm::DatabaseConnection;
mod entity;
static DB: OnceCell<DatabaseConnection> = OnceCell::new();
fn main() { fn main() {
spary_lib::run() spary_lib::run()
} }

View File

@@ -15,6 +15,11 @@
"title": "spary", "title": "spary",
"width": 800, "width": 800,
"height": 600 "height": 600
},
{
"title": "addGroup",
"width": 800,
"height": 600
} }
], ],
"security": { "security": {

View File

@@ -1,11 +1,59 @@
<template> <template>
<v-app> <v-app>
<v-main> <v-main>
<router-view /> <v-card class="fill-height">
<v-layout class="fill-height">
<v-navigation-drawer
expand-on-hover
permanent
rail
v-model="drawer"
>
<v-list>
<v-list-item
prepend-avatar="/src/assets/logo.svg"
subtitle=""
title="Spary"
></v-list-item>
</v-list>
<v-divider></v-divider>
<v-list density="compact" nav>
<v-list-item
prepend-icon="mdi-just-nothing"
title="🌊"
value="spary"
@click="router.push('/')"
></v-list-item>
<v-list-item
prepend-icon="mdi-airport"
title="Nodes"
value="nodes"
@click="router.push('/nodes')"
></v-list-item>
<v-list-item
prepend-icon="mdi-cog"
title="Settings"
value="settings"
@click="router.push('/settings')"
></v-list-item>
</v-list>
</v-navigation-drawer>
<v-main style="height: 100vh">
<router-view/>
</v-main>
</v-layout>
</v-card>
</v-main> </v-main>
</v-app> </v-app>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
// import { ref } from 'vue'
import { useRouter } from 'vue-router'
const drawer = ref(true)
const router = useRouter()
</script> </script>

2
src/components.d.ts vendored
View File

@@ -10,6 +10,6 @@ declare module 'vue' {
export interface GlobalComponents { export interface GlobalComponents {
RouterLink: typeof import('vue-router')['RouterLink'] RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView'] RouterView: typeof import('vue-router')['RouterView']
Spary: typeof import('./components/spary.vue')['default'] Spary: typeof import('./components/index/spary.vue')['default']
} }
} }

View File

@@ -1,34 +1,7 @@
<template> <template>
<v-card class="fill-height"> <Spary/>
<v-layout class="fill-height">
<v-navigation-drawer
expand-on-hover
permanent
rail
>
<v-list>
<v-list-item
prepend-avatar="/src/assets/logo.svg"
subtitle=""
title="Spary"
></v-list-item>
</v-list>
<v-divider></v-divider>
<v-list density="compact" nav>
<v-list-item prepend-icon="mdi-just-nothing" title="🌊" value="spary"></v-list-item>
<v-list-item prepend-icon="mdi-cog" title="Settings" value="settings"></v-list-item>
</v-list>
</v-navigation-drawer>
<v-main style="height: 100vh">
<Spary />
</v-main>
</v-layout>
</v-card>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
// import Spary from '../components/index/spary.vue'
</script> </script>

11
src/pages/nodes.vue Normal file
View File

@@ -0,0 +1,11 @@
<script setup lang="ts">
</script>
<template>
</template>
<style scoped>
</style>

7
src/pages/settings.vue Normal file
View File

@@ -0,0 +1,7 @@
<template>
</template>
<script lang="ts" setup>
//
</script>

10
src/typed-router.d.ts vendored
View File

@@ -19,6 +19,8 @@ declare module 'vue-router/auto-routes' {
*/ */
export interface RouteNamedMap { export interface RouteNamedMap {
'/': RouteRecordInfo<'/', '/', Record<never, never>, Record<never, never>>, '/': RouteRecordInfo<'/', '/', Record<never, never>, Record<never, never>>,
'/nodes': RouteRecordInfo<'/nodes', '/nodes', Record<never, never>, Record<never, never>>,
'/settings': RouteRecordInfo<'/settings', '/settings', Record<never, never>, Record<never, never>>,
} }
/** /**
@@ -36,6 +38,14 @@ declare module 'vue-router/auto-routes' {
routes: '/' routes: '/'
views: never views: never
} }
'src/pages/nodes.vue': {
routes: '/nodes'
views: never
}
'src/pages/settings.vue': {
routes: '/settings'
views: never
}
} }
/** /**