-
-
Notifications
You must be signed in to change notification settings - Fork 798
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace expanded with a dialog (#1258)
* Replace expanded with a dialog * Change `info` label to "Get Info" * Rename things for consistency Co-authored-by: Deluan <deluan@navidrome.org>
- Loading branch information
1 parent
15ae3d4
commit 0c0bd29
Showing
18 changed files
with
223 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
//+build wireinject | ||
//go:build wireinject | ||
// +build wireinject | ||
|
||
package cmd | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
//go:build !windows | ||
// +build !windows | ||
|
||
package taglib | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
//go:build windows | ||
// +build windows | ||
|
||
package taglib | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
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 { | ||
ArrayField, | ||
BooleanField, | ||
ChipField, | ||
DateField, | ||
SingleFieldList, | ||
TextField, | ||
useRecordContext, | ||
useTranslate, | ||
} from 'react-admin' | ||
import { makeStyles } from '@material-ui/core/styles' | ||
import { MultiLineTextField } from '../common' | ||
|
||
const useStyles = makeStyles({ | ||
tableCell: { | ||
width: '17.5%', | ||
}, | ||
}) | ||
|
||
const AlbumInfo = (props) => { | ||
const classes = useStyles() | ||
const translate = useTranslate() | ||
const record = useRecordContext(props) | ||
const data = { | ||
album: <TextField source={'name'} />, | ||
albumArtist: <TextField source={'albumArtist'} />, | ||
genre: ( | ||
<ArrayField source={'genres'}> | ||
<SingleFieldList linkType={false}> | ||
<ChipField source={'name'} /> | ||
</SingleFieldList> | ||
</ArrayField> | ||
), | ||
compilation: <BooleanField source={'compilation'} />, | ||
updatedAt: <DateField source={'updatedAt'} showTime />, | ||
comment: <MultiLineTextField source={'comment'} />, | ||
} | ||
|
||
const optionalFields = ['comment', 'genre'] | ||
optionalFields.forEach((field) => { | ||
!record[field] && delete data[field] | ||
}) | ||
|
||
return ( | ||
<TableContainer> | ||
<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> | ||
) | ||
} | ||
|
||
export default AlbumInfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.