diff --git a/app/Http/Controllers/GalleryController.php b/app/Http/Controllers/GalleryController.php index 003c17a..4d9472c 100644 --- a/app/Http/Controllers/GalleryController.php +++ b/app/Http/Controllers/GalleryController.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers; +use App\Models\Song; use Illuminate\Http\Request; use Inertia\Inertia; @@ -9,6 +10,8 @@ class GalleryController extends Controller { public function index() { - return Inertia::render('Gallery'); + return Inertia::render('Gallery', [ + 'songs' => Song::all(), + ]); } } diff --git a/resources/js/Pages/Gallery.tsx b/resources/js/Pages/Gallery.tsx index 561a5f2..8dc9d05 100644 --- a/resources/js/Pages/Gallery.tsx +++ b/resources/js/Pages/Gallery.tsx @@ -4,31 +4,10 @@ import PrimaryButton from '@/Components/PrimaryButton'; import Reproductor from '@/Components/Reproductor'; import SecondaryButton from '@/Components/SecondaryButton'; import Authenticated from '@/Layouts/AuthenticatedLayout'; +import { Cancion } from '@/types/types'; import { useState } from 'react'; -export default function Gallery() { - const songs = [ - { - id: 1, - title: 'Song 1', - artist: 'Artist 1', - coverArt: - 'https://duckduckgo.com/?q=Metallica%20American%20heavy%20metal%20band&ia=images&iax=images', - }, - { - id: 2, - title: 'Song 2', - artist: 'Artist 2', - coverArt: '/images/song2.jpg', - }, - { - id: 3, - title: 'Song 3', - artist: 'Artist 3', - coverArt: '/images/song3.jpg', - }, - ]; - +export default function Gallery({ songs }: { songs: Cancion[] }) { const [progress, setProgress] = useState(0); const [isPlaying, setIsPlaying] = useState(false); const [cancionSeleccionada, setCancion] = useState({ title: '' }); @@ -40,16 +19,16 @@ export default function Gallery() { } > -
| Nombre |
|---|