import React from 'react'
import { useDispatch, useSelector } from 'react-redux'
import { Card } from '@material-ui/core'
import {
SelectInput,
SimpleForm,
Title,
useLocale,
useSetLocale,
useTranslate,
} from 'react-admin'
import { makeStyles } from '@material-ui/core/styles'
import HelpOutlineIcon from '@material-ui/icons/HelpOutline'
import { changeTheme } from './actions'
import themes from '../themes'
import { docsUrl } from '../utils/docsUrl'
import { useGetLanguageChoices } from '../i18nProvider'
const useStyles = makeStyles({
root: { marginTop: '1em' },
})
const helpKey = '_help'
function openInNewTab(url) {
const win = window.open(url, '_blank')
win.focus()
}
const HelpMsg = ({ caption }) => (
<>
{caption}
>
)
const SelectLanguage = (props) => {
const translate = useTranslate()
const setLocale = useSetLocale()
const locale = useLocale()
const { choices } = useGetLanguageChoices()
choices.push({
id: helpKey,
name: ,
})
return (
{
if (event.target.value === helpKey) {
openInNewTab(docsUrl('/docs/developers/translations/'))
return
}
setLocale(event.target.value)
localStorage.setItem('locale', event.target.value)
}}
/>
)
}
const SelectTheme = (props) => {
const translate = useTranslate()
const dispatch = useDispatch()
const currentTheme = useSelector((state) => state.theme)
const themeChoices = Object.keys(themes).map((key) => {
return { id: key, name: themes[key].themeName }
})
themeChoices.push({
id: helpKey,
name: ,
})
return (
{
if (event.target.value === helpKey) {
openInNewTab(docsUrl('/docs/developers/creating-themes/'))
return
}
dispatch(changeTheme(event.target.value))
}}
/>
)
}
const Personal = () => {
const translate = useTranslate()
const classes = useStyles()
return (
)
}
export default Personal