Reformat code with Prettier's new rules.
This commit is contained in:
@@ -12,7 +12,10 @@ export const AddToPlaylistButton = ({ resource, selectedIds, className }) => {
|
||||
|
||||
const handleClick = () => {
|
||||
dispatch(
|
||||
openAddToPlaylist({ selectedIds, onSuccess: () => unselectAll(resource) })
|
||||
openAddToPlaylist({
|
||||
selectedIds,
|
||||
onSuccess: () => unselectAll(resource),
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -14,28 +14,31 @@ export const useGetHandleArtistClick = (width) => {
|
||||
}
|
||||
}
|
||||
|
||||
export const ArtistLinkField = withWidth()(
|
||||
({ record, className, width, source }) => {
|
||||
const artistLink = useGetHandleArtistClick(width)
|
||||
export const ArtistLinkField = withWidth()(({
|
||||
record,
|
||||
className,
|
||||
width,
|
||||
source,
|
||||
}) => {
|
||||
const artistLink = useGetHandleArtistClick(width)
|
||||
|
||||
const id = record[source + 'Id']
|
||||
return (
|
||||
<>
|
||||
{id ? (
|
||||
<Link
|
||||
to={artistLink(id)}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
className={className}
|
||||
>
|
||||
{record[source]}
|
||||
</Link>
|
||||
) : (
|
||||
record[source]
|
||||
)}
|
||||
</>
|
||||
)
|
||||
}
|
||||
)
|
||||
const id = record[source + 'Id']
|
||||
return (
|
||||
<>
|
||||
{id ? (
|
||||
<Link
|
||||
to={artistLink(id)}
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
className={className}
|
||||
>
|
||||
{record[source]}
|
||||
</Link>
|
||||
) : (
|
||||
record[source]
|
||||
)}
|
||||
</>
|
||||
)
|
||||
})
|
||||
|
||||
ArtistLinkField.propTypes = {
|
||||
record: PropTypes.object,
|
||||
|
||||
@@ -23,7 +23,7 @@ const useStyles = makeStyles(
|
||||
top: '26px',
|
||||
},
|
||||
},
|
||||
{ name: 'RaArtistSimpleList' }
|
||||
{ name: 'RaArtistSimpleList' },
|
||||
)
|
||||
|
||||
export const ArtistSimpleList = ({
|
||||
@@ -69,7 +69,7 @@ export const ArtistSimpleList = ({
|
||||
</ListItemSecondaryAction>
|
||||
</ListItem>
|
||||
</span>
|
||||
)
|
||||
),
|
||||
)}
|
||||
</List>
|
||||
)
|
||||
|
||||
@@ -30,7 +30,7 @@ export const BatchPlayButton = ({
|
||||
// Add tracks to a map for easy lookup by ID, needed for the next step
|
||||
const tracks = response.data.reduce(
|
||||
(acc, cur) => ({ ...acc, [cur.id]: cur }),
|
||||
{}
|
||||
{},
|
||||
)
|
||||
// Add the tracks to the queue in the selection order
|
||||
dispatch(action(tracks, selectedIds))
|
||||
|
||||
@@ -18,8 +18,8 @@ export const BatchShareButton = ({ resource, selectedIds, className }) => {
|
||||
_: 'ra.action.bulk_actions',
|
||||
smart_count: selectedIds.length,
|
||||
}),
|
||||
'message.shareBatchDialogTitle'
|
||||
)
|
||||
'message.shareBatchDialogTitle',
|
||||
),
|
||||
)
|
||||
unselectAll(resource)
|
||||
}
|
||||
|
||||
@@ -97,8 +97,8 @@ const ContextMenu = ({
|
||||
record,
|
||||
record.duration !== undefined
|
||||
? DOWNLOAD_MENU_ALBUM
|
||||
: DOWNLOAD_MENU_ARTIST
|
||||
)
|
||||
: DOWNLOAD_MENU_ARTIST,
|
||||
),
|
||||
)
|
||||
},
|
||||
},
|
||||
@@ -127,7 +127,7 @@ const ContextMenu = ({
|
||||
let extractSongsData = function (response) {
|
||||
const data = response.data.reduce(
|
||||
(acc, cur) => ({ ...acc, [cur.id]: cur }),
|
||||
{}
|
||||
{},
|
||||
)
|
||||
const ids = response.data.map((r) => r.id)
|
||||
return { data, ids }
|
||||
@@ -186,7 +186,7 @@ const ContextMenu = ({
|
||||
<MenuItem value={key} key={key} onClick={handleItemClick}>
|
||||
{options[key].label}
|
||||
</MenuItem>
|
||||
)
|
||||
),
|
||||
)}
|
||||
</Menu>
|
||||
</span>
|
||||
|
||||
@@ -10,7 +10,7 @@ const useStyles = makeStyles(
|
||||
color: theme.palette.primary.main,
|
||||
},
|
||||
}),
|
||||
{ name: 'RaLink' }
|
||||
{ name: 'RaLink' },
|
||||
)
|
||||
|
||||
const Linkify = ({ text, ...rest }) => {
|
||||
@@ -45,7 +45,7 @@ const Linkify = ({ text, ...rest }) => {
|
||||
href={href}
|
||||
>
|
||||
{href}
|
||||
</Link>
|
||||
</Link>,
|
||||
)
|
||||
|
||||
lastIndex = match.index + href.length
|
||||
@@ -57,7 +57,7 @@ const Linkify = ({ text, ...rest }) => {
|
||||
<span
|
||||
key={'last-span-key'}
|
||||
dangerouslySetInnerHTML={{ __html: text.substring(lastIndex) }}
|
||||
/>
|
||||
/>,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ export const LoveButton = ({
|
||||
toggleLove()
|
||||
e.stopPropagation()
|
||||
},
|
||||
[toggleLove]
|
||||
[toggleLove],
|
||||
)
|
||||
|
||||
if (!config.enableFavourites) {
|
||||
|
||||
@@ -39,11 +39,11 @@ export const MultiLineTextField = memo(
|
||||
key={md5(line + idx)}
|
||||
dangerouslySetInnerHTML={{ __html: line }}
|
||||
/>
|
||||
)
|
||||
),
|
||||
)}
|
||||
</Typography>
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
MultiLineTextField.defaultProps = {
|
||||
|
||||
@@ -20,9 +20,9 @@ describe('<MultiLineTextField />', () => {
|
||||
record={{ id: 123, body }}
|
||||
emptyText="NA"
|
||||
source="body"
|
||||
/>
|
||||
/>,
|
||||
)
|
||||
expect(screen.getByText('NA')).toBeInTheDocument()
|
||||
}
|
||||
},
|
||||
)
|
||||
})
|
||||
|
||||
@@ -10,7 +10,7 @@ export const PlayButton = ({ record, size, className }) => {
|
||||
let extractSongsData = function (response) {
|
||||
const data = response.data.reduce(
|
||||
(acc, cur) => ({ ...acc, [cur.id]: cur }),
|
||||
{}
|
||||
{},
|
||||
)
|
||||
const ids = response.data.map((r) => r.id)
|
||||
return { data, ids }
|
||||
|
||||
@@ -16,7 +16,7 @@ const useStyle = makeStyles(
|
||||
}),
|
||||
{
|
||||
name: 'NDQualityInfo',
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
export const QualityInfo = ({ record, size, gainMode, preAmp, className }) => {
|
||||
|
||||
@@ -22,7 +22,7 @@ describe('QuickFilter', () => {
|
||||
resource={'song'}
|
||||
source={'name'}
|
||||
label={<StarIcon data-testid="label-icon-test" />}
|
||||
/>
|
||||
/>,
|
||||
)
|
||||
expect(screen.getByTestId('label-icon-test')).not.toBeNull()
|
||||
})
|
||||
|
||||
@@ -40,7 +40,7 @@ export const RatingField = ({
|
||||
(e, val) => {
|
||||
rate(val, e.target.name)
|
||||
},
|
||||
[rate]
|
||||
[rate],
|
||||
)
|
||||
|
||||
return (
|
||||
@@ -50,7 +50,7 @@ export const RatingField = ({
|
||||
className={clsx(
|
||||
className,
|
||||
classes.rating,
|
||||
rating > 0 ? classes.show : classes.hide
|
||||
rating > 0 ? classes.show : classes.hide,
|
||||
)}
|
||||
value={rating}
|
||||
size={size}
|
||||
|
||||
@@ -19,7 +19,7 @@ const useStyles = makeStyles(
|
||||
},
|
||||
tertiary: { float: 'right', opacity: 0.541176 },
|
||||
},
|
||||
{ name: 'RaSimpleList' }
|
||||
{ name: 'RaSimpleList' },
|
||||
)
|
||||
|
||||
const LinkOrNot = ({
|
||||
|
||||
@@ -61,7 +61,7 @@ export const SongContextMenu = ({
|
||||
openAddToPlaylist({
|
||||
selectedIds: [record.mediaFileId || record.id],
|
||||
onSuccess: (id) => onAddToPlaylist(id),
|
||||
})
|
||||
}),
|
||||
),
|
||||
},
|
||||
share: {
|
||||
@@ -69,7 +69,11 @@ export const SongContextMenu = ({
|
||||
label: translate('ra.action.share'),
|
||||
action: (record) =>
|
||||
dispatch(
|
||||
openShareMenu([record.mediaFileId || record.id], 'song', record.title)
|
||||
openShareMenu(
|
||||
[record.mediaFileId || record.id],
|
||||
'song',
|
||||
record.title,
|
||||
),
|
||||
),
|
||||
},
|
||||
download: {
|
||||
@@ -127,7 +131,7 @@ export const SongContextMenu = ({
|
||||
<MenuItem value={key} key={key} onClick={handleItemClick}>
|
||||
{options[key].label}
|
||||
</MenuItem>
|
||||
)
|
||||
),
|
||||
)}
|
||||
</Menu>
|
||||
</span>
|
||||
|
||||
@@ -97,7 +97,7 @@ const ReleaseRow = forwardRef(
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
const DiscSubtitleRow = forwardRef(
|
||||
@@ -141,7 +141,7 @@ const DiscSubtitleRow = forwardRef(
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)
|
||||
}
|
||||
},
|
||||
)
|
||||
|
||||
export const SongDatagridRow = ({
|
||||
@@ -156,7 +156,7 @@ export const SongDatagridRow = ({
|
||||
}) => {
|
||||
const classes = useStyles()
|
||||
const fields = React.Children.toArray(children).filter((c) =>
|
||||
isValidElement(c)
|
||||
isValidElement(c),
|
||||
)
|
||||
|
||||
const [, dragDiscRef] = useDrag(
|
||||
@@ -173,7 +173,7 @@ export const SongDatagridRow = ({
|
||||
},
|
||||
options: { dropEffect: 'copy' },
|
||||
}),
|
||||
[record]
|
||||
[record],
|
||||
)
|
||||
|
||||
const [, dragSongRef] = useDrag(
|
||||
@@ -182,7 +182,7 @@ export const SongDatagridRow = ({
|
||||
item: { ids: [record?.mediaFileId || record?.id] },
|
||||
options: { dropEffect: 'copy' },
|
||||
}),
|
||||
[record]
|
||||
[record],
|
||||
)
|
||||
|
||||
if (!record || !record.title) {
|
||||
@@ -251,14 +251,14 @@ const SongDatagridBody = ({
|
||||
idsToPlay = ids.filter(
|
||||
(id) =>
|
||||
data[id].releaseDate === releaseDate &&
|
||||
data[id].discNumber === discNumber
|
||||
data[id].discNumber === discNumber,
|
||||
)
|
||||
} else {
|
||||
idsToPlay = ids.filter((id) => data[id].releaseDate === releaseDate)
|
||||
}
|
||||
dispatch(playTracks(data, idsToPlay))
|
||||
},
|
||||
[dispatch, data, ids]
|
||||
[dispatch, data, ids],
|
||||
)
|
||||
|
||||
const firstTracksOfDiscs = useMemo(() => {
|
||||
@@ -280,7 +280,7 @@ const SongDatagridBody = ({
|
||||
acc.push(id)
|
||||
}
|
||||
return acc
|
||||
}, [])
|
||||
}, []),
|
||||
)
|
||||
if (!showDiscSubtitles || (set.size < 2 && !foundSubtitle)) {
|
||||
set.clear()
|
||||
@@ -304,7 +304,7 @@ const SongDatagridBody = ({
|
||||
acc.push(id)
|
||||
}
|
||||
return acc
|
||||
}, [])
|
||||
}, []),
|
||||
)
|
||||
if (!showReleaseDivider || set.size < 2) {
|
||||
set.clear()
|
||||
|
||||
@@ -47,7 +47,7 @@ const useStyles = makeStyles(
|
||||
top: '26px',
|
||||
},
|
||||
},
|
||||
{ name: 'RaSongSimpleList' }
|
||||
{ name: 'RaSongSimpleList' },
|
||||
)
|
||||
|
||||
export const SongSimpleList = ({
|
||||
@@ -108,7 +108,7 @@ export const SongSimpleList = ({
|
||||
</ListItemSecondaryAction>
|
||||
</ListItem>
|
||||
</span>
|
||||
)
|
||||
),
|
||||
)}
|
||||
</List>
|
||||
)
|
||||
|
||||
@@ -36,7 +36,7 @@ export const ToggleFieldsMenu = ({
|
||||
const dispatch = useDispatch()
|
||||
const translate = useTranslate()
|
||||
const toggleableColumns = useSelector(
|
||||
(state) => state.settings.toggleableFields[resource]
|
||||
(state) => state.settings.toggleableFields[resource],
|
||||
)
|
||||
const omittedColumns =
|
||||
useSelector((state) => state.settings.omittedFields[resource]) || []
|
||||
@@ -58,7 +58,7 @@ export const ToggleFieldsMenu = ({
|
||||
...toggleableColumns,
|
||||
[selectedColumn]: !toggleableColumns[selectedColumn],
|
||||
},
|
||||
})
|
||||
}),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ export const ToggleFieldsMenu = ({
|
||||
<Checkbox checked={val} />
|
||||
{translate(`resources.${resource}.fields.${key}`)}
|
||||
</MenuItem>
|
||||
) : null
|
||||
) : null,
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -15,7 +15,7 @@ export const Writable = (props) => {
|
||||
const { record = {}, children } = props
|
||||
if (isWritable(record.ownerId)) {
|
||||
return Children.map(children, (child) =>
|
||||
isValidElement(child) ? cloneElement(child, props) : child
|
||||
isValidElement(child) ? cloneElement(child, props) : child,
|
||||
)
|
||||
}
|
||||
return null
|
||||
|
||||
@@ -19,7 +19,7 @@ const getPerPageOptions = (width) => {
|
||||
export const useAlbumsPerPage = (width) => {
|
||||
const perPage =
|
||||
useSelector(
|
||||
(state) => state?.admin.resources?.album?.list?.params?.perPage
|
||||
(state) => state?.admin.resources?.album?.list?.params?.perPage,
|
||||
) || getPerPage(width)
|
||||
|
||||
return [perPage, getPerPageOptions(width)]
|
||||
|
||||
@@ -7,7 +7,7 @@ export const useResourceRefresh = (...visibleResources) => {
|
||||
const refresh = useRefresh()
|
||||
const dataProvider = useDataProvider()
|
||||
const refreshData = useSelector(
|
||||
(state) => state.activity?.refresh || { lastReceived: lastTime }
|
||||
(state) => state.activity?.refresh || { lastReceived: lastTime },
|
||||
)
|
||||
const { resources, lastReceived } = refreshData
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ export const useSelectedFields = ({
|
||||
}) => {
|
||||
const dispatch = useDispatch()
|
||||
const resourceFields = useSelector(
|
||||
(state) => state.settings.toggleableFields
|
||||
(state) => state.settings.toggleableFields,
|
||||
)?.[resource]
|
||||
const omittedFields = useSelector((state) => state.settings.omittedFields)?.[
|
||||
resource
|
||||
@@ -81,7 +81,7 @@ useSelectedFields.propTypes = {
|
||||
export const useSetToggleableFields = (
|
||||
resource,
|
||||
toggleableColumns,
|
||||
defaultOff = []
|
||||
defaultOff = [],
|
||||
) => {
|
||||
const current = useSelector((state) => state.settings.toggleableFields)?.album
|
||||
const dispatch = useDispatch()
|
||||
@@ -95,7 +95,7 @@ export const useSetToggleableFields = (
|
||||
...{ [cur]: true },
|
||||
}
|
||||
}, {}),
|
||||
})
|
||||
}),
|
||||
)
|
||||
dispatch(setOmittedFields({ [resource]: defaultOff }))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user