Normalize types

This commit is contained in:
jeffvli
2022-08-20 02:06:00 -07:00
parent a087dbdea3
commit dd6b80795e
9 changed files with 93 additions and 89 deletions
@@ -2,7 +2,7 @@ import { useEffect, useMemo, useState } from 'react';
import format from 'format-duration';
import { useTranslation } from 'react-i18next';
import {
RiPauseFill,
RiPauseLine,
RiPlayFill,
RiRewindFill,
RiSkipBackFill,
@@ -88,8 +88,8 @@ export const CenterControls = ({ playersRef }: CenterControlsProps) => {
useEffect(() => {
let interval: any;
if (status === PlayerStatus.Playing && !isSeeking) {
if (settings.type === PlaybackType.Web) {
if (status === PlayerStatus.PLAYING && !isSeeking) {
if (settings.type === PlaybackType.WEB) {
interval = setInterval(() => {
setCurrentTime(currentPlayerRef.getCurrentTime());
}, 1000);
@@ -119,15 +119,15 @@ export const CenterControls = ({ playersRef }: CenterControlsProps) => {
/>
<PlayerButton
icon={
status === PlayerStatus.Paused ? (
status === PlayerStatus.PAUSED ? (
<RiPlayFill size={20} />
) : (
<RiPauseFill size={20} />
<RiPauseLine size={20} stroke="20px" />
)
}
tooltip={{
label:
status === PlayerStatus.Paused
status === PlayerStatus.PAUSED
? `${t('player.play')}`
: `${t('player.pause')}`,
}}
@@ -67,7 +67,7 @@ export const LeftControls = () => {
to="/nowplaying"
weight={500}
>
{album || '—'}
{album?.name || '—'}
</Text>
</MetadataStack>
</LeftControlsContainer>
@@ -65,7 +65,7 @@ export const Playerbar = () => {
<RightControls />
</RightGridItem>
</PlayerbarControlsGrid>
{settings.type === PlaybackType.Web && (
{settings.type === PlaybackType.WEB && (
<AudioPlayer
ref={playersRef}
autoNext={autoNext}
@@ -16,12 +16,12 @@ export type PlayerSettings = PlayerState['settings'];
const DEFAULT_SETTINGS: WebSettings = {
player: {
crossfadeDuration: 5,
crossfadeStyle: CrossfadeStyle.EqualPower,
crossfadeStyle: CrossfadeStyle.EQUALPOWER,
muted: false,
repeat: PlayerRepeat.All,
repeat: PlayerRepeat.ALL,
shuffle: false,
style: PlaybackStyle.Gapless,
type: isElectron() ? PlaybackType.Local : PlaybackType.Web,
style: PlaybackStyle.GAPLESS,
type: isElectron() ? PlaybackType.LOCAL : PlaybackType.WEB,
volume: 0.5,
},
};