This commit is contained in:
zadit
2025-01-07 16:31:54 +07:00
parent 0c99be55ec
commit 8e8eab48c1
2 changed files with 20 additions and 21 deletions

View File

@@ -121,21 +121,21 @@ const MusicComponent = ({ song, min, max, onDecision }) => {
onTouchEnd={handleTouchEnd}
style={{ transform: `translateX(${positionX}px)` }}
ref={containerRef}>
{song.set && <div className="decisionbgrnd" style={{ backgroundColor: song.bePlayed ? "green" : "red" }}>
<h1 className="decision">{song.bePlayed ? "next up" : "skipped"}</h1></div>}
{song[3] && <div className="decisionbgrnd" style={{ backgroundColor: song[4] ? "green" : "red" }}>
<h1 className="decision">{song[4] ? "next up" : "skipped"}</h1></div>}
<div className="bgrnd" style={{ backgroundColor: backgroundColor }}></div>
<img
src={song.image}
alt={song.name}
src={song[0]?.image || song.image}
alt={song[0]?.name}
className="song-image"
onError={(e) => e.target.src = song.image}
onError={(e) => e.target.src = song[0]?.image || song.image}
/>
<div className="song-details">
<p className="song-name">{song.name}</p>
<p className="artist-name">{song.artist}</p>
{min < 0 && <p className="artist-name">&lt;--- {song.disagree} no - {song.agree} yes ---&gt;</p>}
<p className="song-name">{song[0]?.name || song.name}</p>
<p className="artist-name">{song[0]?.artist || song.artist}</p>
{min < 0 && <p className="artist-name">&lt;--- {song[2]?.length} no - {song[1]?.length} yes ---&gt;</p>}
</div>
<p className="song-duration">{song.length}</p>
<p className="song-duration">{song[0]?.length || song.length}</p>
</div>
);
};

View File

@@ -85,9 +85,9 @@ export function MusicPlayer({ socket, shopId, user, shopOwnerId, isSpotifyNeedLo
const fetchColor = async () => {
if (
currentSong &&
currentSong.image
currentSong[0]?.image
) {
const imageUrl = currentSong.image;
const imageUrl = currentSong[0].image;
try {
const dominantColor = await getDominantColor(imageUrl);
// Calculate luminance (YIQ color space) to determine if subtitle should be black or white
@@ -429,8 +429,8 @@ export function MusicPlayer({ socket, shopId, user, shopOwnerId, isSpotifyNeedLo
<div className="current-info" >
<div
className={`current-name ${viewing ? '' : 'animated-text'}`} style={{ margin: `${viewing ? '35px 30px' : '13px 30px'}` }}>
{currentSong && currentSong.name
? (viewing ? currentSong.name : text)
{currentSong && currentSong[0]?.name
? (viewing ? currentSong[0]?.name : text)
:
viewing ? messages[0] : text}
</div>
@@ -438,9 +438,8 @@ export function MusicPlayer({ socket, shopId, user, shopOwnerId, isSpotifyNeedLo
<div className="current-artist">
{
currentSong &&
currentSong.image &&
currentSong.artist
? currentSong.artist
currentSong[0]?.artist
? currentSong[0]?.artist
: "Pilih hits terbaikmu dibawah!"}
</div>
</>
@@ -512,14 +511,14 @@ export function MusicPlayer({ socket, shopId, user, shopOwnerId, isSpotifyNeedLo
<MusicComponent
key={index}
song={song}
min={-100}
max={100}
onDecision={(vote) => onDecision(song.trackId, vote)}
min={song[3]? 0 : -100}
max={song[3]? 0 : 100}
onDecision={(vote) => onDecision(song[0].trackId, vote)}
/>
))
)
}
{songName == "" && queue && queue.length > 0 && queue.length < 3 && (
{/* {songName == "" && queue && queue.length > 0 && queue.length < 3 && (
<div className="middle-text">
<span className="normal-text">Tambahkan musikmu</span>
@@ -530,7 +529,7 @@ export function MusicPlayer({ socket, shopId, user, shopOwnerId, isSpotifyNeedLo
Cari musik
</button>
</div>
)}
)} */}
</div>