Skip to content

Commit

Permalink
add tag
Browse files Browse the repository at this point in the history
  • Loading branch information
idoubi committed Apr 11, 2024
1 parent 6fc074b commit 835ef21
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
18 changes: 15 additions & 3 deletions app/[locale]/(default)/_components/playlist/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,14 @@ export default function ({
};

const updatePlaylist = function (song: Song, idx: number) {
console.log(song, idx, songs);
if (!songs) {
return;
}
setPlaylist(songs);
setPlaylist(
songs.filter(
(item: Song) => item && item.audio_url && item.title && item.image_url
)
);
setCurrentSong(song);
setCurrentSongIndex(idx);
};
Expand Down Expand Up @@ -121,7 +124,16 @@ export default function ({
</TableCell>

<TableCell className="font-medium max-w-[120px] md:max-w-sm truncate">
{song.tags}
<p>{song.tags}</p>
<div
className={`badge mt-1 ${
song.provider === "udio"
? "bg-red-500 text-white"
: "bg-primary"
}`}
>
{song.provider}
</div>
</TableCell>

<TableCell className="hidden md:table-cell">
Expand Down
11 changes: 9 additions & 2 deletions app/[locale]/(default)/_components/playlist/scroll.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ export default function ({
if (!songs) {
return;
}
setPlaylist(songs);
setPlaylist(
songs.filter(
(item: Song) => item && item.audio_url && item.title && item.image_url
)
);
setCurrentSong(song);
setCurrentSongIndex(idx);
};
Expand All @@ -37,7 +41,10 @@ export default function ({
<ScrollArea className="w-96 md:w-full whitespace-nowrap mt-4">
<div className="flex w-max space-x-4 p-4">
{songs
.filter((item: Song) => item.title && item.image_url)
.filter(
(item: Song) =>
item && item.audio_url && item.title && item.image_url
)
.map((song: Song, idx: number) => {
const isActive = currentSong && currentSong.uuid === song.uuid;
return (
Expand Down

0 comments on commit 835ef21

Please sign in to comment.