build(ui): migrate from CRA/Jest to Vite/Vitest (#3311)
* feat: create vite project * feat: it's alive! * feat: `make dev` working! * feat: replace custom serviceWorker with vite plugin * test: replace Jest with Vitest * fix: run prettier * fix: skip eslint for now. * chore: remove ui.old folder * refactor: replace lodash.pick with simple destructuring * fix: eslint errors (wip) * fix: eslint errors (wip) * fix: display-name eslint errors (wip) * fix: no-console eslint errors (wip) * fix: react-refresh/only-export-components eslint errors (wip) * fix: react-refresh/only-export-components eslint errors (wip) * fix: react-refresh/only-export-components eslint errors (wip) * fix: react-refresh/only-export-components eslint errors (wip) * fix: build * fix: pwa manifest * refactor: pwa manifest * refactor: simplify PORT configuration * refactor: rename simple JS files * test: cover playlistUtils * fix: react-image-lightbox * feat(ui): add sourcemaps to help debug issues
This commit is contained in:
@@ -0,0 +1,91 @@
|
||||
import React from 'react'
|
||||
import PropTypes from 'prop-types'
|
||||
import List from '@material-ui/core/List'
|
||||
import ListItem from '@material-ui/core/ListItem'
|
||||
import ListItemIcon from '@material-ui/core/ListItemIcon'
|
||||
import ListItemSecondaryAction from '@material-ui/core/ListItemSecondaryAction'
|
||||
import ListItemText from '@material-ui/core/ListItemText'
|
||||
import { makeStyles } from '@material-ui/core/styles'
|
||||
import { sanitizeListRestProps } from 'react-admin'
|
||||
import { ArtistContextMenu, RatingField } from './index'
|
||||
import config from '../config'
|
||||
|
||||
const useStyles = makeStyles(
|
||||
{
|
||||
listItem: {
|
||||
padding: '10px',
|
||||
},
|
||||
title: {
|
||||
paddingRight: '10px',
|
||||
width: '80%',
|
||||
},
|
||||
rightIcon: {
|
||||
top: '26px',
|
||||
},
|
||||
},
|
||||
{ name: 'RaArtistSimpleList' },
|
||||
)
|
||||
|
||||
export const ArtistSimpleList = ({
|
||||
linkType,
|
||||
className,
|
||||
classes: classesOverride,
|
||||
data,
|
||||
hasBulkActions,
|
||||
ids,
|
||||
loading,
|
||||
selectedIds,
|
||||
total,
|
||||
...rest
|
||||
}) => {
|
||||
const classes = useStyles({ classes: classesOverride })
|
||||
return (
|
||||
(loading || total > 0) && (
|
||||
<List className={className} {...sanitizeListRestProps(rest)}>
|
||||
{ids.map(
|
||||
(id) =>
|
||||
data[id] && (
|
||||
<span key={id} onClick={() => linkType(id)}>
|
||||
<ListItem className={classes.listItem} button={true}>
|
||||
<ListItemText
|
||||
primary={
|
||||
<>
|
||||
<div className={classes.title}>{data[id].name}</div>
|
||||
{config.enableStarRating && (
|
||||
<RatingField
|
||||
record={data[id]}
|
||||
source={'rating'}
|
||||
resource={'artist'}
|
||||
size={'small'}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
}
|
||||
/>
|
||||
<ListItemSecondaryAction className={classes.rightIcon}>
|
||||
<ListItemIcon>
|
||||
<ArtistContextMenu record={data[id]} />
|
||||
</ListItemIcon>
|
||||
</ListItemSecondaryAction>
|
||||
</ListItem>
|
||||
</span>
|
||||
),
|
||||
)}
|
||||
</List>
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
ArtistSimpleList.propTypes = {
|
||||
className: PropTypes.string,
|
||||
classes: PropTypes.object,
|
||||
data: PropTypes.object,
|
||||
hasBulkActions: PropTypes.bool.isRequired,
|
||||
ids: PropTypes.array,
|
||||
selectedIds: PropTypes.arrayOf(PropTypes.any).isRequired,
|
||||
}
|
||||
|
||||
ArtistSimpleList.defaultProps = {
|
||||
hasBulkActions: false,
|
||||
selectedIds: [],
|
||||
}
|
||||
Reference in New Issue
Block a user