From ecf06122053f2167eef0f6d66416cd25eb62d3e4 Mon Sep 17 00:00:00 2001 From: Harun CAN Date: Mon, 11 May 2026 08:00:13 +0200 Subject: [PATCH] main --- .../dashboard/tools/voicebox/page.tsx | 20 ++++++++++++++++++- src/services/voiceboxApi.ts | 10 ++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/app/[locale]/(dashboard)/dashboard/tools/voicebox/page.tsx b/src/app/[locale]/(dashboard)/dashboard/tools/voicebox/page.tsx index 2e27c89..b977d84 100644 --- a/src/app/[locale]/(dashboard)/dashboard/tools/voicebox/page.tsx +++ b/src/app/[locale]/(dashboard)/dashboard/tools/voicebox/page.tsx @@ -3,7 +3,7 @@ import React, { useState, useEffect } from 'react'; import { motion, AnimatePresence } from 'framer-motion'; import { voiceboxApi } from '@/services/voiceboxApi'; -import { Play, Download, Mic, Settings2, Loader2, Sparkles, Volume2, AlertTriangle, History, Clock, ChevronDown, ChevronUp } from 'lucide-react'; +import { Play, Download, Mic, Settings2, Loader2, Sparkles, Volume2, AlertTriangle, History, Clock, ChevronDown, ChevronUp, Trash2 } from 'lucide-react'; export default function VoiceBoxStudio() { const [text, setText] = useState(''); @@ -105,6 +105,17 @@ export default function VoiceBoxStudio() { document.body.removeChild(a); }; + const handleDeleteHistory = async (id: string) => { + if (!confirm('Bu geçmiş kaydını silmek istediğinize emin misiniz?')) return; + + try { + await voiceboxApi.deleteHistory(id); + setHistoryItems(prev => prev.filter(item => item.id !== id)); + } catch (error) { + alert('Kayıt silinirken bir hata oluştu.'); + } + }; + const insertTag = (tag: string) => { setText((prev) => (prev ? `${prev} ${tag}` : tag)); }; @@ -389,6 +400,13 @@ export default function VoiceBoxStudio() { > + )) diff --git a/src/services/voiceboxApi.ts b/src/services/voiceboxApi.ts index c1599b1..7ca6e1a 100644 --- a/src/services/voiceboxApi.ts +++ b/src/services/voiceboxApi.ts @@ -58,6 +58,16 @@ export const voiceboxApi = { } }, + deleteHistory: async (id: string) => { + try { + const response = await clientMap.core.delete(`/voicebox/history/${id}`); + return response.data; + } catch (error) { + console.error(`Error deleting VoiceBox history for ${id}:`, error); + throw error; + } + }, + getAudioUrl: (generationId: string) => { // API endpoint for `