init
This commit is contained in:
1
src-tauri/src/app/mod.rs
Normal file
1
src-tauri/src/app/mod.rs
Normal file
@@ -0,0 +1 @@
|
|||||||
|
mod ox_speak_app;
|
||||||
14
src-tauri/src/app/ox_speak_app.rs
Normal file
14
src-tauri/src/app/ox_speak_app.rs
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
use tauri::AppHandle;
|
||||||
|
|
||||||
|
pub struct OxSpeakApp {
|
||||||
|
tauri_handle: AppHandle
|
||||||
|
}
|
||||||
|
|
||||||
|
impl OxSpeakApp {
|
||||||
|
pub async fn new(tauri_handle: AppHandle) -> Self {
|
||||||
|
|
||||||
|
Self {
|
||||||
|
tauri_handle
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
0
src-tauri/src/audio/microphone/mod.rs
Normal file
0
src-tauri/src/audio/microphone/mod.rs
Normal file
0
src-tauri/src/audio/mod.rs
Normal file
0
src-tauri/src/audio/mod.rs
Normal file
0
src-tauri/src/audio/speaker/mod.rs
Normal file
0
src-tauri/src/audio/speaker/mod.rs
Normal file
@@ -14,3 +14,4 @@ pub fn run() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mod utils;
|
mod utils;
|
||||||
|
mod app;
|
||||||
0
src-tauri/src/network/http/mod.rs
Normal file
0
src-tauri/src/network/http/mod.rs
Normal file
0
src-tauri/src/network/mod.rs
Normal file
0
src-tauri/src/network/mod.rs
Normal file
0
src-tauri/src/network/udp/mod.rs
Normal file
0
src-tauri/src/network/udp/mod.rs
Normal file
0
src-tauri/src/network/ws/mod.rs
Normal file
0
src-tauri/src/network/ws/mod.rs
Normal file
48
src/App.vue
48
src/App.vue
@@ -1,8 +1,15 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import {listen} from "@tauri-apps/api/event";
|
import {listen} from "@tauri-apps/api/event";
|
||||||
import {onMounted, onUnmounted, ref, Ref} from 'vue';
|
import {onMounted, onUnmounted, ref} from 'vue';
|
||||||
import {NavigationMenuItem} from "@nuxt/ui";
|
import {NavigationMenuItem} from "@nuxt/ui";
|
||||||
|
|
||||||
|
// vars
|
||||||
|
let unlisten: (() => void) | null = null;
|
||||||
|
const servers = ref<NavigationMenuItem[]>([
|
||||||
|
{ label: 'Main Canal', to: '/', icon: 'i-lucide-house'},
|
||||||
|
])
|
||||||
|
|
||||||
|
// methods
|
||||||
const getInitials = (name: string) => {
|
const getInitials = (name: string) => {
|
||||||
return name
|
return name
|
||||||
.split(' ')
|
.split(' ')
|
||||||
@@ -12,21 +19,42 @@ const getInitials = (name: string) => {
|
|||||||
.toUpperCase();
|
.toUpperCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
const servers = ref<NavigationMenuItem[]>([
|
async function fetchServers() {
|
||||||
{ label: 'Main Canal', to: '/', icon: 'i-lucide-house'},
|
// todo : Cette méthode devra appeler la liste des serveurs via le "proxy" rust
|
||||||
{ label: "Alpha", to: "/server/d6e1a762-8d70-4bfc-bbca-07c19af7a4ab", avatar: {text: getInitials("Alpha"),}},
|
const response = await fetch("http://localhost:7000/api/server/servers/")
|
||||||
{ label: "Bravo", to: "/server/ef08f718-58ee-402f-8fe6-34c76665e61d", avatar: {text: getInitials("Bravo"),}}
|
if (!response.ok) {
|
||||||
])
|
throw new Error(`HTTP error! status: ${response.status}`);
|
||||||
|
}
|
||||||
|
let data = await response.json()
|
||||||
|
data.forEach(server => {
|
||||||
|
servers.value.push({
|
||||||
|
label: server.name,
|
||||||
|
to: `/server/${server.id}`, avatar: {text: getInitials(server.name)}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// const servers = ref<NavigationMenuItem[]>([
|
||||||
|
// { label: 'Main Canal', to: '/', icon: 'i-lucide-house'},
|
||||||
|
// { label: "Alpha", to: "/server/d6e1a762-8d70-4bfc-bbca-07c19af7a4ab", avatar: {text: getInitials("Alpha"),}},
|
||||||
|
// { label: "Bravo", to: "/server/ef08f718-58ee-402f-8fe6-34c76665e61d", avatar: {text: getInitials("Bravo"),}}
|
||||||
|
// ])
|
||||||
|
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
const unlisten = await listen("app-ready", event => {
|
// tauri
|
||||||
console.log("App is ready", event)
|
// unlisten = await listen("app-ready", event => {
|
||||||
|
// console.log("App is ready", event)
|
||||||
|
// })
|
||||||
|
|
||||||
|
// fetch servers
|
||||||
|
await fetchServers()
|
||||||
})
|
})
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
unlisten()
|
// if (unlisten) unlisten()
|
||||||
})
|
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -13,8 +13,13 @@ const router = createRouter({
|
|||||||
{
|
{
|
||||||
path: '/server/:server_id',
|
path: '/server/:server_id',
|
||||||
component: () => import('./pages/server_detail.vue'),
|
component: () => import('./pages/server_detail.vue'),
|
||||||
|
props: true,
|
||||||
children: [
|
children: [
|
||||||
{ path: 'channel/:channel_id', component: () => import('./pages/channel_detail.vue') },
|
{
|
||||||
|
path: 'channel/:channel_id',
|
||||||
|
component: () => import('./pages/channel_detail.vue'),
|
||||||
|
props: true
|
||||||
|
},
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useRoute } from 'vue-router'
|
|
||||||
import { computed } from 'vue'
|
|
||||||
|
|
||||||
// routes
|
// routes
|
||||||
const route = useRoute()
|
const props = defineProps<{
|
||||||
const server_id = route.params.server_id
|
server_id: string,
|
||||||
const channel_id = computed(() => route.params.channel_id)
|
channel_id: string,
|
||||||
|
}>()
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,59 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { useRoute } from 'vue-router'
|
import {ref, computed, onMounted} from 'vue';
|
||||||
import {ref, computed} from 'vue';
|
|
||||||
import {NavigationMenuItem} from "@nuxt/ui";
|
import {NavigationMenuItem} from "@nuxt/ui";
|
||||||
|
|
||||||
const route = useRoute()
|
// vars
|
||||||
const server_id = computed(() => route.params.server_id)
|
const props = defineProps<{
|
||||||
|
server_id: string
|
||||||
|
}>()
|
||||||
|
const channels = ref<NavigationMenuItem[]>([])
|
||||||
|
|
||||||
const channels = ref<NavigationMenuItem[]>([
|
// methods
|
||||||
{ label: 'Channel 1', to: `/server/${server_id}/channel/c201ad7d-6634-4767-b260-9ec0827b91d4`},
|
async function fetchTree(){
|
||||||
{ label: "Channel 2", to: `/server/${server_id}/channel/939c0491-ee9b-426a-b1c2-fbc0d0a1a49c`},
|
const response = await fetch(`http://localhost:7000/api/server/servers/${props.server_id}/tree/`)
|
||||||
{ label: "Channel 3", to: `/server/${server_id}/channel/4fd367fd-3d32-4953-9794-d4d2235dfe33`}
|
let data = await response.json()
|
||||||
])
|
|
||||||
|
const formattedChannels: any[] = []
|
||||||
|
|
||||||
|
data.forEach(el => {
|
||||||
|
if (el.type === "category") {
|
||||||
|
// On crée un groupe pour la catégorie
|
||||||
|
const categoryGroup = {
|
||||||
|
label: el.name.toUpperCase(),
|
||||||
|
type: 'label', // Nuxt UI utilisera ceci comme un label non cliquable
|
||||||
|
children: el.channels.map((ch: any) => ({
|
||||||
|
label: ch.name,
|
||||||
|
icon: 'i-heroicons-hashtag', // Un petit hash pour le style
|
||||||
|
to: `/server/${props.server_id}/channel/${ch.id}`
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
formattedChannels.push(categoryGroup)
|
||||||
|
} else if (el.type === "channel") {
|
||||||
|
// Pour les "orphelins" (ceux sans catégorie), on les met à la racine
|
||||||
|
formattedChannels.push({
|
||||||
|
label: el.name,
|
||||||
|
icon: 'i-heroicons-hashtag',
|
||||||
|
to: `/server/${props.server_id}/channel/${el.id}`
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
channels.value = formattedChannels
|
||||||
|
}
|
||||||
|
|
||||||
|
// const channels = ref<NavigationMenuItem[]>([
|
||||||
|
// { label: 'Channel 1', to: `/server/${server_id}/channel/c201ad7d-6634-4767-b260-9ec0827b91d4`},
|
||||||
|
// { label: "Channel 2", to: `/server/${server_id}/channel/939c0491-ee9b-426a-b1c2-fbc0d0a1a49c`},
|
||||||
|
// { label: "Channel 3", to: `/server/${server_id}/channel/4fd367fd-3d32-4953-9794-d4d2235dfe33`}
|
||||||
|
// ])
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
fetchTree()
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<UDashboardSidebar>
|
<UDashboardSidebar :default-size="20">
|
||||||
<template #default>
|
<template #default>
|
||||||
<UNavigationMenu
|
<UNavigationMenu
|
||||||
:items="channels"
|
:items="channels"
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ export default defineConfig(async () => ({
|
|||||||
port: 1420,
|
port: 1420,
|
||||||
strictPort: true,
|
strictPort: true,
|
||||||
host: host || false,
|
host: host || false,
|
||||||
|
cors: true,
|
||||||
hmr: host
|
hmr: host
|
||||||
? {
|
? {
|
||||||
protocol: "ws",
|
protocol: "ws",
|
||||||
|
|||||||
Reference in New Issue
Block a user