2024-04-06 23:32:31 +08:00
|
|
|
import { deleteSong, listSongs } from "./actions";
|
|
|
|
import DeleteSongButton from "./delete-song-button";
|
2024-04-06 15:57:26 +08:00
|
|
|
import SearchForm from "./search-form";
|
|
|
|
|
2024-04-06 23:07:01 +08:00
|
|
|
export default async function Page() {
|
|
|
|
const songs = await listSongs();
|
2024-04-06 04:24:58 +08:00
|
|
|
return (
|
|
|
|
<section className="bg-gray-100">
|
|
|
|
<div className="container mx-auto px-4 py-8">
|
|
|
|
<div className="grid grid-cols-2 gap-8">
|
|
|
|
<div>
|
2024-04-06 15:57:26 +08:00
|
|
|
<h2 className="text-xl font-bold mb-4">已收藏</h2>
|
2024-04-06 04:24:58 +08:00
|
|
|
<ul className="bg-white rounded shadow-md p-4">
|
2024-04-06 23:07:01 +08:00
|
|
|
{songs.map((song, i) => (
|
|
|
|
<li
|
|
|
|
className="flex justify-between items-center py-2 border-b"
|
|
|
|
key={i}
|
|
|
|
>
|
|
|
|
<span>
|
|
|
|
{song.name} - {song.artist}
|
|
|
|
</span>
|
2024-04-06 23:32:31 +08:00
|
|
|
<DeleteSongButton
|
|
|
|
className="text-red-500 hover:text-red-700"
|
|
|
|
id={song.id}
|
|
|
|
/>
|
2024-04-06 23:07:01 +08:00
|
|
|
</li>
|
|
|
|
))}
|
2024-04-06 04:24:58 +08:00
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div>
|
2024-04-06 15:57:26 +08:00
|
|
|
<h2 className="text-xl font-bold mb-4">搜索</h2>
|
|
|
|
<SearchForm className="mb-4" />
|
2024-04-06 04:24:58 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
);
|
|
|
|
}
|