[ABANDONED] React/Redux front end for the Flexor social network.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.3 KiB

4 years ago
4 years ago
  1. import React, { FC, useEffect } from 'react'
  2. import { useSelector } from 'react-redux'
  3. import { Link, useHistory } from 'react-router-dom'
  4. import { useTheme, useAuthenticationCheck } from '../../hooks'
  5. import { getAuthenticatedUser, getChecked } from '../../selectors/authentication'
  6. import { setTitle } from '../../utils'
  7. import Section from '../../components/section'
  8. import Title from '../../components/title'
  9. import HorizontalRule from '../../components/horizontal-rule'
  10. import Loading from '../../components/pages/loading'
  11. const Admin: FC = () => {
  12. useAuthenticationCheck()
  13. const checked = useSelector(getChecked)
  14. const theme = useTheme()
  15. const user = useSelector(getAuthenticatedUser)
  16. const history = useHistory()
  17. useEffect(() => {
  18. setTitle('Admin')
  19. })
  20. if (!user) return <Loading />
  21. if (checked && !user.admin) history.push('/')
  22. return (
  23. <Section>
  24. <Title>Admin</Title>
  25. <HorizontalRule />
  26. <br /><br />
  27. <Link style={{ color: theme.secondary }} to="/admin/groups">Approve Pending Groups</Link>
  28. <br />
  29. <Link style={{ color: theme.secondary }} to="/admin/apps">Approve Pending Apps</Link>
  30. <br />
  31. </Section>
  32. )
  33. }
  34. export default Admin