settings.tsx 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import { Flex } from "reflexbox/styled-components";
  2. import { NextPage } from "next";
  3. import React, { useEffect } from "react";
  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 BodyWrapper from "../components/BodyWrapper";
  9. import Divider from "../components/Divider";
  10. import Footer from "../components/Footer";
  11. import { useStoreState, useStoreActions } from "../store";
  12. import Text from "../components/Text";
  13. const SettingsPage: NextPage = () => {
  14. const { email, isAdmin } = useStoreState(s => s.auth);
  15. const getSettings = useStoreActions(s => s.settings.getSettings);
  16. useEffect(() => {
  17. getSettings();
  18. }, []);
  19. return (
  20. <BodyWrapper>
  21. <Flex
  22. width={600}
  23. maxWidth="90%"
  24. flexDirection="column"
  25. alignItems="flex-start"
  26. pb={80}
  27. mt={4}
  28. >
  29. <Text as="h1" alignItems="center" fontWeight={300} fontSize={[24, 28]}>
  30. Welcome,{" "}
  31. <Text as="span" pb="2px" style={{ borderBottom: "2px dotted #999" }}>
  32. {email}
  33. </Text>
  34. .
  35. </Text>
  36. <Divider my={[4, 48]} />
  37. {isAdmin && (
  38. <>
  39. <SettingsBan />
  40. <Divider my={[12, 24]} />
  41. </>
  42. )}
  43. <SettingsDomain />
  44. <Divider my={[12, 24]} />
  45. <SettingsPassword />
  46. <Divider my={[12, 24]} />
  47. <SettingsApi />
  48. </Flex>
  49. <Footer />
  50. </BodyWrapper>
  51. );
  52. };
  53. export default SettingsPage;