import { TableRow, TableCell } from '@material-ui/core'
import { humanize } from 'inflection'
import { useTranslate } from 'react-admin'
import en from '../i18n/en.json'
import { ArtistLinkField } from './index'
export const ParticipantsInfo = ({ classes, record }) => {
const translate = useTranslate()
const existingRoles = en?.resources?.artist?.roles ?? {}
const roles = []
if (record.participants) {
for (const name of Object.keys(record.participants)) {
if (name === 'albumartist' || name === 'artist') {
continue
}
roles.push([name, record.participants[name].length])
}
}
if (roles.length === 0) {
return null
}
return (
<>
{roles.length > 0 && (
{translate(`resources.song.fields.participants`)}
)}
{roles.map(([role, count]) => (
{role in existingRoles
? translate(`resources.artist.roles.${role}`, {
smart_count: count,
})
: humanize(role)}
:
))}
>
)
}