Skip to content

Commit

Permalink
feat(ui): Improve player ui when player is stopping
Browse files Browse the repository at this point in the history
  • Loading branch information
FoxxMD committed Oct 16, 2024
1 parent 3142101 commit 3bc72ce
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/client/components/player/Player.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ const Player = (props: PlayerProps) => {
<FontAwesomeIcon color="black" icon={viewMode === 'playlist' ? faTimes : faBars}/>
</button>
<section className="player__body">
<p className="title">{track}</p>
<p className="subtitle">{artists.join(' / ')}</p>
<p className="title">{calculated !== 'stopped' ? track : '-'}</p>
<p className="subtitle">{calculated !== 'stopped' ? artists.join(' / ') : '-'}</p>
<PlayerTimestamp duration={duration} current={data.position || 0} />
<div className="flex">
<p className="stats flex-1 text-left">Status: {capitalize(calculated)}</p>
<p className="stats flex-1 text-right">Listened: {listenedDuration.toFixed(0)}s{durPer}</p>
<p className="stats flex-1 text-right">Listened: {calculated !== 'stopped' ? `${listenedDuration.toFixed(0)}s` : '-'}{durPer}</p>
</div>
</section>
<PlayerInfo data={data} isVisible={viewMode === 'playlist'} />
Expand Down
2 changes: 1 addition & 1 deletion src/client/components/player/PlayerTimestamp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const Timestamp = (props: TimestampProps) => {
{convertTime(Math.floor(props.current))}
</div>
<div className="timestamp__progress">
<div style={{ width: Math.floor((props.current / props.duration) * 100) + "%" }}></div>
<div style={{ width: (props.current === 0 && props.duration === 0 ? 0 : Math.floor((props.current / props.duration) * 100)) + "%" }}></div>
</div>
<div className="timestamp__total">
{convertTime(Math.floor(props.duration) - Math.floor(props.current))}
Expand Down

0 comments on commit 3bc72ce

Please sign in to comment.