Skip to content

Commit

Permalink
Made the Player behaviour more consistent
Browse files Browse the repository at this point in the history
  • Loading branch information
deluan committed Jul 3, 2021
1 parent 26b5e6b commit ace5c90
Show file tree
Hide file tree
Showing 14 changed files with 374 additions and 377 deletions.
4 changes: 2 additions & 2 deletions ui/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import customRoutes from './routes'
import {
themeReducer,
addToPlaylistDialogReducer,
playQueueReducer,
playerReducer,
albumViewReducer,
activityReducer,
settingsReducer,
Expand Down Expand Up @@ -48,7 +48,7 @@ const App = () => (
dataProvider,
history,
customReducers: {
queue: playQueueReducer,
player: playerReducer,
albumView: albumViewReducer,
theme: themeReducer,
addToPlaylistDialog: addToPlaylistDialogReducer,
Expand Down
2 changes: 1 addition & 1 deletion ui/src/actions/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export * from './audioplayer'
export * from './player'
export * from './themes'
export * from './albumView'
export * from './dialogs'
Expand Down
7 changes: 0 additions & 7 deletions ui/src/actions/audioplayer.js → ui/src/actions/player.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ export const PLAYER_PLAY_NEXT = 'PLAYER_PLAY_NEXT'
export const PLAYER_SET_TRACK = 'PLAYER_SET_TRACK'
export const PLAYER_SYNC_QUEUE = 'PLAYER_SYNC_QUEUE'
export const PLAYER_CLEAR_QUEUE = 'PLAYER_CLEAR_QUEUE'
export const PLAYER_SCROBBLE = 'PLAYER_SCROBBLE'
export const PLAYER_PLAY_TRACKS = 'PLAYER_PLAY_TRACKS'
export const PLAYER_CURRENT = 'PLAYER_CURRENT'
export const PLAYER_SET_VOLUME = 'PLAYER_SET_VOLUME'
Expand Down Expand Up @@ -79,12 +78,6 @@ export const clearQueue = () => ({
type: PLAYER_CLEAR_QUEUE,
})

export const scrobble = (id, submit) => ({
type: PLAYER_SCROBBLE,
id,
submit,
})

export const currentPlaying = (audioInfo) => ({
type: PLAYER_CURRENT,
data: audioInfo,
Expand Down
41 changes: 41 additions & 0 deletions ui/src/audioplayer/AudioTitle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from 'react'
import { useMediaQuery } from '@material-ui/core'
import { Link } from 'react-router-dom'
import clsx from 'clsx'
import { QualityInfo } from '../common'
import useStyle from './styles'

const AudioTitle = React.memo(({ audioInfo, isMobile }) => {
const classes = useStyle()
const className = classes.audioTitle
const isDesktop = useMediaQuery('(min-width:810px)')

if (!audioInfo.song) {
return ''
}

const song = audioInfo.song
const qi = { suffix: song.suffix, bitRate: song.bitRate }

return (
<Link to={`/album/${song.albumId}/show`} className={className}>
<span>
<span className={clsx(classes.songTitle, 'songTitle')}>
{song.title}
</span>
{isDesktop && (
<QualityInfo record={qi} className={classes.qualityInfo} />
)}
</span>
{!isMobile && (
<div className={classes.artistAlbum}>
<span className={clsx(classes.songInfo, 'songInfo')}>
{`${song.artist} - ${song.album}`}
</span>
</div>
)}
</Link>
)
})

export default AudioTitle

0 comments on commit ace5c90

Please sign in to comment.