feat(folders): Tabs für Unterordner + rekursive Sound-Liste; Play mit relativePath; UI-Tabs

This commit is contained in:
vibe-bot 2025-08-08 01:56:30 +02:00
parent 24de686a54
commit f9bec8b5a1
5 changed files with 85 additions and 16 deletions

View file

@ -2,7 +2,7 @@ import type { Sound, SoundsResponse, VoiceChannelInfo } from './types';
const API_BASE = import.meta.env.VITE_API_BASE_URL || '/api';
export async function fetchSounds(q?: string): Promise<SoundsResponse> {
export async function fetchSounds(q?: string, folderKey?: string): Promise<SoundsResponse> {
const url = new URL(`${API_BASE}/sounds`, window.location.origin);
if (q) url.searchParams.set('q', q);
const res = await fetch(url.toString());
@ -16,11 +16,11 @@ export async function fetchChannels(): Promise<VoiceChannelInfo[]> {
return res.json();
}
export async function playSound(soundName: string, guildId: string, channelId: string, volume: number): Promise<void> {
export async function playSound(soundName: string, guildId: string, channelId: string, volume: number, relativePath?: string): Promise<void> {
const res = await fetch(`${API_BASE}/play`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ soundName, guildId, channelId, volume })
body: JSON.stringify({ soundName, guildId, channelId, volume, relativePath })
});
if (!res.ok) {
const data = await res.json().catch(() => ({}));