2024-05-31 08:57:43 +05:00
|
|
|
import AccountCircleIcon from '@mui/icons-material/AccountCircle'
|
|
|
|
import ArrowForwardIosIcon from '@mui/icons-material/ArrowForwardIos'
|
2024-05-31 14:26:59 +05:00
|
|
|
import CachedIcon from '@mui/icons-material/Cached'
|
2024-05-31 08:57:43 +05:00
|
|
|
import RouterIcon from '@mui/icons-material/Router'
|
|
|
|
import { useTheme } from '@mui/material'
|
|
|
|
import List from '@mui/material/List'
|
|
|
|
import ListItemButton from '@mui/material/ListItemButton'
|
|
|
|
import ListItemIcon from '@mui/material/ListItemIcon'
|
|
|
|
import ListItemText from '@mui/material/ListItemText'
|
|
|
|
import ListSubheader from '@mui/material/ListSubheader'
|
|
|
|
import { useSelector } from 'react-redux'
|
|
|
|
import { useNavigate } from 'react-router-dom'
|
|
|
|
import { appPrivateRoutes, getProfileSettingsRoute } from '../../routes'
|
|
|
|
import { State } from '../../store/rootReducer'
|
2024-07-30 10:28:57 +02:00
|
|
|
import { Container } from '../../components/Container'
|
2024-08-29 16:43:09 +02:00
|
|
|
import { Footer } from '../../components/Footer/Footer'
|
2024-05-31 08:57:43 +05:00
|
|
|
|
|
|
|
export const SettingsPage = () => {
|
|
|
|
const theme = useTheme()
|
|
|
|
|
|
|
|
const navigate = useNavigate()
|
|
|
|
const usersPubkey = useSelector((state: State) => state.auth.usersPubkey)
|
|
|
|
|
|
|
|
const listItem = (label: string, disabled = false) => {
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<ListItemText
|
|
|
|
primary={label}
|
|
|
|
sx={{
|
|
|
|
color: theme.palette.text.primary
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
|
|
|
|
{!disabled && (
|
|
|
|
<ArrowForwardIosIcon
|
|
|
|
style={{
|
|
|
|
color: theme.palette.action.active,
|
|
|
|
marginRight: -10
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
)}
|
|
|
|
</>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2024-08-29 16:43:09 +02:00
|
|
|
<>
|
|
|
|
<Container>
|
|
|
|
<List
|
|
|
|
sx={{
|
|
|
|
width: '100%',
|
|
|
|
bgcolor: 'background.paper'
|
2024-07-30 10:28:57 +02:00
|
|
|
}}
|
2024-08-29 16:43:09 +02:00
|
|
|
subheader={
|
|
|
|
<ListSubheader
|
|
|
|
sx={{
|
|
|
|
fontSize: '1.5rem',
|
|
|
|
borderBottom: '0.5px solid',
|
|
|
|
paddingBottom: 2,
|
|
|
|
paddingTop: 2
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
Settings
|
|
|
|
</ListSubheader>
|
|
|
|
}
|
2024-07-30 10:28:57 +02:00
|
|
|
>
|
2024-08-29 16:43:09 +02:00
|
|
|
<ListItemButton
|
|
|
|
onClick={() => {
|
|
|
|
navigate(getProfileSettingsRoute(usersPubkey!))
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<ListItemIcon>
|
|
|
|
<AccountCircleIcon />
|
|
|
|
</ListItemIcon>
|
|
|
|
{listItem('Profile')}
|
|
|
|
</ListItemButton>
|
|
|
|
<ListItemButton
|
|
|
|
onClick={() => {
|
|
|
|
navigate(appPrivateRoutes.relays)
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<ListItemIcon>
|
|
|
|
<RouterIcon />
|
|
|
|
</ListItemIcon>
|
|
|
|
{listItem('Relays')}
|
|
|
|
</ListItemButton>
|
|
|
|
<ListItemButton
|
|
|
|
onClick={() => {
|
|
|
|
navigate(appPrivateRoutes.cacheSettings)
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
<ListItemIcon>
|
|
|
|
<CachedIcon />
|
|
|
|
</ListItemIcon>
|
|
|
|
{listItem('Local Cache')}
|
|
|
|
</ListItemButton>
|
|
|
|
</List>
|
|
|
|
</Container>
|
|
|
|
<Footer />
|
|
|
|
</>
|
2024-05-31 08:57:43 +05:00
|
|
|
)
|
|
|
|
}
|