diff --git a/src/renderer/features/player/components/center-controls.tsx b/src/renderer/features/player/components/center-controls.tsx index adc5d380..d24710b2 100644 --- a/src/renderer/features/player/components/center-controls.tsx +++ b/src/renderer/features/player/components/center-controls.tsx @@ -28,6 +28,7 @@ import { } from '/@/renderer/store/settings.store'; import { Icon } from '/@/shared/components/icon/icon'; import { Text } from '/@/shared/components/text/text'; +import { PlaybackSelectors } from '/@/shared/constants/playback-selectors'; import { PlaybackType, PlayerRepeat, PlayerShuffle, PlayerStatus } from '/@/shared/types/types'; interface CenterControlsProps { @@ -253,7 +254,13 @@ export const CenterControls = ({ playersRef }: CenterControlsProps) => {
- + {formattedTime}
@@ -281,7 +288,13 @@ export const CenterControls = ({ playersRef }: CenterControlsProps) => { />
- + {duration}
diff --git a/src/renderer/features/player/components/left-controls.tsx b/src/renderer/features/player/components/left-controls.tsx index 9bf2a403..72b19b2d 100644 --- a/src/renderer/features/player/components/left-controls.tsx +++ b/src/renderer/features/player/components/left-controls.tsx @@ -24,6 +24,7 @@ import { Image } from '/@/shared/components/image/image'; import { Separator } from '/@/shared/components/separator/separator'; import { Text } from '/@/shared/components/text/text'; import { Tooltip } from '/@/shared/components/tooltip/tooltip'; +import { PlaybackSelectors } from '/@/shared/constants/playback-selectors'; import { LibraryItem } from '/@/shared/types/domain-types'; export const LeftControls = () => { @@ -104,7 +105,10 @@ export const LeftControls = () => { openDelay={500} > @@ -139,6 +143,7 @@ export const LeftControls = () => {
{
{artists?.map((artist, index) => ( @@ -190,7 +199,11 @@ export const LeftControls = () => { ))}
{ icon: ReactNode; @@ -62,9 +63,13 @@ interface PlayButtonProps extends Omit { export const PlayButton = forwardRef( ({ isPaused, onClick, ...props }: PlayButtonProps, ref) => { + const playerStateClass = isPaused + ? PlaybackSelectors.playerStatePaused + : PlaybackSelectors.playerStatePlaying; + return ( { @@ -56,7 +58,7 @@ export const Playerbar = () => { return (
diff --git a/src/shared/constants/playback-selectors.ts b/src/shared/constants/playback-selectors.ts new file mode 100644 index 00000000..d15d6c4a --- /dev/null +++ b/src/shared/constants/playback-selectors.ts @@ -0,0 +1,14 @@ +// Defines the selectors used to identify playback-related elements in the UI. +// Can be used by browser extensions for accessing meta data around currently playing media. + +export const PlaybackSelectors = { + elapsedTime: 'elapsed-time', + mediaPlayer: 'media-player', + playerCoverArt: 'player-cover-art', + playerStatePaused: 'player-state-paused', + playerStatePlaying: 'player-state-playing', + songAlbum: 'song-album', + songArtist: 'song-artist', + songTitle: 'song-title', + totalDuration: 'total-duration', +} as const;