feat: add AddUrlDialog component and keyboard shortcut for adding URLs
This commit is contained in:
@@ -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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user