All files / app/features/communities/events EventsPage.tsx

100% Statements 18/18
100% Branches 0/0
100% Functions 3/3
100% Lines 16/16

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 631x 1x 1x 1x 1x 1x 1x   1x 1x   1x                                             1x 2x 2x   2x                 1x                           1x  
import { Button, Typography } from "@mui/material";
import PageTitle from "components/PageTitle";
import { useTranslation } from "i18n";
import { COMMUNITIES, GLOBAL } from "i18n/namespaces";
import { useRouter } from "next/router";
import { newEventRoute } from "routes";
import makeStyles from "utils/makeStyles";
 
import DiscoverEventsList from "../events/DiscoverEventsList";
import MyEventsList from "./MyEventsList";
 
const useStyles = makeStyles((theme) => ({
  button: {
    backgroundColor: theme.palette.primary.main,
    color: theme.palette.common.white,
    margin: theme.spacing(2),
    padding: theme.spacing(1, 2),
    "&:hover": {
      backgroundColor: theme.palette.primary.dark,
    },
    fontWeight: "bold",
  },
  column: {
    display: "flex",
    flexDirection: "column",
  },
  headerRow: {
    display: "flex",
    justifyContent: "space-between",
    width: "100%",
    paddingBottom: theme.spacing(1),
  },
}));
 
const EventsPage = () => {
  const classes = useStyles();
  const router = useRouter();
 
  const { t } = useTranslation([GLOBAL, COMMUNITIES]);
 
  return (
    <div>
      <div className={classes.headerRow}>
        <PageTitle>{t("communities:events_title")}</PageTitle>
        <Button
          className={classes.button}
          size="small"
          onClick={() => router.push(newEventRoute)}
        >
          {t("communities:create_new_event")}
        </Button>
      </div>
      <div className={classes.column}>
        <Typography variant="h2">{t("communities:your_events")}</Typography>
        <MyEventsList />
      </div>
      <DiscoverEventsList />
    </div>
  );
};
 
export default EventsPage;