mirror of
https://github.com/Myzel394/kleckrelay-website.git
synced 2025-06-19 07:55:25 +02:00
fix: Only show admin Page when user is admin; Remove Overview section
This commit is contained in:
parent
f0ecace475
commit
b405a0817f
@ -11,15 +11,17 @@ import NavigationButton, {
|
|||||||
NavigationSection,
|
NavigationSection,
|
||||||
} from "~/route-widgets/AuthenticateRoute/NavigationButton"
|
} from "~/route-widgets/AuthenticateRoute/NavigationButton"
|
||||||
|
|
||||||
const sections = (Object.keys(NavigationSection) as Array<keyof typeof NavigationSection>).filter(
|
|
||||||
value => isNaN(Number(value)),
|
|
||||||
)
|
|
||||||
|
|
||||||
export default function AuthenticatedRoute(): ReactElement {
|
export default function AuthenticatedRoute(): ReactElement {
|
||||||
const {t} = useTranslation()
|
const {t} = useTranslation()
|
||||||
const theme = useTheme()
|
const theme = useTheme()
|
||||||
|
const user = useUser()
|
||||||
|
|
||||||
useUser()
|
const sections = [
|
||||||
|
NavigationSection.Aliases,
|
||||||
|
NavigationSection.Reports,
|
||||||
|
NavigationSection.Settings,
|
||||||
|
user.isAdmin && NavigationSection.Admin,
|
||||||
|
].filter(value => value !== false) as NavigationSection[]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<LockNavigationContextProvider>
|
<LockNavigationContextProvider>
|
||||||
@ -50,7 +52,7 @@ export default function AuthenticatedRoute(): ReactElement {
|
|||||||
<List component="nav">
|
<List component="nav">
|
||||||
{sections.map(key => (
|
{sections.map(key => (
|
||||||
<ListItem key={key}>
|
<ListItem key={key}>
|
||||||
<NavigationButton section={NavigationSection[key]} />
|
<NavigationButton section={key} />
|
||||||
</ListItem>
|
</ListItem>
|
||||||
))}
|
))}
|
||||||
</List>
|
</List>
|
||||||
|
@ -45,7 +45,6 @@ export default function VerifyEmailRoute(): ReactElement {
|
|||||||
verifyEmail,
|
verifyEmail,
|
||||||
{
|
{
|
||||||
onSuccess: ({user}) => {
|
onSuccess: ({user}) => {
|
||||||
setEmail("")
|
|
||||||
login(user)
|
login(user)
|
||||||
navigate("/auth/complete-account")
|
navigate("/auth/complete-account")
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user