hecho lo de galeria y arrglada tabla en songs

Signed-off-by: fede <federico.nicolas.polidoro@gmail.com>
This commit is contained in:
2025-03-27 01:15:59 -03:00
parent 55b130edad
commit b8a4cdaa6a
3 changed files with 12 additions and 29 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\Song;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Inertia\Inertia; use Inertia\Inertia;
@@ -9,6 +10,8 @@ class GalleryController extends Controller
{ {
public function index() public function index()
{ {
return Inertia::render('Gallery'); return Inertia::render('Gallery', [
'songs' => Song::all(),
]);
} }
} }

View File

@@ -4,31 +4,10 @@ import PrimaryButton from '@/Components/PrimaryButton';
import Reproductor from '@/Components/Reproductor'; import Reproductor from '@/Components/Reproductor';
import SecondaryButton from '@/Components/SecondaryButton'; import SecondaryButton from '@/Components/SecondaryButton';
import Authenticated from '@/Layouts/AuthenticatedLayout'; import Authenticated from '@/Layouts/AuthenticatedLayout';
import { Cancion } from '@/types/types';
import { useState } from 'react'; import { useState } from 'react';
export default function Gallery() { export default function Gallery({ songs }: { songs: Cancion[] }) {
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',
},
];
const [progress, setProgress] = useState(0); const [progress, setProgress] = useState(0);
const [isPlaying, setIsPlaying] = useState(false); const [isPlaying, setIsPlaying] = useState(false);
const [cancionSeleccionada, setCancion] = useState({ title: '' }); const [cancionSeleccionada, setCancion] = useState({ title: '' });
@@ -40,16 +19,16 @@ export default function Gallery() {
</h2> </h2>
} }
> >
<div className="py-12"> <div className="p-2">
<div className="mx-auto max-w-7xl sm:px-6 lg:px-8"> <div className="mx-auto max-w-7xl sm:px-6 lg:px-8">
<div className="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3"> <div className="grid max-h-[calc(100vh-250px)] grid-cols-1 gap-6 overflow-y-auto sm:grid-cols-2 lg:grid-cols-3">
{songs.map((song) => ( {songs.map((song) => (
<div <div
key={song.id} key={song.id}
className="overflow-hidden rounded-lg bg-white shadow-lg dark:bg-gray-800" className="overflow-hidden rounded-lg bg-white shadow-lg dark:bg-gray-800"
> >
<img <img
src={song.coverArt} src={song.cover}
alt={song.title} alt={song.title}
className="h-48 w-full object-cover" className="h-48 w-full object-cover"
/> />
@@ -75,6 +54,7 @@ export default function Gallery() {
</div> </div>
<Reproductor /> <Reproductor />
</div> </div>
c
</Authenticated> </Authenticated>
); );
} }

View File

@@ -80,8 +80,8 @@ export default function Index({ songs }: { songs: Cancion[] }) {
<kbd className="rounded-md border bg-teal-950">k</kbd> <kbd className="rounded-md border bg-teal-950">k</kbd>
</p> </p>
) : ( ) : (
<div className="flex justify-center overflow-x-auto"> <div className="mx-4 flex w-full justify-center overflow-x-scroll">
<table className="table-auto"> <table className="mx-auto mt-2 table w-full">
<thead> <thead>
<tr className="border-b bg-gray-50 text-center text-sm font-semibold uppercase tracking-wider text-gray-700 dark:bg-gray-700 dark:text-gray-400"> <tr className="border-b bg-gray-50 text-center text-sm font-semibold uppercase tracking-wider text-gray-700 dark:bg-gray-700 dark:text-gray-400">
<th className="px-6 py-3">Nombre</th> <th className="px-6 py-3">Nombre</th>