mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-19 13:27:42 +03:00
Album details UI fix (#922)
* Fix the Album Details UI to look similar to Song Details UI * Remove the unused components * Fix the gap between row and the first field in the details view * Fix the width of the row of Album Details UI
This commit is contained in:
parent
0d95c4bb9d
commit
d0d18e8512
@ -1,12 +1,19 @@
|
||||
import React from 'react'
|
||||
import Paper from '@material-ui/core/Paper'
|
||||
import Table from '@material-ui/core/Table'
|
||||
import TableBody from '@material-ui/core/TableBody'
|
||||
import inflection from 'inflection'
|
||||
import TableCell from '@material-ui/core/TableCell'
|
||||
import TableContainer from '@material-ui/core/TableContainer'
|
||||
import TableRow from '@material-ui/core/TableRow'
|
||||
import {
|
||||
BooleanField,
|
||||
Datagrid,
|
||||
DateField,
|
||||
NumberField,
|
||||
Show,
|
||||
SimpleShowLayout,
|
||||
TextField,
|
||||
useTranslate,
|
||||
} from 'react-admin'
|
||||
import { useMediaQuery } from '@material-ui/core'
|
||||
import FavoriteBorderIcon from '@material-ui/icons/FavoriteBorder'
|
||||
@ -16,7 +23,6 @@ import {
|
||||
DurationField,
|
||||
RangeField,
|
||||
SimpleList,
|
||||
SizeField,
|
||||
MultiLineTextField,
|
||||
AlbumContextMenu,
|
||||
} from '../common'
|
||||
@ -35,24 +41,53 @@ const useStyles = makeStyles({
|
||||
},
|
||||
},
|
||||
},
|
||||
tableCell: {
|
||||
width: '17.5%',
|
||||
},
|
||||
contextMenu: {
|
||||
visibility: 'hidden',
|
||||
},
|
||||
})
|
||||
|
||||
const AlbumDetails = (props) => {
|
||||
const classes = useStyles()
|
||||
const translate = useTranslate()
|
||||
const { record } = props
|
||||
const data = {
|
||||
albumArtist: <TextField record={record} source="albumArtist" />,
|
||||
genre: <TextField record={record} source="genre" />,
|
||||
compilation: <BooleanField record={record} source="compilation" />,
|
||||
updatedAt: <DateField record={record} source="updatedAt" showTime />,
|
||||
comment: <MultiLineTextField record={record} source="comment" multiline />,
|
||||
}
|
||||
if (!record.comment) {
|
||||
delete data.comment
|
||||
}
|
||||
return (
|
||||
<Show {...props} title=" ">
|
||||
<SimpleShowLayout>
|
||||
<TextField source="albumArtist" />
|
||||
<TextField source="genre" />
|
||||
<BooleanField source="compilation" />
|
||||
<DateField source="updatedAt" showTime />
|
||||
<SizeField source="size" />
|
||||
{props.record && props.record['comment'] && (
|
||||
<MultiLineTextField source="comment" />
|
||||
)}
|
||||
</SimpleShowLayout>
|
||||
<TableContainer component={Paper}>
|
||||
<Table aria-label="album details" size="small">
|
||||
<TableBody>
|
||||
{Object.keys(data).map((key) => {
|
||||
return (
|
||||
<TableRow key={`${record.id}-${key}`}>
|
||||
<TableCell
|
||||
component="th"
|
||||
scope="row"
|
||||
className={classes.tableCell}
|
||||
>
|
||||
{translate(`resources.album.fields.${key}`, {
|
||||
_: inflection.humanize(inflection.underscore(key)),
|
||||
})}
|
||||
:
|
||||
</TableCell>
|
||||
<TableCell align="left">{data[key]}</TableCell>
|
||||
</TableRow>
|
||||
)
|
||||
})}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</TableContainer>
|
||||
</Show>
|
||||
)
|
||||
}
|
||||
|
@ -9,8 +9,16 @@ import { BooleanField, DateField, TextField, useTranslate } from 'react-admin'
|
||||
import inflection from 'inflection'
|
||||
import { BitrateField, SizeField } from './index'
|
||||
import { MultiLineTextField } from './MultiLineTextField'
|
||||
import { makeStyles } from '@material-ui/core/styles'
|
||||
|
||||
const useStyles = makeStyles({
|
||||
tableCell: {
|
||||
width: '17.5%',
|
||||
},
|
||||
})
|
||||
|
||||
export const SongDetails = (props) => {
|
||||
const classes = useStyles()
|
||||
const translate = useTranslate()
|
||||
const { record } = props
|
||||
const data = {
|
||||
@ -42,7 +50,11 @@ export const SongDetails = (props) => {
|
||||
{Object.keys(data).map((key) => {
|
||||
return (
|
||||
<TableRow key={`${record.id}-${key}`}>
|
||||
<TableCell component="th" scope="row">
|
||||
<TableCell
|
||||
component="th"
|
||||
scope="row"
|
||||
className={classes.tableCell}
|
||||
>
|
||||
{translate(`resources.song.fields.${key}`, {
|
||||
_: inflection.humanize(inflection.underscore(key)),
|
||||
})}
|
||||
|
Loading…
x
Reference in New Issue
Block a user