Reformat code with Prettier's new rules.
This commit is contained in:
@@ -113,7 +113,7 @@ const useStyles = makeStyles(
|
|||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
name: 'NDAlbumDetails',
|
name: 'NDAlbumDetails',
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
const AlbumComment = ({ record }) => {
|
const AlbumComment = ({ record }) => {
|
||||||
@@ -141,7 +141,7 @@ const AlbumComment = ({ record }) => {
|
|||||||
timeout={'auto'}
|
timeout={'auto'}
|
||||||
className={clsx(
|
className={clsx(
|
||||||
classes.commentBlock,
|
classes.commentBlock,
|
||||||
lines.length > 1 && classes.pointerCursor
|
lines.length > 1 && classes.pointerCursor,
|
||||||
)}
|
)}
|
||||||
>
|
>
|
||||||
<Typography variant={'body1'} onClick={handleExpandClick}>
|
<Typography variant={'body1'} onClick={handleExpandClick}>
|
||||||
@@ -216,9 +216,9 @@ const Details = (props) => {
|
|||||||
addDetail(
|
addDetail(
|
||||||
<>
|
<>
|
||||||
{[translate('resources.album.fields.originalDate'), originalDate].join(
|
{[translate('resources.album.fields.originalDate'), originalDate].join(
|
||||||
' '
|
' ',
|
||||||
)}
|
)}
|
||||||
</>
|
</>,
|
||||||
)
|
)
|
||||||
|
|
||||||
yearRange && addDetail(<>{['♫', !isXsmall ? date : yearRange].join(' ')}</>)
|
yearRange && addDetail(<>{['♫', !isXsmall ? date : yearRange].join(' ')}</>)
|
||||||
@@ -230,7 +230,7 @@ const Details = (props) => {
|
|||||||
? [translate('resources.album.fields.releaseDate'), releaseDate]
|
? [translate('resources.album.fields.releaseDate'), releaseDate]
|
||||||
: ['○', record.releaseDate.substring(0, 4)]
|
: ['○', record.releaseDate.substring(0, 4)]
|
||||||
).join(' ')}
|
).join(' ')}
|
||||||
</>
|
</>,
|
||||||
)
|
)
|
||||||
|
|
||||||
const showReleases = record.releases > 1
|
const showReleases = record.releases > 1
|
||||||
@@ -245,7 +245,7 @@ const Details = (props) => {
|
|||||||
}),
|
}),
|
||||||
].join(' ')
|
].join(' ')
|
||||||
: ['(', record.releases, ')))'].join(' ')}
|
: ['(', record.releases, ')))'].join(' ')}
|
||||||
</>
|
</>,
|
||||||
)
|
)
|
||||||
|
|
||||||
addDetail(
|
addDetail(
|
||||||
@@ -255,7 +255,7 @@ const Details = (props) => {
|
|||||||
translate('resources.song.name', {
|
translate('resources.song.name', {
|
||||||
smart_count: record.songCount,
|
smart_count: record.songCount,
|
||||||
})}
|
})}
|
||||||
</>
|
</>,
|
||||||
)
|
)
|
||||||
!isXsmall && addDetail(<DurationField source={'duration'} />)
|
!isXsmall && addDetail(<DurationField source={'duration'} />)
|
||||||
!isXsmall && addDetail(<SizeField source="size" />)
|
!isXsmall && addDetail(<SizeField source="size" />)
|
||||||
@@ -299,7 +299,7 @@ const AlbumDetails = (props) => {
|
|||||||
const handleOpenLightbox = React.useCallback(() => setLightboxOpen(true), [])
|
const handleOpenLightbox = React.useCallback(() => setLightboxOpen(true), [])
|
||||||
const handleCloseLightbox = React.useCallback(
|
const handleCloseLightbox = React.useCallback(
|
||||||
() => setLightboxOpen(false),
|
() => setLightboxOpen(false),
|
||||||
[]
|
[],
|
||||||
)
|
)
|
||||||
return (
|
return (
|
||||||
<Card className={classes.root}>
|
<Card className={classes.root}>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ const AlbumExternalLinks = (props) => {
|
|||||||
encodeURIComponent(record.name)
|
encodeURIComponent(record.name)
|
||||||
}`,
|
}`,
|
||||||
'message.openIn.lastfm',
|
'message.openIn.lastfm',
|
||||||
<ImLastfm2 className="lastfm-icon" />
|
<ImLastfm2 className="lastfm-icon" />,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,7 +43,7 @@ const AlbumExternalLinks = (props) => {
|
|||||||
addLink(
|
addLink(
|
||||||
`https://musicbrainz.org/release/${record.mbzAlbumId}`,
|
`https://musicbrainz.org/release/${record.mbzAlbumId}`,
|
||||||
'message.openIn.musicbrainz',
|
'message.openIn.musicbrainz',
|
||||||
<MusicBrainz className="musicbrainz-icon" />
|
<MusicBrainz className="musicbrainz-icon" />,
|
||||||
)
|
)
|
||||||
|
|
||||||
return <div className={className}>{intersperse(links, ' ')}</div>
|
return <div className={className}>{intersperse(links, ' ')}</div>
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ const useStyles = makeStyles(
|
|||||||
albumContainer: {},
|
albumContainer: {},
|
||||||
albumPlayButton: { color: 'white' },
|
albumPlayButton: { color: 'white' },
|
||||||
}),
|
}),
|
||||||
{ name: 'NDAlbumGridView' }
|
{ name: 'NDAlbumGridView' },
|
||||||
)
|
)
|
||||||
|
|
||||||
const useCoverStyles = makeStyles({
|
const useCoverStyles = makeStyles({
|
||||||
@@ -98,32 +98,34 @@ const getColsForWidth = (width) => {
|
|||||||
return 9
|
return 9
|
||||||
}
|
}
|
||||||
|
|
||||||
const Cover = withContentRect('bounds')(
|
const Cover = withContentRect('bounds')(({
|
||||||
({ record, measureRef, contentRect }) => {
|
record,
|
||||||
// Force height to be the same as the width determined by the GridList
|
measureRef,
|
||||||
// noinspection JSSuspiciousNameCombination
|
contentRect,
|
||||||
const classes = useCoverStyles({ height: contentRect.bounds.width })
|
}) => {
|
||||||
const [, dragAlbumRef] = useDrag(
|
// Force height to be the same as the width determined by the GridList
|
||||||
() => ({
|
// noinspection JSSuspiciousNameCombination
|
||||||
type: DraggableTypes.ALBUM,
|
const classes = useCoverStyles({ height: contentRect.bounds.width })
|
||||||
item: { albumIds: [record.id] },
|
const [, dragAlbumRef] = useDrag(
|
||||||
options: { dropEffect: 'copy' },
|
() => ({
|
||||||
}),
|
type: DraggableTypes.ALBUM,
|
||||||
[record]
|
item: { albumIds: [record.id] },
|
||||||
)
|
options: { dropEffect: 'copy' },
|
||||||
return (
|
}),
|
||||||
<div ref={measureRef}>
|
[record],
|
||||||
<div ref={dragAlbumRef}>
|
)
|
||||||
<img
|
return (
|
||||||
src={subsonic.getCoverArtUrl(record, 300)}
|
<div ref={measureRef}>
|
||||||
alt={record.name}
|
<div ref={dragAlbumRef}>
|
||||||
className={classes.cover}
|
<img
|
||||||
/>
|
src={subsonic.getCoverArtUrl(record, 300)}
|
||||||
</div>
|
alt={record.name}
|
||||||
|
className={classes.cover}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
)
|
</div>
|
||||||
}
|
)
|
||||||
)
|
})
|
||||||
|
|
||||||
const AlbumGridTile = ({ showArtist, record, basePath, ...props }) => {
|
const AlbumGridTile = ({ showArtist, record, basePath, ...props }) => {
|
||||||
const classes = useStyles()
|
const classes = useStyles()
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ const AlbumList = (props) => {
|
|||||||
'size',
|
'size',
|
||||||
'createdAt',
|
'createdAt',
|
||||||
],
|
],
|
||||||
['createdAt', 'size']
|
['createdAt', 'size'],
|
||||||
)
|
)
|
||||||
|
|
||||||
// If it does not have filter/sort params (usually coming from Menu),
|
// If it does not have filter/sort params (usually coming from Menu),
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ const AlbumViewToggler = React.forwardRef(
|
|||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
const AlbumListActions = ({
|
const AlbumListActions = ({
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const useStyles = makeStyles(
|
|||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
name: 'NDAlbumShow',
|
name: 'NDAlbumShow',
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
const AlbumShowLayout = (props) => {
|
const AlbumShowLayout = (props) => {
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ const useStyles = makeStyles(
|
|||||||
visibility: 'hidden',
|
visibility: 'hidden',
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
{ name: 'RaList' }
|
{ name: 'RaList' },
|
||||||
)
|
)
|
||||||
|
|
||||||
const AlbumSongs = (props) => {
|
const AlbumSongs = (props) => {
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ const AlbumDatagridRow = (props) => {
|
|||||||
item: { albumIds: [record?.id] },
|
item: { albumIds: [record?.id] },
|
||||||
options: { dropEffect: 'copy' },
|
options: { dropEffect: 'copy' },
|
||||||
}),
|
}),
|
||||||
[record]
|
[record],
|
||||||
)
|
)
|
||||||
return <DatagridRow ref={dragAlbumRef} {...props} />
|
return <DatagridRow ref={dragAlbumRef} {...props} />
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ const ArtistExternalLinks = ({ artistInfo, record }) => {
|
|||||||
const translate = useTranslate()
|
const translate = useTranslate()
|
||||||
let linkButtons = []
|
let linkButtons = []
|
||||||
const lastFMlink = artistInfo?.biography?.match(
|
const lastFMlink = artistInfo?.biography?.match(
|
||||||
/<a\s+(?:[^>]*?\s+)?href=(["'])(.*?)\1/
|
/<a\s+(?:[^>]*?\s+)?href=(["'])(.*?)\1/,
|
||||||
)
|
)
|
||||||
|
|
||||||
const addLink = (url, title, icon) => {
|
const addLink = (url, title, icon) => {
|
||||||
@@ -34,13 +34,13 @@ const ArtistExternalLinks = ({ artistInfo, record }) => {
|
|||||||
addLink(
|
addLink(
|
||||||
lastFMlink[2],
|
lastFMlink[2],
|
||||||
'message.openIn.lastfm',
|
'message.openIn.lastfm',
|
||||||
<ImLastfm2 className="lastfm-icon" />
|
<ImLastfm2 className="lastfm-icon" />,
|
||||||
)
|
)
|
||||||
} else if (artistInfo?.lastFmUrl) {
|
} else if (artistInfo?.lastFmUrl) {
|
||||||
addLink(
|
addLink(
|
||||||
artistInfo?.lastFmUrl,
|
artistInfo?.lastFmUrl,
|
||||||
'message.openIn.lastfm',
|
'message.openIn.lastfm',
|
||||||
<ImLastfm2 className="lastfm-icon" />
|
<ImLastfm2 className="lastfm-icon" />,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -49,7 +49,7 @@ const ArtistExternalLinks = ({ artistInfo, record }) => {
|
|||||||
addLink(
|
addLink(
|
||||||
`https://musicbrainz.org/artist/${artistInfo.musicBrainzId}`,
|
`https://musicbrainz.org/artist/${artistInfo.musicBrainzId}`,
|
||||||
'message.openIn.musicbrainz',
|
'message.openIn.musicbrainz',
|
||||||
<MusicBrainz className="musicbrainz-icon" />
|
<MusicBrainz className="musicbrainz-icon" />,
|
||||||
)
|
)
|
||||||
|
|
||||||
return <div>{intersperse(linkButtons, ' ')}</div>
|
return <div>{intersperse(linkButtons, ' ')}</div>
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ const ArtistDatagridRow = (props) => {
|
|||||||
item: { artistIds: [record?.id] },
|
item: { artistIds: [record?.id] },
|
||||||
options: { dropEffect: 'copy' },
|
options: { dropEffect: 'copy' },
|
||||||
}),
|
}),
|
||||||
[record]
|
[record],
|
||||||
)
|
)
|
||||||
return <DatagridRow ref={dragArtistRef} {...props} />
|
return <DatagridRow ref={dragArtistRef} {...props} />
|
||||||
}
|
}
|
||||||
@@ -132,7 +132,7 @@ const ArtistListView = ({ hasShow, hasEdit, hasList, width, ...rest }) => {
|
|||||||
resource: 'artist',
|
resource: 'artist',
|
||||||
columns: toggleableFields,
|
columns: toggleableFields,
|
||||||
},
|
},
|
||||||
['size']
|
['size'],
|
||||||
)
|
)
|
||||||
|
|
||||||
return isXsmall ? (
|
return isXsmall ? (
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ const useStyles = makeStyles(
|
|||||||
wordBreak: 'break-word',
|
wordBreak: 'break-word',
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
{ name: 'NDDesktopArtistDetails' }
|
{ name: 'NDDesktopArtistDetails' },
|
||||||
)
|
)
|
||||||
|
|
||||||
const DesktopArtistDetails = ({ artistInfo, record, biography }) => {
|
const DesktopArtistDetails = ({ artistInfo, record, biography }) => {
|
||||||
@@ -77,7 +77,7 @@ const DesktopArtistDetails = ({ artistInfo, record, biography }) => {
|
|||||||
const handleOpenLightbox = React.useCallback(() => setLightboxOpen(true), [])
|
const handleOpenLightbox = React.useCallback(() => setLightboxOpen(true), [])
|
||||||
const handleCloseLightbox = React.useCallback(
|
const handleCloseLightbox = React.useCallback(
|
||||||
() => setLightboxOpen(false),
|
() => setLightboxOpen(false),
|
||||||
[]
|
[],
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ const useStyles = makeStyles(
|
|||||||
wordBreak: 'break-word',
|
wordBreak: 'break-word',
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
{ name: 'NDMobileArtistDetails' }
|
{ name: 'NDMobileArtistDetails' },
|
||||||
)
|
)
|
||||||
|
|
||||||
const MobileArtistDetails = ({ artistInfo, biography, record }) => {
|
const MobileArtistDetails = ({ artistInfo, biography, record }) => {
|
||||||
@@ -85,7 +85,7 @@ const MobileArtistDetails = ({ artistInfo, biography, record }) => {
|
|||||||
const handleOpenLightbox = React.useCallback(() => setLightboxOpen(true), [])
|
const handleOpenLightbox = React.useCallback(() => setLightboxOpen(true), [])
|
||||||
const handleCloseLightbox = React.useCallback(
|
const handleCloseLightbox = React.useCallback(
|
||||||
() => setLightboxOpen(false),
|
() => setLightboxOpen(false),
|
||||||
[]
|
[],
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ const Player = () => {
|
|||||||
const isDesktop = useMediaQuery('(min-width:810px)')
|
const isDesktop = useMediaQuery('(min-width:810px)')
|
||||||
const isMobilePlayer =
|
const isMobilePlayer =
|
||||||
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
||||||
navigator.userAgent
|
navigator.userAgent,
|
||||||
)
|
)
|
||||||
|
|
||||||
const { authenticated } = useAuthState()
|
const { authenticated } = useAuthState()
|
||||||
@@ -60,7 +60,7 @@ const Player = () => {
|
|||||||
enableCoverAnimation: config.enableCoverAnimation,
|
enableCoverAnimation: config.enableCoverAnimation,
|
||||||
})
|
})
|
||||||
const showNotifications = useSelector(
|
const showNotifications = useSelector(
|
||||||
(state) => state.settings.notifications || false
|
(state) => state.settings.notifications || false,
|
||||||
)
|
)
|
||||||
const gainInfo = useSelector((state) => state.replayGain)
|
const gainInfo = useSelector((state) => state.replayGain)
|
||||||
const [context, setContext] = useState(null)
|
const [context, setContext] = useState(null)
|
||||||
@@ -100,7 +100,7 @@ const Player = () => {
|
|||||||
numericGain = calculateReplayGain(
|
numericGain = calculateReplayGain(
|
||||||
gainInfo.preAmp,
|
gainInfo.preAmp,
|
||||||
song.rgAlbumGain,
|
song.rgAlbumGain,
|
||||||
song.rgAlbumPeak
|
song.rgAlbumPeak,
|
||||||
)
|
)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -108,7 +108,7 @@ const Player = () => {
|
|||||||
numericGain = calculateReplayGain(
|
numericGain = calculateReplayGain(
|
||||||
gainInfo.preAmp,
|
gainInfo.preAmp,
|
||||||
song.rgTrackGain,
|
song.rgTrackGain,
|
||||||
song.rgTrackPeak
|
song.rgTrackPeak,
|
||||||
)
|
)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@@ -160,7 +160,7 @@ const Player = () => {
|
|||||||
),
|
),
|
||||||
locale: locale(translate),
|
locale: locale(translate),
|
||||||
}),
|
}),
|
||||||
[gainInfo, isDesktop, playerTheme, translate]
|
[gainInfo, isDesktop, playerTheme, translate],
|
||||||
)
|
)
|
||||||
|
|
||||||
const options = useMemo(() => {
|
const options = useMemo(() => {
|
||||||
@@ -181,12 +181,12 @@ const Player = () => {
|
|||||||
|
|
||||||
const onAudioListsChange = useCallback(
|
const onAudioListsChange = useCallback(
|
||||||
(_, audioLists, audioInfo) => dispatch(syncQueue(audioInfo, audioLists)),
|
(_, audioLists, audioInfo) => dispatch(syncQueue(audioInfo, audioLists)),
|
||||||
[dispatch]
|
[dispatch],
|
||||||
)
|
)
|
||||||
|
|
||||||
const nextSong = useCallback(() => {
|
const nextSong = useCallback(() => {
|
||||||
const idx = playerState.queue.findIndex(
|
const idx = playerState.queue.findIndex(
|
||||||
(item) => item.uuid === playerState.current.uuid
|
(item) => item.uuid === playerState.current.uuid,
|
||||||
)
|
)
|
||||||
return idx !== null ? playerState.queue[idx + 1] : null
|
return idx !== null ? playerState.queue[idx + 1] : null
|
||||||
}, [playerState])
|
}, [playerState])
|
||||||
@@ -221,13 +221,13 @@ const Player = () => {
|
|||||||
setScrobbled(true)
|
setScrobbled(true)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[startTime, scrobbled, nextSong, preloaded]
|
[startTime, scrobbled, nextSong, preloaded],
|
||||||
)
|
)
|
||||||
|
|
||||||
const onAudioVolumeChange = useCallback(
|
const onAudioVolumeChange = useCallback(
|
||||||
// sqrt to compensate for the logarithmic volume
|
// sqrt to compensate for the logarithmic volume
|
||||||
(volume) => dispatch(setVolume(Math.sqrt(volume))),
|
(volume) => dispatch(setVolume(Math.sqrt(volume))),
|
||||||
[dispatch]
|
[dispatch],
|
||||||
)
|
)
|
||||||
|
|
||||||
const onAudioPlay = useCallback(
|
const onAudioPlay = useCallback(
|
||||||
@@ -260,12 +260,12 @@ const Player = () => {
|
|||||||
sendNotification(
|
sendNotification(
|
||||||
song.title,
|
song.title,
|
||||||
`${song.artist} - ${song.album}`,
|
`${song.artist} - ${song.album}`,
|
||||||
info.cover
|
info.cover,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[context, dispatch, showNotifications, startTime]
|
[context, dispatch, showNotifications, startTime],
|
||||||
)
|
)
|
||||||
|
|
||||||
const onAudioPlayTrackChange = useCallback(() => {
|
const onAudioPlayTrackChange = useCallback(() => {
|
||||||
@@ -279,7 +279,7 @@ const Player = () => {
|
|||||||
|
|
||||||
const onAudioPause = useCallback(
|
const onAudioPause = useCallback(
|
||||||
(info) => dispatch(currentPlaying(info)),
|
(info) => dispatch(currentPlaying(info)),
|
||||||
[dispatch]
|
[dispatch],
|
||||||
)
|
)
|
||||||
|
|
||||||
const onAudioEnded = useCallback(
|
const onAudioEnded = useCallback(
|
||||||
@@ -291,7 +291,7 @@ const Player = () => {
|
|||||||
.getOne('keepalive', { id: info.trackId })
|
.getOne('keepalive', { id: info.trackId })
|
||||||
.catch((e) => console.log('Keepalive error:', e))
|
.catch((e) => console.log('Keepalive error:', e))
|
||||||
},
|
},
|
||||||
[dispatch, dataProvider]
|
[dispatch, dataProvider],
|
||||||
)
|
)
|
||||||
|
|
||||||
const onCoverClick = useCallback((mode, audioLists, audioInfo) => {
|
const onCoverClick = useCallback((mode, audioLists, audioInfo) => {
|
||||||
@@ -313,7 +313,7 @@ const Player = () => {
|
|||||||
|
|
||||||
const handlers = useMemo(
|
const handlers = useMemo(
|
||||||
() => keyHandlers(audioInstance, playerState),
|
() => keyHandlers(audioInstance, playerState),
|
||||||
[audioInstance, playerState]
|
[audioInstance, playerState],
|
||||||
)
|
)
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|||||||
@@ -1,14 +1,14 @@
|
|||||||
const keyHandlers = (audioInstance, playerState) => {
|
const keyHandlers = (audioInstance, playerState) => {
|
||||||
const nextSong = () => {
|
const nextSong = () => {
|
||||||
const idx = playerState.queue.findIndex(
|
const idx = playerState.queue.findIndex(
|
||||||
(item) => item.uuid === playerState.current.uuid
|
(item) => item.uuid === playerState.current.uuid,
|
||||||
)
|
)
|
||||||
return idx !== null ? playerState.queue[idx + 1] : null
|
return idx !== null ? playerState.queue[idx + 1] : null
|
||||||
}
|
}
|
||||||
|
|
||||||
const prevSong = () => {
|
const prevSong = () => {
|
||||||
const idx = playerState.queue.findIndex(
|
const idx = playerState.queue.findIndex(
|
||||||
(item) => item.uuid === playerState.current.uuid
|
(item) => item.uuid === playerState.current.uuid,
|
||||||
)
|
)
|
||||||
return idx !== null ? playerState.queue[idx - 1] : null
|
return idx !== null ? playerState.queue[idx - 1] : null
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ const useStyle = makeStyles(
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
{ name: 'NDAudioPlayer' }
|
{ name: 'NDAudioPlayer' },
|
||||||
)
|
)
|
||||||
|
|
||||||
export default useStyle
|
export default useStyle
|
||||||
|
|||||||
@@ -12,7 +12,10 @@ export const AddToPlaylistButton = ({ resource, selectedIds, className }) => {
|
|||||||
|
|
||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
dispatch(
|
dispatch(
|
||||||
openAddToPlaylist({ selectedIds, onSuccess: () => unselectAll(resource) })
|
openAddToPlaylist({
|
||||||
|
selectedIds,
|
||||||
|
onSuccess: () => unselectAll(resource),
|
||||||
|
}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,28 +14,31 @@ export const useGetHandleArtistClick = (width) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ArtistLinkField = withWidth()(
|
export const ArtistLinkField = withWidth()(({
|
||||||
({ record, className, width, source }) => {
|
record,
|
||||||
const artistLink = useGetHandleArtistClick(width)
|
className,
|
||||||
|
width,
|
||||||
|
source,
|
||||||
|
}) => {
|
||||||
|
const artistLink = useGetHandleArtistClick(width)
|
||||||
|
|
||||||
const id = record[source + 'Id']
|
const id = record[source + 'Id']
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{id ? (
|
{id ? (
|
||||||
<Link
|
<Link
|
||||||
to={artistLink(id)}
|
to={artistLink(id)}
|
||||||
onClick={(e) => e.stopPropagation()}
|
onClick={(e) => e.stopPropagation()}
|
||||||
className={className}
|
className={className}
|
||||||
>
|
>
|
||||||
{record[source]}
|
{record[source]}
|
||||||
</Link>
|
</Link>
|
||||||
) : (
|
) : (
|
||||||
record[source]
|
record[source]
|
||||||
)}
|
)}
|
||||||
</>
|
</>
|
||||||
)
|
)
|
||||||
}
|
})
|
||||||
)
|
|
||||||
|
|
||||||
ArtistLinkField.propTypes = {
|
ArtistLinkField.propTypes = {
|
||||||
record: PropTypes.object,
|
record: PropTypes.object,
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ const useStyles = makeStyles(
|
|||||||
top: '26px',
|
top: '26px',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ name: 'RaArtistSimpleList' }
|
{ name: 'RaArtistSimpleList' },
|
||||||
)
|
)
|
||||||
|
|
||||||
export const ArtistSimpleList = ({
|
export const ArtistSimpleList = ({
|
||||||
@@ -69,7 +69,7 @@ export const ArtistSimpleList = ({
|
|||||||
</ListItemSecondaryAction>
|
</ListItemSecondaryAction>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
</span>
|
</span>
|
||||||
)
|
),
|
||||||
)}
|
)}
|
||||||
</List>
|
</List>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export const BatchPlayButton = ({
|
|||||||
// Add tracks to a map for easy lookup by ID, needed for the next step
|
// Add tracks to a map for easy lookup by ID, needed for the next step
|
||||||
const tracks = response.data.reduce(
|
const tracks = response.data.reduce(
|
||||||
(acc, cur) => ({ ...acc, [cur.id]: cur }),
|
(acc, cur) => ({ ...acc, [cur.id]: cur }),
|
||||||
{}
|
{},
|
||||||
)
|
)
|
||||||
// Add the tracks to the queue in the selection order
|
// Add the tracks to the queue in the selection order
|
||||||
dispatch(action(tracks, selectedIds))
|
dispatch(action(tracks, selectedIds))
|
||||||
|
|||||||
@@ -18,8 +18,8 @@ export const BatchShareButton = ({ resource, selectedIds, className }) => {
|
|||||||
_: 'ra.action.bulk_actions',
|
_: 'ra.action.bulk_actions',
|
||||||
smart_count: selectedIds.length,
|
smart_count: selectedIds.length,
|
||||||
}),
|
}),
|
||||||
'message.shareBatchDialogTitle'
|
'message.shareBatchDialogTitle',
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
unselectAll(resource)
|
unselectAll(resource)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,8 +97,8 @@ const ContextMenu = ({
|
|||||||
record,
|
record,
|
||||||
record.duration !== undefined
|
record.duration !== undefined
|
||||||
? DOWNLOAD_MENU_ALBUM
|
? DOWNLOAD_MENU_ALBUM
|
||||||
: DOWNLOAD_MENU_ARTIST
|
: DOWNLOAD_MENU_ARTIST,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -127,7 +127,7 @@ const ContextMenu = ({
|
|||||||
let extractSongsData = function (response) {
|
let extractSongsData = function (response) {
|
||||||
const data = response.data.reduce(
|
const data = response.data.reduce(
|
||||||
(acc, cur) => ({ ...acc, [cur.id]: cur }),
|
(acc, cur) => ({ ...acc, [cur.id]: cur }),
|
||||||
{}
|
{},
|
||||||
)
|
)
|
||||||
const ids = response.data.map((r) => r.id)
|
const ids = response.data.map((r) => r.id)
|
||||||
return { data, ids }
|
return { data, ids }
|
||||||
@@ -186,7 +186,7 @@ const ContextMenu = ({
|
|||||||
<MenuItem value={key} key={key} onClick={handleItemClick}>
|
<MenuItem value={key} key={key} onClick={handleItemClick}>
|
||||||
{options[key].label}
|
{options[key].label}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
)
|
),
|
||||||
)}
|
)}
|
||||||
</Menu>
|
</Menu>
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ const useStyles = makeStyles(
|
|||||||
color: theme.palette.primary.main,
|
color: theme.palette.primary.main,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
{ name: 'RaLink' }
|
{ name: 'RaLink' },
|
||||||
)
|
)
|
||||||
|
|
||||||
const Linkify = ({ text, ...rest }) => {
|
const Linkify = ({ text, ...rest }) => {
|
||||||
@@ -45,7 +45,7 @@ const Linkify = ({ text, ...rest }) => {
|
|||||||
href={href}
|
href={href}
|
||||||
>
|
>
|
||||||
{href}
|
{href}
|
||||||
</Link>
|
</Link>,
|
||||||
)
|
)
|
||||||
|
|
||||||
lastIndex = match.index + href.length
|
lastIndex = match.index + href.length
|
||||||
@@ -57,7 +57,7 @@ const Linkify = ({ text, ...rest }) => {
|
|||||||
<span
|
<span
|
||||||
key={'last-span-key'}
|
key={'last-span-key'}
|
||||||
dangerouslySetInnerHTML={{ __html: text.substring(lastIndex) }}
|
dangerouslySetInnerHTML={{ __html: text.substring(lastIndex) }}
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export const LoveButton = ({
|
|||||||
toggleLove()
|
toggleLove()
|
||||||
e.stopPropagation()
|
e.stopPropagation()
|
||||||
},
|
},
|
||||||
[toggleLove]
|
[toggleLove],
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!config.enableFavourites) {
|
if (!config.enableFavourites) {
|
||||||
|
|||||||
@@ -39,11 +39,11 @@ export const MultiLineTextField = memo(
|
|||||||
key={md5(line + idx)}
|
key={md5(line + idx)}
|
||||||
dangerouslySetInnerHTML={{ __html: line }}
|
dangerouslySetInnerHTML={{ __html: line }}
|
||||||
/>
|
/>
|
||||||
)
|
),
|
||||||
)}
|
)}
|
||||||
</Typography>
|
</Typography>
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
MultiLineTextField.defaultProps = {
|
MultiLineTextField.defaultProps = {
|
||||||
|
|||||||
@@ -20,9 +20,9 @@ describe('<MultiLineTextField />', () => {
|
|||||||
record={{ id: 123, body }}
|
record={{ id: 123, body }}
|
||||||
emptyText="NA"
|
emptyText="NA"
|
||||||
source="body"
|
source="body"
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
expect(screen.getByText('NA')).toBeInTheDocument()
|
expect(screen.getByText('NA')).toBeInTheDocument()
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export const PlayButton = ({ record, size, className }) => {
|
|||||||
let extractSongsData = function (response) {
|
let extractSongsData = function (response) {
|
||||||
const data = response.data.reduce(
|
const data = response.data.reduce(
|
||||||
(acc, cur) => ({ ...acc, [cur.id]: cur }),
|
(acc, cur) => ({ ...acc, [cur.id]: cur }),
|
||||||
{}
|
{},
|
||||||
)
|
)
|
||||||
const ids = response.data.map((r) => r.id)
|
const ids = response.data.map((r) => r.id)
|
||||||
return { data, ids }
|
return { data, ids }
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ const useStyle = makeStyles(
|
|||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
name: 'NDQualityInfo',
|
name: 'NDQualityInfo',
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
export const QualityInfo = ({ record, size, gainMode, preAmp, className }) => {
|
export const QualityInfo = ({ record, size, gainMode, preAmp, className }) => {
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ describe('QuickFilter', () => {
|
|||||||
resource={'song'}
|
resource={'song'}
|
||||||
source={'name'}
|
source={'name'}
|
||||||
label={<StarIcon data-testid="label-icon-test" />}
|
label={<StarIcon data-testid="label-icon-test" />}
|
||||||
/>
|
/>,
|
||||||
)
|
)
|
||||||
expect(screen.getByTestId('label-icon-test')).not.toBeNull()
|
expect(screen.getByTestId('label-icon-test')).not.toBeNull()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export const RatingField = ({
|
|||||||
(e, val) => {
|
(e, val) => {
|
||||||
rate(val, e.target.name)
|
rate(val, e.target.name)
|
||||||
},
|
},
|
||||||
[rate]
|
[rate],
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -50,7 +50,7 @@ export const RatingField = ({
|
|||||||
className={clsx(
|
className={clsx(
|
||||||
className,
|
className,
|
||||||
classes.rating,
|
classes.rating,
|
||||||
rating > 0 ? classes.show : classes.hide
|
rating > 0 ? classes.show : classes.hide,
|
||||||
)}
|
)}
|
||||||
value={rating}
|
value={rating}
|
||||||
size={size}
|
size={size}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ const useStyles = makeStyles(
|
|||||||
},
|
},
|
||||||
tertiary: { float: 'right', opacity: 0.541176 },
|
tertiary: { float: 'right', opacity: 0.541176 },
|
||||||
},
|
},
|
||||||
{ name: 'RaSimpleList' }
|
{ name: 'RaSimpleList' },
|
||||||
)
|
)
|
||||||
|
|
||||||
const LinkOrNot = ({
|
const LinkOrNot = ({
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export const SongContextMenu = ({
|
|||||||
openAddToPlaylist({
|
openAddToPlaylist({
|
||||||
selectedIds: [record.mediaFileId || record.id],
|
selectedIds: [record.mediaFileId || record.id],
|
||||||
onSuccess: (id) => onAddToPlaylist(id),
|
onSuccess: (id) => onAddToPlaylist(id),
|
||||||
})
|
}),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
share: {
|
share: {
|
||||||
@@ -69,7 +69,11 @@ export const SongContextMenu = ({
|
|||||||
label: translate('ra.action.share'),
|
label: translate('ra.action.share'),
|
||||||
action: (record) =>
|
action: (record) =>
|
||||||
dispatch(
|
dispatch(
|
||||||
openShareMenu([record.mediaFileId || record.id], 'song', record.title)
|
openShareMenu(
|
||||||
|
[record.mediaFileId || record.id],
|
||||||
|
'song',
|
||||||
|
record.title,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
download: {
|
download: {
|
||||||
@@ -127,7 +131,7 @@ export const SongContextMenu = ({
|
|||||||
<MenuItem value={key} key={key} onClick={handleItemClick}>
|
<MenuItem value={key} key={key} onClick={handleItemClick}>
|
||||||
{options[key].label}
|
{options[key].label}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
)
|
),
|
||||||
)}
|
)}
|
||||||
</Menu>
|
</Menu>
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ const ReleaseRow = forwardRef(
|
|||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
const DiscSubtitleRow = forwardRef(
|
const DiscSubtitleRow = forwardRef(
|
||||||
@@ -141,7 +141,7 @@ const DiscSubtitleRow = forwardRef(
|
|||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
export const SongDatagridRow = ({
|
export const SongDatagridRow = ({
|
||||||
@@ -156,7 +156,7 @@ export const SongDatagridRow = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const classes = useStyles()
|
const classes = useStyles()
|
||||||
const fields = React.Children.toArray(children).filter((c) =>
|
const fields = React.Children.toArray(children).filter((c) =>
|
||||||
isValidElement(c)
|
isValidElement(c),
|
||||||
)
|
)
|
||||||
|
|
||||||
const [, dragDiscRef] = useDrag(
|
const [, dragDiscRef] = useDrag(
|
||||||
@@ -173,7 +173,7 @@ export const SongDatagridRow = ({
|
|||||||
},
|
},
|
||||||
options: { dropEffect: 'copy' },
|
options: { dropEffect: 'copy' },
|
||||||
}),
|
}),
|
||||||
[record]
|
[record],
|
||||||
)
|
)
|
||||||
|
|
||||||
const [, dragSongRef] = useDrag(
|
const [, dragSongRef] = useDrag(
|
||||||
@@ -182,7 +182,7 @@ export const SongDatagridRow = ({
|
|||||||
item: { ids: [record?.mediaFileId || record?.id] },
|
item: { ids: [record?.mediaFileId || record?.id] },
|
||||||
options: { dropEffect: 'copy' },
|
options: { dropEffect: 'copy' },
|
||||||
}),
|
}),
|
||||||
[record]
|
[record],
|
||||||
)
|
)
|
||||||
|
|
||||||
if (!record || !record.title) {
|
if (!record || !record.title) {
|
||||||
@@ -251,14 +251,14 @@ const SongDatagridBody = ({
|
|||||||
idsToPlay = ids.filter(
|
idsToPlay = ids.filter(
|
||||||
(id) =>
|
(id) =>
|
||||||
data[id].releaseDate === releaseDate &&
|
data[id].releaseDate === releaseDate &&
|
||||||
data[id].discNumber === discNumber
|
data[id].discNumber === discNumber,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
idsToPlay = ids.filter((id) => data[id].releaseDate === releaseDate)
|
idsToPlay = ids.filter((id) => data[id].releaseDate === releaseDate)
|
||||||
}
|
}
|
||||||
dispatch(playTracks(data, idsToPlay))
|
dispatch(playTracks(data, idsToPlay))
|
||||||
},
|
},
|
||||||
[dispatch, data, ids]
|
[dispatch, data, ids],
|
||||||
)
|
)
|
||||||
|
|
||||||
const firstTracksOfDiscs = useMemo(() => {
|
const firstTracksOfDiscs = useMemo(() => {
|
||||||
@@ -280,7 +280,7 @@ const SongDatagridBody = ({
|
|||||||
acc.push(id)
|
acc.push(id)
|
||||||
}
|
}
|
||||||
return acc
|
return acc
|
||||||
}, [])
|
}, []),
|
||||||
)
|
)
|
||||||
if (!showDiscSubtitles || (set.size < 2 && !foundSubtitle)) {
|
if (!showDiscSubtitles || (set.size < 2 && !foundSubtitle)) {
|
||||||
set.clear()
|
set.clear()
|
||||||
@@ -304,7 +304,7 @@ const SongDatagridBody = ({
|
|||||||
acc.push(id)
|
acc.push(id)
|
||||||
}
|
}
|
||||||
return acc
|
return acc
|
||||||
}, [])
|
}, []),
|
||||||
)
|
)
|
||||||
if (!showReleaseDivider || set.size < 2) {
|
if (!showReleaseDivider || set.size < 2) {
|
||||||
set.clear()
|
set.clear()
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ const useStyles = makeStyles(
|
|||||||
top: '26px',
|
top: '26px',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{ name: 'RaSongSimpleList' }
|
{ name: 'RaSongSimpleList' },
|
||||||
)
|
)
|
||||||
|
|
||||||
export const SongSimpleList = ({
|
export const SongSimpleList = ({
|
||||||
@@ -108,7 +108,7 @@ export const SongSimpleList = ({
|
|||||||
</ListItemSecondaryAction>
|
</ListItemSecondaryAction>
|
||||||
</ListItem>
|
</ListItem>
|
||||||
</span>
|
</span>
|
||||||
)
|
),
|
||||||
)}
|
)}
|
||||||
</List>
|
</List>
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ export const ToggleFieldsMenu = ({
|
|||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const translate = useTranslate()
|
const translate = useTranslate()
|
||||||
const toggleableColumns = useSelector(
|
const toggleableColumns = useSelector(
|
||||||
(state) => state.settings.toggleableFields[resource]
|
(state) => state.settings.toggleableFields[resource],
|
||||||
)
|
)
|
||||||
const omittedColumns =
|
const omittedColumns =
|
||||||
useSelector((state) => state.settings.omittedFields[resource]) || []
|
useSelector((state) => state.settings.omittedFields[resource]) || []
|
||||||
@@ -58,7 +58,7 @@ export const ToggleFieldsMenu = ({
|
|||||||
...toggleableColumns,
|
...toggleableColumns,
|
||||||
[selectedColumn]: !toggleableColumns[selectedColumn],
|
[selectedColumn]: !toggleableColumns[selectedColumn],
|
||||||
},
|
},
|
||||||
})
|
}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,7 +95,7 @@ export const ToggleFieldsMenu = ({
|
|||||||
<Checkbox checked={val} />
|
<Checkbox checked={val} />
|
||||||
{translate(`resources.${resource}.fields.${key}`)}
|
{translate(`resources.${resource}.fields.${key}`)}
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
) : null
|
) : null,
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ export const Writable = (props) => {
|
|||||||
const { record = {}, children } = props
|
const { record = {}, children } = props
|
||||||
if (isWritable(record.ownerId)) {
|
if (isWritable(record.ownerId)) {
|
||||||
return Children.map(children, (child) =>
|
return Children.map(children, (child) =>
|
||||||
isValidElement(child) ? cloneElement(child, props) : child
|
isValidElement(child) ? cloneElement(child, props) : child,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ const getPerPageOptions = (width) => {
|
|||||||
export const useAlbumsPerPage = (width) => {
|
export const useAlbumsPerPage = (width) => {
|
||||||
const perPage =
|
const perPage =
|
||||||
useSelector(
|
useSelector(
|
||||||
(state) => state?.admin.resources?.album?.list?.params?.perPage
|
(state) => state?.admin.resources?.album?.list?.params?.perPage,
|
||||||
) || getPerPage(width)
|
) || getPerPage(width)
|
||||||
|
|
||||||
return [perPage, getPerPageOptions(width)]
|
return [perPage, getPerPageOptions(width)]
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ export const useResourceRefresh = (...visibleResources) => {
|
|||||||
const refresh = useRefresh()
|
const refresh = useRefresh()
|
||||||
const dataProvider = useDataProvider()
|
const dataProvider = useDataProvider()
|
||||||
const refreshData = useSelector(
|
const refreshData = useSelector(
|
||||||
(state) => state.activity?.refresh || { lastReceived: lastTime }
|
(state) => state.activity?.refresh || { lastReceived: lastTime },
|
||||||
)
|
)
|
||||||
const { resources, lastReceived } = refreshData
|
const { resources, lastReceived } = refreshData
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ export const useSelectedFields = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const resourceFields = useSelector(
|
const resourceFields = useSelector(
|
||||||
(state) => state.settings.toggleableFields
|
(state) => state.settings.toggleableFields,
|
||||||
)?.[resource]
|
)?.[resource]
|
||||||
const omittedFields = useSelector((state) => state.settings.omittedFields)?.[
|
const omittedFields = useSelector((state) => state.settings.omittedFields)?.[
|
||||||
resource
|
resource
|
||||||
@@ -81,7 +81,7 @@ useSelectedFields.propTypes = {
|
|||||||
export const useSetToggleableFields = (
|
export const useSetToggleableFields = (
|
||||||
resource,
|
resource,
|
||||||
toggleableColumns,
|
toggleableColumns,
|
||||||
defaultOff = []
|
defaultOff = [],
|
||||||
) => {
|
) => {
|
||||||
const current = useSelector((state) => state.settings.toggleableFields)?.album
|
const current = useSelector((state) => state.settings.toggleableFields)?.album
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
@@ -95,7 +95,7 @@ export const useSetToggleableFields = (
|
|||||||
...{ [cur]: true },
|
...{ [cur]: true },
|
||||||
}
|
}
|
||||||
}, {}),
|
}, {}),
|
||||||
})
|
}),
|
||||||
)
|
)
|
||||||
dispatch(setOmittedFields({ [resource]: defaultOff }))
|
dispatch(setOmittedFields({ [resource]: defaultOff }))
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -16,7 +16,7 @@ DraggableTypes.ALL.push(
|
|||||||
DraggableTypes.SONG,
|
DraggableTypes.SONG,
|
||||||
DraggableTypes.ALBUM,
|
DraggableTypes.ALBUM,
|
||||||
DraggableTypes.DISC,
|
DraggableTypes.DISC,
|
||||||
DraggableTypes.ARTIST
|
DraggableTypes.ARTIST,
|
||||||
)
|
)
|
||||||
|
|
||||||
export const DEFAULT_SHARE_BITRATE = 128
|
export const DEFAULT_SHARE_BITRATE = 128
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ describe('<LinkToVersion />', () => {
|
|||||||
|
|
||||||
const link = screen.queryByRole('link')
|
const link = screen.queryByRole('link')
|
||||||
expect(link.href).toBe(
|
expect(link.href).toBe(
|
||||||
'https://github.com/navidrome/navidrome/releases/tag/v0.40.0'
|
'https://github.com/navidrome/navidrome/releases/tag/v0.40.0',
|
||||||
)
|
)
|
||||||
expect(link.textContent).toBe('0.40.0')
|
expect(link.textContent).toBe('0.40.0')
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ describe('<LinkToVersion />', () => {
|
|||||||
|
|
||||||
const link = screen.queryByRole('link')
|
const link = screen.queryByRole('link')
|
||||||
expect(link.href).toBe(
|
expect(link.href).toBe(
|
||||||
'https://github.com/navidrome/navidrome/compare/v0.40.0...300a0292'
|
'https://github.com/navidrome/navidrome/compare/v0.40.0...300a0292',
|
||||||
)
|
)
|
||||||
expect(link.textContent).toBe('0.40.0-SNAPSHOT')
|
expect(link.textContent).toBe('0.40.0-SNAPSHOT')
|
||||||
|
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ export const AddToPlaylistDialog = () => {
|
|||||||
const tracks = res.json
|
const tracks = res.json
|
||||||
if (tracks) {
|
if (tracks) {
|
||||||
const dupSng = tracks.filter((song) =>
|
const dupSng = tracks.filter((song) =>
|
||||||
selectedIds.some((id) => id === song.mediaFileId)
|
selectedIds.some((id) => id === song.mediaFileId),
|
||||||
)
|
)
|
||||||
|
|
||||||
if (dupSng.length) {
|
if (dupSng.length) {
|
||||||
@@ -128,7 +128,7 @@ export const AddToPlaylistDialog = () => {
|
|||||||
}
|
}
|
||||||
const handleSkip = () => {
|
const handleSkip = () => {
|
||||||
const distinctSongs = selectedIds.filter(
|
const distinctSongs = selectedIds.filter(
|
||||||
(id) => duplicateIds.indexOf(id) < 0
|
(id) => duplicateIds.indexOf(id) < 0,
|
||||||
)
|
)
|
||||||
value.slice(-1).pop().distinctIds = distinctSongs
|
value.slice(-1).pop().distinctIds = distinctSongs
|
||||||
dispatch(closeDuplicateSongDialog())
|
dispatch(closeDuplicateSongDialog())
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ const createTestUtils = (mockDataProvider) =>
|
|||||||
>
|
>
|
||||||
<AddToPlaylistDialog />
|
<AddToPlaylistDialog />
|
||||||
</TestContext>
|
</TestContext>
|
||||||
</DataProviderContext.Provider>
|
</DataProviderContext.Provider>,
|
||||||
)
|
)
|
||||||
|
|
||||||
jest.mock('../dataProvider', () => ({
|
jest.mock('../dataProvider', () => ({
|
||||||
@@ -104,7 +104,7 @@ describe('AddToPlaylistDialog', () => {
|
|||||||
{
|
{
|
||||||
data: { ids: selectedIds },
|
data: { ids: selectedIds },
|
||||||
filter: { playlist_id: 'sample-id1' },
|
filter: { playlist_id: 'sample-id1' },
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
@@ -114,7 +114,7 @@ describe('AddToPlaylistDialog', () => {
|
|||||||
{
|
{
|
||||||
data: { ids: selectedIds },
|
data: { ids: selectedIds },
|
||||||
filter: { playlist_id: 'sample-id2' },
|
filter: { playlist_id: 'sample-id2' },
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@@ -153,7 +153,7 @@ describe('AddToPlaylistDialog', () => {
|
|||||||
{
|
{
|
||||||
data: { ids: selectedIds },
|
data: { ids: selectedIds },
|
||||||
filter: { playlist_id: 'created-id1' },
|
filter: { playlist_id: 'created-id1' },
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import { useTranscodingOptions } from './useTranscodingOptions'
|
|||||||
|
|
||||||
const DownloadMenuDialog = () => {
|
const DownloadMenuDialog = () => {
|
||||||
const { open, record, recordType } = useSelector(
|
const { open, record, recordType } = useSelector(
|
||||||
(state) => state.downloadMenuDialog
|
(state) => state.downloadMenuDialog,
|
||||||
)
|
)
|
||||||
const dispatch = useDispatch()
|
const dispatch = useDispatch()
|
||||||
const translate = useTranslate()
|
const translate = useTranslate()
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ const HelpTable = (props) => {
|
|||||||
</TableContainer>
|
</TableContainer>
|
||||||
</DialogContent>
|
</DialogContent>
|
||||||
</Dialog>,
|
</Dialog>,
|
||||||
document.body
|
document.body,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ export const ListenBrainzTokenDialog = ({ setLinked }) => {
|
|||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
[dispatch, notify, setLinked, token]
|
[dispatch, notify, setLinked, token],
|
||||||
)
|
)
|
||||||
|
|
||||||
const handleClickClose = (event) => {
|
const handleClickClose = (event) => {
|
||||||
@@ -74,7 +74,7 @@ export const ListenBrainzTokenDialog = ({ setLinked }) => {
|
|||||||
handleSave(event)
|
handleSave(event)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[token, handleSave]
|
[token, handleSave],
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ export const SelectPlaylistInput = ({ onChange }) => {
|
|||||||
'playlist',
|
'playlist',
|
||||||
{ page: 1, perPage: -1 },
|
{ page: 1, perPage: -1 },
|
||||||
{ field: 'name', order: 'ASC' },
|
{ field: 'name', order: 'ASC' },
|
||||||
{ smart: false }
|
{ smart: false },
|
||||||
)
|
)
|
||||||
|
|
||||||
const options =
|
const options =
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ describe('SelectPlaylistInput', () => {
|
|||||||
>
|
>
|
||||||
<SelectPlaylistInput onChange={onChangeHandler} />
|
<SelectPlaylistInput onChange={onChangeHandler} />
|
||||||
</TestContext>
|
</TestContext>
|
||||||
</DataProviderContext.Provider>
|
</DataProviderContext.Provider>,
|
||||||
)
|
)
|
||||||
|
|
||||||
await waitFor(() => {
|
await waitFor(() => {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ export const ShareDialog = () => {
|
|||||||
const translate = useTranslate()
|
const translate = useTranslate()
|
||||||
const [description, setDescription] = useState('')
|
const [description, setDescription] = useState('')
|
||||||
const [downloadable, setDownloadable] = useState(
|
const [downloadable, setDownloadable] = useState(
|
||||||
config.defaultDownloadableShare && config.enableDownloads
|
config.defaultDownloadableShare && config.enableDownloads,
|
||||||
)
|
)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setDescription('')
|
setDescription('')
|
||||||
@@ -66,7 +66,7 @@ export const ShareDialog = () => {
|
|||||||
type: 'warning',
|
type: 'warning',
|
||||||
multiLine: true,
|
multiLine: true,
|
||||||
duration: 0,
|
duration: 0,
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
} else prompt(translate('message.shareCopyToClipboard'), url)
|
} else prompt(translate('message.shareCopyToClipboard'), url)
|
||||||
@@ -75,7 +75,7 @@ export const ShareDialog = () => {
|
|||||||
notify(translate('ra.page.error') + ': ' + error.message, {
|
notify(translate('ra.page.error') + ': ' + error.message, {
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
}),
|
}),
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
const handleShare = (e) => {
|
const handleShare = (e) => {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ export const useTranscodingOptions = () => {
|
|||||||
page: 1,
|
page: 1,
|
||||||
perPage: 1000,
|
perPage: 1000,
|
||||||
},
|
},
|
||||||
{ field: 'name', order: 'ASC' }
|
{ field: 'name', order: 'ASC' },
|
||||||
)
|
)
|
||||||
|
|
||||||
const formatOptions = useMemo(
|
const formatOptions = useMemo(
|
||||||
@@ -30,7 +30,7 @@ export const useTranscodingOptions = () => {
|
|||||||
: Object.values(formats).map((f) => {
|
: Object.values(formats).map((f) => {
|
||||||
return { id: f.targetFormat, name: f.name }
|
return { id: f.targetFormat, name: f.name }
|
||||||
}),
|
}),
|
||||||
[formats, loadingFormats]
|
[formats, loadingFormats],
|
||||||
)
|
)
|
||||||
|
|
||||||
const handleOriginal = useCallback(
|
const handleOriginal = useCallback(
|
||||||
@@ -41,7 +41,7 @@ export const useTranscodingOptions = () => {
|
|||||||
setMaxBitRate(DEFAULT_SHARE_BITRATE)
|
setMaxBitRate(DEFAULT_SHARE_BITRATE)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[setUseOriginalFormat, setFormat, setMaxBitRate]
|
[setUseOriginalFormat, setFormat, setMaxBitRate],
|
||||||
)
|
)
|
||||||
|
|
||||||
const TranscodingOptionsInput = useMemo(() => {
|
const TranscodingOptionsInput = useMemo(() => {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ const startEventStream = async (dispatchFn) => {
|
|||||||
newStream.addEventListener('serverStart', eventHandler(dispatchFn))
|
newStream.addEventListener('serverStart', eventHandler(dispatchFn))
|
||||||
newStream.addEventListener(
|
newStream.addEventListener(
|
||||||
'scanStatus',
|
'scanStatus',
|
||||||
throttledEventHandler(dispatchFn)
|
throttledEventHandler(dispatchFn),
|
||||||
)
|
)
|
||||||
newStream.addEventListener('refreshResource', eventHandler(dispatchFn))
|
newStream.addEventListener('refreshResource', eventHandler(dispatchFn))
|
||||||
newStream.addEventListener('keepAlive', eventHandler(dispatchFn))
|
newStream.addEventListener('keepAlive', eventHandler(dispatchFn))
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ const useGetLanguageChoices = () => {
|
|||||||
'translation',
|
'translation',
|
||||||
{ page: 1, perPage: -1 },
|
{ page: 1, perPage: -1 },
|
||||||
{ field: '', order: '' },
|
{ field: '', order: '' },
|
||||||
{}
|
{},
|
||||||
)
|
)
|
||||||
|
|
||||||
const choices = [{ id: 'en', name: 'English' }]
|
const choices = [{ id: 'en', name: 'English' }]
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ const useStyles = makeStyles(
|
|||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
name: 'NDAppBar',
|
name: 'NDAppBar',
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
const AboutMenuItem = forwardRef(({ onClick, ...rest }, ref) => {
|
const AboutMenuItem = forwardRef(({ onClick, ...rest }, ref) => {
|
||||||
@@ -90,7 +90,7 @@ const CustomUserMenu = ({ onClick, ...rest }) => {
|
|||||||
}
|
}
|
||||||
return renderSettingsMenuItemLink(
|
return renderSettingsMenuItemLink(
|
||||||
userResource,
|
userResource,
|
||||||
permissions !== 'admin' ? localStorage.getItem('userId') : null
|
permissions !== 'admin' ? localStorage.getItem('userId') : null,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ describe('<DynamicMenuIcon />', () => {
|
|||||||
render(
|
render(
|
||||||
<Router history={history}>
|
<Router history={history}>
|
||||||
<DynamicMenuIcon icon={StarIcon} path={'test'} />
|
<DynamicMenuIcon icon={StarIcon} path={'test'} />
|
||||||
</Router>
|
</Router>,
|
||||||
)
|
)
|
||||||
expect(screen.getByTestId('icon')).not.toBeNull()
|
expect(screen.getByTestId('icon')).not.toBeNull()
|
||||||
})
|
})
|
||||||
@@ -34,7 +34,7 @@ describe('<DynamicMenuIcon />', () => {
|
|||||||
activeIcon={StarBorderIcon}
|
activeIcon={StarBorderIcon}
|
||||||
path={'otherpath'}
|
path={'otherpath'}
|
||||||
/>
|
/>
|
||||||
</Router>
|
</Router>,
|
||||||
)
|
)
|
||||||
expect(screen.getByTestId('icon')).not.toBeNull()
|
expect(screen.getByTestId('icon')).not.toBeNull()
|
||||||
})
|
})
|
||||||
@@ -51,7 +51,7 @@ describe('<DynamicMenuIcon />', () => {
|
|||||||
activeIcon={StarBorderIcon}
|
activeIcon={StarBorderIcon}
|
||||||
path={'path'}
|
path={'path'}
|
||||||
/>
|
/>
|
||||||
</Router>
|
</Router>,
|
||||||
)
|
)
|
||||||
expect(screen.getByTestId('activeIcon')).not.toBeNull()
|
expect(screen.getByTestId('activeIcon')).not.toBeNull()
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ const useStyles = makeStyles(
|
|||||||
textDecoration: 'none',
|
textDecoration: 'none',
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
{ name: 'NDLogin' }
|
{ name: 'NDLogin' },
|
||||||
)
|
)
|
||||||
|
|
||||||
const renderInput = ({
|
const renderInput = ({
|
||||||
@@ -263,14 +263,14 @@ const Login = ({ location }) => {
|
|||||||
typeof error === 'string'
|
typeof error === 'string'
|
||||||
? error
|
? error
|
||||||
: typeof error === 'undefined' || !error.message
|
: typeof error === 'undefined' || !error.message
|
||||||
? 'ra.auth.sign_in_error'
|
? 'ra.auth.sign_in_error'
|
||||||
: error.message,
|
: error.message,
|
||||||
'warning'
|
'warning',
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
[dispatch, login, notify, setLoading, location]
|
[dispatch, login, notify, setLoading, location],
|
||||||
)
|
)
|
||||||
|
|
||||||
const validateLogin = useCallback(
|
const validateLogin = useCallback(
|
||||||
@@ -284,7 +284,7 @@ const Login = ({ location }) => {
|
|||||||
}
|
}
|
||||||
return errors
|
return errors
|
||||||
},
|
},
|
||||||
[translate]
|
[translate],
|
||||||
)
|
)
|
||||||
|
|
||||||
const validateSignup = useCallback(
|
const validateSignup = useCallback(
|
||||||
@@ -302,7 +302,7 @@ const Login = ({ location }) => {
|
|||||||
}
|
}
|
||||||
return errors
|
return errors
|
||||||
},
|
},
|
||||||
[translate, validateLogin]
|
[translate, validateLogin],
|
||||||
)
|
)
|
||||||
|
|
||||||
if (config.firstTime) {
|
if (config.firstTime) {
|
||||||
@@ -348,7 +348,7 @@ const LoginWithTheme = (props) => {
|
|||||||
})
|
})
|
||||||
.catch((e) => {
|
.catch((e) => {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
'Cannot load language "' + config.defaultLanguage + '": ' + e
|
'Cannot load language "' + config.defaultLanguage + '": ' + e,
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -121,7 +121,7 @@ const Menu = ({ dense = false }) => {
|
|||||||
dense={dense}
|
dense={dense}
|
||||||
>
|
>
|
||||||
{Object.keys(albumLists).map((type) =>
|
{Object.keys(albumLists).map((type) =>
|
||||||
renderAlbumMenuItemLink(type, albumLists[type])
|
renderAlbumMenuItemLink(type, albumLists[type]),
|
||||||
)}
|
)}
|
||||||
</SubMenu>
|
</SubMenu>
|
||||||
{resources.filter(subItems(undefined)).map(renderResourceMenuItemLink)}
|
{resources.filter(subItems(undefined)).map(renderResourceMenuItemLink)}
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ const PlaylistsSubMenu = ({ state, setState, sidebarIsOpen, dense }) => {
|
|||||||
|
|
||||||
const onPlaylistConfig = useCallback(
|
const onPlaylistConfig = useCallback(
|
||||||
() => history.push('/playlist'),
|
() => history.push('/playlist'),
|
||||||
[history]
|
[history],
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ const useStyles = makeStyles(
|
|||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
name: 'NDSubMenu',
|
name: 'NDSubMenu',
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
const SubMenu = ({
|
const SubMenu = ({
|
||||||
|
|||||||
@@ -118,7 +118,7 @@ const UserMenu = (props) => {
|
|||||||
? cloneElement(menuItem, {
|
? cloneElement(menuItem, {
|
||||||
onClick: handleClose,
|
onClick: handleClose,
|
||||||
})
|
})
|
||||||
: null
|
: null,
|
||||||
)}
|
)}
|
||||||
{!config.auth && logout}
|
{!config.auth && logout}
|
||||||
</MenuList>
|
</MenuList>
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ const Progress = (props) => {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const callbackEndpoint = baseUrl(
|
const callbackEndpoint = baseUrl(
|
||||||
`/api/lastfm/link/callback?uid=${localStorage.getItem('userId')}`
|
`/api/lastfm/link/callback?uid=${localStorage.getItem('userId')}`,
|
||||||
)
|
)
|
||||||
const callbackUrl = `${window.location.origin}${callbackEndpoint}`
|
const callbackUrl = `${window.location.origin}${callbackEndpoint}`
|
||||||
openedTab.current = openInNewTab(
|
openedTab.current = openInNewTab(
|
||||||
`https://www.last.fm/api/auth/?api_key=${config.lastFMApiKey}&cb=${callbackUrl}`
|
`https://www.last.fm/api/auth/?api_key=${config.lastFMApiKey}&cb=${callbackUrl}`,
|
||||||
)
|
)
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ export const SelectTheme = (props) => {
|
|||||||
themeChoices.push(
|
themeChoices.push(
|
||||||
...Object.keys(themes).map((key) => {
|
...Object.keys(themes).map((key) => {
|
||||||
return { id: key, name: themes[key].themeName }
|
return { id: key, name: themes[key].themeName }
|
||||||
})
|
}),
|
||||||
)
|
)
|
||||||
themeChoices.push({
|
themeChoices.push({
|
||||||
id: helpKey,
|
id: helpKey,
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ const PlaylistActions = ({ className, ids, data, record, ...rest }) => {
|
|||||||
.then((res) => {
|
.then((res) => {
|
||||||
const data = res.data.reduce(
|
const data = res.data.reduce(
|
||||||
(acc, curr) => ({ ...acc, [curr.id]: curr }),
|
(acc, curr) => ({ ...acc, [curr.id]: curr }),
|
||||||
{}
|
{},
|
||||||
)
|
)
|
||||||
dispatch(action(data))
|
dispatch(action(data))
|
||||||
})
|
})
|
||||||
@@ -67,7 +67,7 @@ const PlaylistActions = ({ className, ids, data, record, ...rest }) => {
|
|||||||
notify('ra.page.error', 'warning')
|
notify('ra.page.error', 'warning')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
[dataProvider, dispatch, record, data, ids, notify]
|
[dataProvider, dispatch, record, data, ids, notify],
|
||||||
)
|
)
|
||||||
|
|
||||||
const handlePlay = React.useCallback(() => {
|
const handlePlay = React.useCallback(() => {
|
||||||
@@ -108,7 +108,7 @@ const PlaylistActions = ({ className, ids, data, record, ...rest }) => {
|
|||||||
link.click()
|
link.click()
|
||||||
link.parentNode.removeChild(link)
|
link.parentNode.removeChild(link)
|
||||||
}),
|
}),
|
||||||
[record]
|
[record],
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ const useStyles = makeStyles(
|
|||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
name: 'NDPlaylistDetails',
|
name: 'NDPlaylistDetails',
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
const PlaylistDetails = (props) => {
|
const PlaylistDetails = (props) => {
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ const TogglePublicInput = ({ resource, source }) => {
|
|||||||
console.log(error)
|
console.log(error)
|
||||||
notify('ra.page.error', 'warning')
|
notify('ra.page.error', 'warning')
|
||||||
},
|
},
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
const handleClick = (e) => {
|
const handleClick = (e) => {
|
||||||
@@ -108,7 +108,7 @@ const PlaylistList = (props) => {
|
|||||||
),
|
),
|
||||||
comment: <TextField source="comment" />,
|
comment: <TextField source="comment" />,
|
||||||
}),
|
}),
|
||||||
[isDesktop, isXsmall]
|
[isDesktop, isXsmall],
|
||||||
)
|
)
|
||||||
|
|
||||||
const columns = useSelectedFields({
|
const columns = useSelectedFields({
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ const useStyles = makeStyles(
|
|||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
name: 'NDPlaylistShow',
|
name: 'NDPlaylistShow',
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
const PlaylistShowLayout = (props) => {
|
const PlaylistShowLayout = (props) => {
|
||||||
|
|||||||
@@ -72,7 +72,7 @@ const useStyles = makeStyles(
|
|||||||
visibility: (props) => (props.isDesktop ? 'hidden' : 'visible'),
|
visibility: (props) => (props.isDesktop ? 'hidden' : 'visible'),
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
{ name: 'RaList' }
|
{ name: 'RaList' },
|
||||||
)
|
)
|
||||||
|
|
||||||
const ReorderableList = ({ readOnly, children, ...rest }) => {
|
const ReorderableList = ({ readOnly, children, ...rest }) => {
|
||||||
@@ -99,7 +99,7 @@ const PlaylistSongs = ({ playlistId, readOnly, actions, ...props }) => {
|
|||||||
refetch()
|
refetch()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[playlistId, refetch]
|
[playlistId, refetch],
|
||||||
)
|
)
|
||||||
|
|
||||||
const reorder = useCallback(
|
const reorder = useCallback(
|
||||||
@@ -117,7 +117,7 @@ const PlaylistSongs = ({ playlistId, readOnly, actions, ...props }) => {
|
|||||||
notify('ra.page.error', 'warning')
|
notify('ra.page.error', 'warning')
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
[dataProvider, notify, refetch]
|
[dataProvider, notify, refetch],
|
||||||
)
|
)
|
||||||
|
|
||||||
const handleDragEnd = useCallback(
|
const handleDragEnd = useCallback(
|
||||||
@@ -126,7 +126,7 @@ const PlaylistSongs = ({ playlistId, readOnly, actions, ...props }) => {
|
|||||||
const fromId = ids[from]
|
const fromId = ids[from]
|
||||||
reorder(playlistId, fromId, toId)
|
reorder(playlistId, fromId, toId)
|
||||||
},
|
},
|
||||||
[playlistId, reorder, ids]
|
[playlistId, reorder, ids],
|
||||||
)
|
)
|
||||||
|
|
||||||
const toggleableFields = useMemo(() => {
|
const toggleableFields = useMemo(() => {
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ export const StreamField = (props) => {
|
|||||||
evt.preventDefault()
|
evt.preventDefault()
|
||||||
dispatch(setTrack(await songFromRadio(record)))
|
dispatch(setTrack(await songFromRadio(record)))
|
||||||
},
|
},
|
||||||
[dispatch, record]
|
[dispatch, record],
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ export const albumViewReducer = (
|
|||||||
previousState = {
|
previousState = {
|
||||||
grid: true,
|
grid: true,
|
||||||
},
|
},
|
||||||
payload
|
payload,
|
||||||
) => {
|
) => {
|
||||||
const { type } = payload
|
const { type } = payload
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ export const shareDialogReducer = (
|
|||||||
resource: '',
|
resource: '',
|
||||||
name: '',
|
name: '',
|
||||||
},
|
},
|
||||||
payload
|
payload,
|
||||||
) => {
|
) => {
|
||||||
const { type, ids, resource, name, label } = payload
|
const { type, ids, resource, name, label } = payload
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@@ -52,7 +52,7 @@ export const addToPlaylistDialogReducer = (
|
|||||||
open: false,
|
open: false,
|
||||||
duplicateSong: false,
|
duplicateSong: false,
|
||||||
},
|
},
|
||||||
payload
|
payload,
|
||||||
) => {
|
) => {
|
||||||
const { type } = payload
|
const { type } = payload
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@@ -82,7 +82,7 @@ export const downloadMenuDialogReducer = (
|
|||||||
previousState = {
|
previousState = {
|
||||||
open: false,
|
open: false,
|
||||||
},
|
},
|
||||||
payload
|
payload,
|
||||||
) => {
|
) => {
|
||||||
const { type } = payload
|
const { type } = payload
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@@ -125,7 +125,7 @@ export const expandInfoDialogReducer = (
|
|||||||
previousState = {
|
previousState = {
|
||||||
open: false,
|
open: false,
|
||||||
},
|
},
|
||||||
payload
|
payload,
|
||||||
) => {
|
) => {
|
||||||
const { type } = payload
|
const { type } = payload
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@@ -149,7 +149,7 @@ export const listenBrainzTokenDialogReducer = (
|
|||||||
previousState = {
|
previousState = {
|
||||||
open: false,
|
open: false,
|
||||||
},
|
},
|
||||||
payload
|
payload,
|
||||||
) => {
|
) => {
|
||||||
const { type } = payload
|
const { type } = payload
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ const mapToAudioLists = (item) => {
|
|||||||
updatedAt: item.updatedAt,
|
updatedAt: item.updatedAt,
|
||||||
album: item.album,
|
album: item.album,
|
||||||
},
|
},
|
||||||
300
|
300,
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -140,7 +140,7 @@ const reduceSyncQueue = (state, { data: { audioInfo, audioLists } }) => {
|
|||||||
const reduceCurrent = (state, { data }) => {
|
const reduceCurrent = (state, { data }) => {
|
||||||
const current = data.ended ? {} : data
|
const current = data.ended ? {} : data
|
||||||
const savedPlayIndex = state.queue.findIndex(
|
const savedPlayIndex = state.queue.findIndex(
|
||||||
(item) => item.uuid === current.uuid
|
(item) => item.uuid === current.uuid,
|
||||||
)
|
)
|
||||||
return {
|
return {
|
||||||
...state,
|
...state,
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ const initialState = {
|
|||||||
|
|
||||||
export const replayGainReducer = (
|
export const replayGainReducer = (
|
||||||
previousState = initialState,
|
previousState = initialState,
|
||||||
{ type, payload }
|
{ type, payload },
|
||||||
) => {
|
) => {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case CHANGE_GAIN: {
|
case CHANGE_GAIN: {
|
||||||
|
|||||||
@@ -5,14 +5,14 @@ import themes from '../themes'
|
|||||||
const defaultTheme = () => {
|
const defaultTheme = () => {
|
||||||
return (
|
return (
|
||||||
Object.keys(themes).find(
|
Object.keys(themes).find(
|
||||||
(t) => themes[t].themeName === config.defaultTheme
|
(t) => themes[t].themeName === config.defaultTheme,
|
||||||
) || 'DarkTheme'
|
) || 'DarkTheme'
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const themeReducer = (
|
export const themeReducer = (
|
||||||
previousState = defaultTheme(),
|
previousState = defaultTheme(),
|
||||||
{ type, payload }
|
{ type, payload },
|
||||||
) => {
|
) => {
|
||||||
if (type === CHANGE_THEME) {
|
if (type === CHANGE_THEME) {
|
||||||
return payload
|
return payload
|
||||||
|
|||||||
@@ -16,8 +16,8 @@ const isLocalhost = Boolean(
|
|||||||
window.location.hostname === '[::1]' ||
|
window.location.hostname === '[::1]' ||
|
||||||
// 127.0.0.0/8 are considered localhost for IPv4.
|
// 127.0.0.0/8 are considered localhost for IPv4.
|
||||||
window.location.hostname.match(
|
window.location.hostname.match(
|
||||||
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
|
/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
export function register(config) {
|
export function register(config) {
|
||||||
@@ -43,7 +43,7 @@ export function register(config) {
|
|||||||
navigator.serviceWorker.ready.then(() => {
|
navigator.serviceWorker.ready.then(() => {
|
||||||
console.log(
|
console.log(
|
||||||
'This web app is being served cache-first by a service ' +
|
'This web app is being served cache-first by a service ' +
|
||||||
'worker. To learn more, visit https://bit.ly/CRA-PWA'
|
'worker. To learn more, visit https://bit.ly/CRA-PWA',
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
@@ -71,7 +71,7 @@ function registerValidSW(swUrl, config) {
|
|||||||
// content until all client tabs are closed.
|
// content until all client tabs are closed.
|
||||||
console.log(
|
console.log(
|
||||||
'New content is available and will be used when all ' +
|
'New content is available and will be used when all ' +
|
||||||
'tabs for this page are closed. See https://bit.ly/CRA-PWA.'
|
'tabs for this page are closed. See https://bit.ly/CRA-PWA.',
|
||||||
)
|
)
|
||||||
|
|
||||||
// Execute callback
|
// Execute callback
|
||||||
@@ -123,7 +123,7 @@ function checkValidServiceWorker(swUrl, config) {
|
|||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
console.log(
|
console.log(
|
||||||
'No internet connection found. App is running in offline mode.'
|
'No internet connection found. App is running in offline mode.',
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ const ShareList = (props) => {
|
|||||||
type: 'warning',
|
type: 'warning',
|
||||||
multiLine: true,
|
multiLine: true,
|
||||||
duration: 0,
|
duration: 0,
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
} else prompt(translate('message.shareCopyToClipboard'), url)
|
} else prompt(translate('message.shareCopyToClipboard'), url)
|
||||||
|
|||||||
@@ -48,7 +48,9 @@ const createAdminStore = ({
|
|||||||
const store = createStore(
|
const store = createStore(
|
||||||
resettableAppReducer,
|
resettableAppReducer,
|
||||||
persistedState,
|
persistedState,
|
||||||
composeEnhancers(applyMiddleware(sagaMiddleware, routerMiddleware(history)))
|
composeEnhancers(
|
||||||
|
applyMiddleware(sagaMiddleware, routerMiddleware(history)),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
|
|
||||||
store.subscribe(
|
store.subscribe(
|
||||||
@@ -61,7 +63,7 @@ const createAdminStore = ({
|
|||||||
settings: state.settings,
|
settings: state.settings,
|
||||||
})
|
})
|
||||||
}),
|
}),
|
||||||
1000
|
1000,
|
||||||
)
|
)
|
||||||
|
|
||||||
sagaMiddleware.run(saga)
|
sagaMiddleware.run(saga)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ const scrobble = (id, time, submission = true) =>
|
|||||||
url('scrobble', id, {
|
url('scrobble', id, {
|
||||||
...(submission && time && { time }),
|
...(submission && time && { time }),
|
||||||
submission,
|
submission,
|
||||||
})
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
const nowPlaying = (id) => scrobble(id, null, false)
|
const nowPlaying = (id) => scrobble(id, null, false)
|
||||||
@@ -74,7 +74,7 @@ const streamUrl = (id, options) => {
|
|||||||
url('stream', id, {
|
url('stream', id, {
|
||||||
ts: true,
|
ts: true,
|
||||||
...options,
|
...options,
|
||||||
})
|
}),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ const useCurrentTheme = () => {
|
|||||||
const themeName =
|
const themeName =
|
||||||
Object.keys(themes).find((t) => t === state.theme) ||
|
Object.keys(themes).find((t) => t === state.theme) ||
|
||||||
Object.keys(themes).find(
|
Object.keys(themes).find(
|
||||||
(t) => themes[t].themeName === config.defaultTheme
|
(t) => themes[t].themeName === config.defaultTheme,
|
||||||
) ||
|
) ||
|
||||||
'DarkTheme'
|
'DarkTheme'
|
||||||
return themes[themeName]
|
return themes[themeName]
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ const useStyles = makeStyles(
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
{ name: 'RaDeleteWithConfirmButton' }
|
{ name: 'RaDeleteWithConfirmButton' },
|
||||||
)
|
)
|
||||||
|
|
||||||
const DeleteUserButton = (props) => {
|
const DeleteUserButton = (props) => {
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ const UserCreate = (props) => {
|
|||||||
resource: 'user',
|
resource: 'user',
|
||||||
payload: { data: values },
|
payload: { data: values },
|
||||||
},
|
},
|
||||||
{ returnPromise: true }
|
{ returnPromise: true },
|
||||||
)
|
)
|
||||||
notify('resources.user.notifications.created', 'info', {
|
notify('resources.user.notifications.created', 'info', {
|
||||||
smart_count: 1,
|
smart_count: 1,
|
||||||
@@ -45,7 +45,7 @@ const UserCreate = (props) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[mutate, notify, redirect]
|
[mutate, notify, redirect],
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ const UserEdit = (props) => {
|
|||||||
resource: 'user',
|
resource: 'user',
|
||||||
payload: { id: values.id, data: values },
|
payload: { id: values.id, data: values },
|
||||||
},
|
},
|
||||||
{ returnPromise: true }
|
{ returnPromise: true },
|
||||||
)
|
)
|
||||||
notify('resources.user.notifications.updated', 'info', {
|
notify('resources.user.notifications.updated', 'info', {
|
||||||
smart_count: 1,
|
smart_count: 1,
|
||||||
@@ -97,7 +97,7 @@ const UserEdit = (props) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
[mutate, notify, permissions, redirect, refresh]
|
[mutate, notify, permissions, redirect, refresh],
|
||||||
)
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ describe('formatDuration', () => {
|
|||||||
it('formats days, hours and minutes', () => {
|
it('formats days, hours and minutes', () => {
|
||||||
expect(formatDuration(hour + minute + 1)).toEqual('01:01:01')
|
expect(formatDuration(hour + minute + 1)).toEqual('01:01:01')
|
||||||
expect(formatDuration(3 * day + 3 * hour + 7 * minute)).toEqual(
|
expect(formatDuration(3 * day + 3 * hour + 7 * minute)).toEqual(
|
||||||
'3:03:07:00'
|
'3:03:07:00',
|
||||||
)
|
)
|
||||||
expect(formatDuration(day)).toEqual('1:00:00:00')
|
expect(formatDuration(day)).toEqual('1:00:00:00')
|
||||||
expect(formatDuration(day + minute + 0.6)).toEqual('1:00:01:01')
|
expect(formatDuration(day + minute + 0.6)).toEqual('1:00:01:01')
|
||||||
|
|||||||
@@ -15,6 +15,6 @@ export const intersperse = (arr, sep) => {
|
|||||||
function (xs, x, i) {
|
function (xs, x, i) {
|
||||||
return xs.concat([sep, x])
|
return xs.concat([sep, x])
|
||||||
},
|
},
|
||||||
[arr[0]]
|
[arr[0]],
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ export const baseUrl = (path) => {
|
|||||||
export const shareUrl = (id) => {
|
export const shareUrl = (id) => {
|
||||||
const url = new URL(
|
const url = new URL(
|
||||||
baseUrl(config.publicBaseUrl + '/' + id),
|
baseUrl(config.publicBaseUrl + '/' + id),
|
||||||
window.location.href
|
window.location.href,
|
||||||
)
|
)
|
||||||
return url.href
|
return url.href
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user