settings.tsx 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import { Flex } from "reflexbox/styled-components";
  2. import React, { useEffect } from "react";
  3. import { NextPage } from "next";
  4. import SettingsPassword from "../components/Settings/SettingsPassword";
  5. import SettingsDomain from "../components/Settings/SettingsDomain";
  6. import SettingsBan from "../components/Settings/SettingsBan";
  7. import SettingsApi from "../components/Settings/SettingsApi";
  8. import { useStoreState, useStoreActions } from "../store";
  9. import AppWrapper from "../components/AppWrapper";
  10. import { H1, Span } from "../components/Text";
  11. import Divider from "../components/Divider";
  12. import Footer from "../components/Footer";
  13. import { Col } from "../components/Layout";
  14. const SettingsPage: NextPage = props => {
  15. const { email, isAdmin } = useStoreState(s => s.auth);
  16. const getSettings = useStoreActions(s => s.settings.getSettings);
  17. useEffect(() => {
  18. getSettings();
  19. }, [false]);
  20. return (
  21. <AppWrapper>
  22. <Col width={600} maxWidth="90%" alignItems="flex-start" pb={80} mt={4}>
  23. <H1 alignItems="center" fontSize={[24, 28]} light>
  24. Welcome,{" "}
  25. <Span pb="2px" style={{ borderBottom: "2px dotted #999" }}>
  26. {email}
  27. </Span>
  28. .
  29. </H1>
  30. <Divider my={[4, 48]} />
  31. {isAdmin && (
  32. <>
  33. <SettingsBan />
  34. <Divider my={[12, 24]} />
  35. </>
  36. )}
  37. <SettingsDomain />
  38. <Divider my={[12, 24]} />
  39. <SettingsPassword />
  40. <Divider my={[12, 24]} />
  41. <SettingsApi />
  42. </Col>
  43. <Footer />
  44. </AppWrapper>
  45. );
  46. };
  47. export default SettingsPage;