feat: add AddUrlDialog component and keyboard shortcut for adding URLs
Some checks failed
Frontend CI / lint (push) Failing after 5m6s
Frontend CI / build (push) Has been skipped

This commit is contained in:
JSC
2025-07-06 16:57:41 +02:00
parent 44c9c204f6
commit 3fad1d773e
4 changed files with 357 additions and 1 deletions

View File

@@ -1,9 +1,11 @@
import React, { useState, useEffect } from 'react';
import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card';
import { Button } from '@/components/ui/button';
import { Play, Square, Volume2 } from 'lucide-react';
import { Play, Square, Volume2, Plus } from 'lucide-react';
import { toast } from 'sonner';
import { apiService } from '@/services/api';
import { AddUrlDialog } from '@/components/AddUrlDialog';
import { useAddUrlShortcut } from '@/hooks/use-keyboard-shortcuts';
interface Sound {
id: number;
@@ -75,6 +77,10 @@ export function SoundboardPage() {
const [error, setError] = useState<string | null>(null);
const [playingSound, setPlayingSound] = useState<number | null>(null);
const [searchTerm, setSearchTerm] = useState('');
const [addUrlDialogOpen, setAddUrlDialogOpen] = useState(false);
// Setup keyboard shortcut for CTRL+U
useAddUrlShortcut(() => setAddUrlDialogOpen(true));
useEffect(() => {
fetchSounds();
@@ -162,6 +168,15 @@ export function SoundboardPage() {
<div className="flex items-center justify-between">
<h1 className="text-2xl font-bold">Soundboard</h1>
<div className="flex gap-2">
<Button
onClick={() => setAddUrlDialogOpen(true)}
variant="outline"
size="sm"
title="Add URL (Ctrl+U)"
>
<Plus size={16} className="mr-2" />
Add URL
</Button>
<Button onClick={handleStopAll} variant="outline" size="sm">
<Square size={16} className="mr-2" />
Stop All
@@ -206,6 +221,12 @@ export function SoundboardPage() {
</div>
</div>
)}
{/* Add URL Dialog */}
<AddUrlDialog
open={addUrlDialogOpen}
onOpenChange={setAddUrlDialogOpen}
/>
</div>
);
}