Add about dialog, with version and helpful links
This commit is contained in:
@@ -265,7 +265,7 @@
|
|||||||
"menu": {
|
"menu": {
|
||||||
"library": "Knihovna",
|
"library": "Knihovna",
|
||||||
"settings": "Nastavení",
|
"settings": "Nastavení",
|
||||||
"version": "Verze %{version}",
|
"version": "Verze",
|
||||||
"theme": "Motiv",
|
"theme": "Motiv",
|
||||||
"personal": {
|
"personal": {
|
||||||
"name": "Osobní",
|
"name": "Osobní",
|
||||||
|
|||||||
@@ -257,7 +257,7 @@
|
|||||||
"menu": {
|
"menu": {
|
||||||
"library": "Bibliotek",
|
"library": "Bibliotek",
|
||||||
"settings": "Indstillinger",
|
"settings": "Indstillinger",
|
||||||
"version": "Version %{version}",
|
"version": "Version",
|
||||||
"theme": "Tema",
|
"theme": "Tema",
|
||||||
"personal": {
|
"personal": {
|
||||||
"name": "Personligt",
|
"name": "Personligt",
|
||||||
|
|||||||
@@ -257,7 +257,7 @@
|
|||||||
"menu": {
|
"menu": {
|
||||||
"library": "Bibliothek",
|
"library": "Bibliothek",
|
||||||
"settings": "Einstellungen",
|
"settings": "Einstellungen",
|
||||||
"version": "Version %{version}",
|
"version": "Version",
|
||||||
"theme": "Design",
|
"theme": "Design",
|
||||||
"personal": {
|
"personal": {
|
||||||
"name": "Persönlich",
|
"name": "Persönlich",
|
||||||
|
|||||||
@@ -265,7 +265,7 @@
|
|||||||
"menu": {
|
"menu": {
|
||||||
"library": "Biblioteca",
|
"library": "Biblioteca",
|
||||||
"settings": "Ajustes",
|
"settings": "Ajustes",
|
||||||
"version": "Versión %{version}",
|
"version": "Versión",
|
||||||
"theme": "Tema",
|
"theme": "Tema",
|
||||||
"personal": {
|
"personal": {
|
||||||
"name": "Personal",
|
"name": "Personal",
|
||||||
|
|||||||
@@ -265,7 +265,7 @@
|
|||||||
"menu": {
|
"menu": {
|
||||||
"library": "Bibliothèque",
|
"library": "Bibliothèque",
|
||||||
"settings": "Paramètres",
|
"settings": "Paramètres",
|
||||||
"version": "Version%{version}",
|
"version": "Version",
|
||||||
"theme": "Thème",
|
"theme": "Thème",
|
||||||
"personal": {
|
"personal": {
|
||||||
"name": "Paramètres personnels",
|
"name": "Paramètres personnels",
|
||||||
|
|||||||
@@ -265,7 +265,7 @@
|
|||||||
"menu": {
|
"menu": {
|
||||||
"library": "Libreria",
|
"library": "Libreria",
|
||||||
"settings": "Impostazioni",
|
"settings": "Impostazioni",
|
||||||
"version": "Versione %{version}",
|
"version": "Versione",
|
||||||
"theme": "Tema",
|
"theme": "Tema",
|
||||||
"personal": {
|
"personal": {
|
||||||
"name": "Personale",
|
"name": "Personale",
|
||||||
|
|||||||
@@ -265,7 +265,7 @@
|
|||||||
"menu": {
|
"menu": {
|
||||||
"library": "ライブラリ",
|
"library": "ライブラリ",
|
||||||
"settings": "設定",
|
"settings": "設定",
|
||||||
"version": "バージョン %{version}",
|
"version": "バージョン",
|
||||||
"theme": "テーマ",
|
"theme": "テーマ",
|
||||||
"personal": {
|
"personal": {
|
||||||
"name": "個人設定",
|
"name": "個人設定",
|
||||||
|
|||||||
@@ -222,7 +222,7 @@
|
|||||||
"menu": {
|
"menu": {
|
||||||
"library": "Bibliotheek",
|
"library": "Bibliotheek",
|
||||||
"settings": "Instellingen",
|
"settings": "Instellingen",
|
||||||
"version": "Versie %{version}",
|
"version": "Versie",
|
||||||
"theme": "Thema",
|
"theme": "Thema",
|
||||||
"personal": {
|
"personal": {
|
||||||
"name": "Persoonlijk",
|
"name": "Persoonlijk",
|
||||||
|
|||||||
@@ -265,7 +265,7 @@
|
|||||||
"menu": {
|
"menu": {
|
||||||
"library": "Biblioteka",
|
"library": "Biblioteka",
|
||||||
"settings": "Ustawienia",
|
"settings": "Ustawienia",
|
||||||
"version": "Wersja %{version}",
|
"version": "Wersja",
|
||||||
"theme": "Wygląd",
|
"theme": "Wygląd",
|
||||||
"personal": {
|
"personal": {
|
||||||
"name": "Personalizacja",
|
"name": "Personalizacja",
|
||||||
|
|||||||
@@ -265,7 +265,7 @@
|
|||||||
"albumList": "Álbuns",
|
"albumList": "Álbuns",
|
||||||
"library": "Biblioteca",
|
"library": "Biblioteca",
|
||||||
"settings": "Configurações",
|
"settings": "Configurações",
|
||||||
"version": "Versão %{version}",
|
"version": "Versão",
|
||||||
"theme": "Tema",
|
"theme": "Tema",
|
||||||
"personal": {
|
"personal": {
|
||||||
"name": "Pessoal",
|
"name": "Pessoal",
|
||||||
@@ -276,6 +276,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"about": {
|
||||||
|
"links": {
|
||||||
|
"homepage": "Website",
|
||||||
|
"source": "Código fonte",
|
||||||
|
"featureRequests": "Pedido de funcionalidade"
|
||||||
|
}
|
||||||
|
},
|
||||||
"player": {
|
"player": {
|
||||||
"playListsText": "Fila de Execução",
|
"playListsText": "Fila de Execução",
|
||||||
"openText": "Abrir",
|
"openText": "Abrir",
|
||||||
|
|||||||
@@ -257,7 +257,7 @@
|
|||||||
"menu": {
|
"menu": {
|
||||||
"library": "Müzik kütüphanesi",
|
"library": "Müzik kütüphanesi",
|
||||||
"settings": "Ayarlar",
|
"settings": "Ayarlar",
|
||||||
"version": "Sürüm %{version}",
|
"version": "Sürüm",
|
||||||
"theme": "Tema",
|
"theme": "Tema",
|
||||||
"personal": {
|
"personal": {
|
||||||
"name": "Kişisel",
|
"name": "Kişisel",
|
||||||
|
|||||||
@@ -265,7 +265,7 @@
|
|||||||
"menu": {
|
"menu": {
|
||||||
"library": "曲库",
|
"library": "曲库",
|
||||||
"settings": "设置",
|
"settings": "设置",
|
||||||
"version": "版本 %{version}",
|
"version": "版本",
|
||||||
"theme": "主题",
|
"theme": "主题",
|
||||||
"personal": {
|
"personal": {
|
||||||
"name": "个性化",
|
"name": "个性化",
|
||||||
|
|||||||
+10
-2
@@ -265,7 +265,7 @@
|
|||||||
"menu": {
|
"menu": {
|
||||||
"library": "Library",
|
"library": "Library",
|
||||||
"settings": "Settings",
|
"settings": "Settings",
|
||||||
"version": "Version %{version}",
|
"version": "Version",
|
||||||
"theme": "Theme",
|
"theme": "Theme",
|
||||||
"personal": {
|
"personal": {
|
||||||
"name": "Personal",
|
"name": "Personal",
|
||||||
@@ -275,7 +275,15 @@
|
|||||||
"defaultView": "Default View"
|
"defaultView": "Default View"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"albumList": "Albums"
|
"albumList": "Albums",
|
||||||
|
"about": "About"
|
||||||
|
},
|
||||||
|
"about": {
|
||||||
|
"links": {
|
||||||
|
"homepage": "Home page",
|
||||||
|
"source": "Source code",
|
||||||
|
"featureRequests": "Feature requests"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"player": {
|
"player": {
|
||||||
"playListsText": "Play Queue",
|
"playListsText": "Play Queue",
|
||||||
|
|||||||
@@ -0,0 +1,146 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import PropTypes from 'prop-types'
|
||||||
|
import { withStyles } from '@material-ui/core/styles'
|
||||||
|
import Link from '@material-ui/core/Link'
|
||||||
|
import Dialog from '@material-ui/core/Dialog'
|
||||||
|
import MuiDialogTitle from '@material-ui/core/DialogTitle'
|
||||||
|
import MuiDialogContent from '@material-ui/core/DialogContent'
|
||||||
|
import IconButton from '@material-ui/core/IconButton'
|
||||||
|
import CloseIcon from '@material-ui/icons/Close'
|
||||||
|
import Typography from '@material-ui/core/Typography'
|
||||||
|
import TableContainer from '@material-ui/core/TableContainer'
|
||||||
|
import Table from '@material-ui/core/Table'
|
||||||
|
import TableBody from '@material-ui/core/TableBody'
|
||||||
|
import TableRow from '@material-ui/core/TableRow'
|
||||||
|
import TableCell from '@material-ui/core/TableCell'
|
||||||
|
import Paper from '@material-ui/core/Paper'
|
||||||
|
import FavoriteBorderIcon from '@material-ui/icons/FavoriteBorder'
|
||||||
|
import inflection from 'inflection'
|
||||||
|
import { useTranslate } from 'react-admin'
|
||||||
|
import config from '../config'
|
||||||
|
|
||||||
|
const styles = (theme) => ({
|
||||||
|
root: {
|
||||||
|
margin: 0,
|
||||||
|
padding: theme.spacing(2),
|
||||||
|
},
|
||||||
|
closeButton: {
|
||||||
|
position: 'absolute',
|
||||||
|
right: theme.spacing(1),
|
||||||
|
top: theme.spacing(1),
|
||||||
|
color: theme.palette.grey[500],
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
const links = {
|
||||||
|
homepage: 'navidrome.org',
|
||||||
|
reddit: 'reddit.com/r/Navidrome',
|
||||||
|
twitter: 'twitter.com/navidrome',
|
||||||
|
discord: 'discord.gg/xh7j7yF',
|
||||||
|
source: 'github.com/deluan/navidrome',
|
||||||
|
featureRequests: 'github.com/deluan/navidrome/issues',
|
||||||
|
}
|
||||||
|
|
||||||
|
const DialogTitle = withStyles(styles)((props) => {
|
||||||
|
const { children, classes, onClose, ...other } = props
|
||||||
|
return (
|
||||||
|
<MuiDialogTitle disableTypography className={classes.root} {...other}>
|
||||||
|
<Typography variant="h5">{children}</Typography>
|
||||||
|
{onClose ? (
|
||||||
|
<IconButton
|
||||||
|
aria-label="close"
|
||||||
|
className={classes.closeButton}
|
||||||
|
onClick={onClose}
|
||||||
|
>
|
||||||
|
<CloseIcon />
|
||||||
|
</IconButton>
|
||||||
|
) : null}
|
||||||
|
</MuiDialogTitle>
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
const DialogContent = withStyles((theme) => ({
|
||||||
|
root: {
|
||||||
|
padding: theme.spacing(2),
|
||||||
|
},
|
||||||
|
}))(MuiDialogContent)
|
||||||
|
|
||||||
|
const AboutDialog = ({ open, onClose }) => {
|
||||||
|
const translate = useTranslate()
|
||||||
|
return (
|
||||||
|
<Dialog
|
||||||
|
onClose={onClose}
|
||||||
|
onBackdropClick={onClose}
|
||||||
|
aria-labelledby="customized-dialog-title"
|
||||||
|
open={open}
|
||||||
|
>
|
||||||
|
<DialogTitle id="customized-dialog-title" onClose={onClose}>
|
||||||
|
Navidrome Music Server
|
||||||
|
</DialogTitle>
|
||||||
|
<DialogContent dividers>
|
||||||
|
<TableContainer component={Paper}>
|
||||||
|
<Table aria-label="song details" size="small">
|
||||||
|
<TableBody>
|
||||||
|
<TableRow>
|
||||||
|
<TableCell align="right" component="th" scope="row">
|
||||||
|
{translate('menu.version')}:
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="left">{config.version}</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
{Object.keys(links).map((key) => {
|
||||||
|
return (
|
||||||
|
<TableRow key={key}>
|
||||||
|
<TableCell align="right" component="th" scope="row">
|
||||||
|
{translate(`about.links.${key}`, {
|
||||||
|
_: inflection.humanize(inflection.underscore(key)),
|
||||||
|
})}
|
||||||
|
:
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="left">
|
||||||
|
<Link
|
||||||
|
href={`https://${links[key]}`}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
{links[key]}
|
||||||
|
</Link>
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
)
|
||||||
|
})}
|
||||||
|
<TableRow>
|
||||||
|
<TableCell align="right" component="th" scope="row">
|
||||||
|
<Link
|
||||||
|
href={'https://github.com/sponsors/deluan'}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
<IconButton size={'small'}>
|
||||||
|
<FavoriteBorderIcon fontSize={'small'} />
|
||||||
|
</IconButton>
|
||||||
|
</Link>
|
||||||
|
</TableCell>
|
||||||
|
<TableCell align="left">
|
||||||
|
<Link
|
||||||
|
href={'https://ko-fi.com/deluan'}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
>
|
||||||
|
ko-fi.com/deluan
|
||||||
|
</Link>
|
||||||
|
</TableCell>
|
||||||
|
</TableRow>
|
||||||
|
</TableBody>
|
||||||
|
</Table>
|
||||||
|
</TableContainer>
|
||||||
|
</DialogContent>
|
||||||
|
</Dialog>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
AboutDialog.propTypes = {
|
||||||
|
open: PropTypes.bool.isRequired,
|
||||||
|
onClose: PropTypes.func.isRequired,
|
||||||
|
}
|
||||||
|
|
||||||
|
export default AboutDialog
|
||||||
+35
-22
@@ -1,40 +1,53 @@
|
|||||||
import React, { forwardRef } from 'react'
|
import React, { forwardRef } from 'react'
|
||||||
import {
|
import { AppBar as RAAppBar, UserMenu, useTranslate } from 'react-admin'
|
||||||
AppBar as RAAppBar,
|
import { makeStyles, MenuItem, ListItemIcon } from '@material-ui/core'
|
||||||
MenuItemLink,
|
|
||||||
UserMenu,
|
|
||||||
useTranslate,
|
|
||||||
} from 'react-admin'
|
|
||||||
import { makeStyles } from '@material-ui/core'
|
|
||||||
import InfoIcon from '@material-ui/icons/Info'
|
import InfoIcon from '@material-ui/icons/Info'
|
||||||
import config from '../config'
|
import AboutDialog from './AboutDialog'
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
const useStyles = makeStyles((theme) => ({
|
||||||
menuItem: {
|
root: {
|
||||||
color: theme.palette.text.secondary,
|
color: theme.palette.text.secondary,
|
||||||
},
|
},
|
||||||
|
active: {
|
||||||
|
color: theme.palette.text.primary,
|
||||||
|
},
|
||||||
|
icon: { minWidth: theme.spacing(5) },
|
||||||
}))
|
}))
|
||||||
|
|
||||||
const VersionMenu = forwardRef((props, ref) => {
|
const AboutMenuItem = forwardRef(({ onClick, ...rest }, ref) => {
|
||||||
|
const classes = useStyles(rest)
|
||||||
const translate = useTranslate()
|
const translate = useTranslate()
|
||||||
const classes = useStyles()
|
const [open, setOpen] = React.useState(false)
|
||||||
|
|
||||||
|
const handleOpen = () => {
|
||||||
|
setOpen(true)
|
||||||
|
}
|
||||||
|
const handleClose = () => {
|
||||||
|
onClick && onClick()
|
||||||
|
setOpen(false)
|
||||||
|
}
|
||||||
|
const label = translate('menu.about')
|
||||||
return (
|
return (
|
||||||
<MenuItemLink
|
<>
|
||||||
ref={ref}
|
<MenuItem
|
||||||
to="#"
|
ref={ref}
|
||||||
primaryText={translate('menu.version', {
|
onClick={handleOpen}
|
||||||
version: config.version,
|
className={classes.root}
|
||||||
})}
|
activeClassName={classes.active}
|
||||||
leftIcon={<InfoIcon />}
|
>
|
||||||
className={classes.menuItem}
|
<ListItemIcon className={classes.icon}>
|
||||||
sidebarIsOpen={true}
|
<InfoIcon titleAccess={label} />
|
||||||
/>
|
</ListItemIcon>
|
||||||
|
{label}
|
||||||
|
</MenuItem>
|
||||||
|
<AboutDialog onClose={handleClose} open={open} />
|
||||||
|
</>
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
const CustomUserMenu = (props) => (
|
const CustomUserMenu = (props) => (
|
||||||
<UserMenu {...props}>
|
<UserMenu {...props}>
|
||||||
<VersionMenu />
|
<AboutMenuItem />
|
||||||
</UserMenu>
|
</UserMenu>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user