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

100% Statements 21/21
100% Branches 0/0
100% Functions 5/5
100% Lines 17/17

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 581x 1x 1x 1x 1x 1x 1x   1x 1x   2x             2x                     2x         1x 2x   2x           1x                         1x  
import { Button, styled, 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 { theme } from "theme";
 
import DiscoverEventsList from "../events/DiscoverEventsList";
import MyEventsList from "./MyEventsList";
 
const StyledHeaderRow = styled("div")(() => ({
  display: "flex",
  justifyContent: "space-between",
  width: "100%",
  paddingBottom: theme.spacing(1),
}));
 
const StyledButton = styled(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",
}));
 
const StyledColumn = styled("div")(() => ({
  display: "flex",
  flexDirection: "column",
}));
 
const EventsPage = () => {
  const router = useRouter();
 
  const { t } = useTranslation([GLOBAL, COMMUNITIES]);
 
  return (
    <div>
      <StyledHeaderRow>
        <PageTitle>{t("communities:events_title")}</PageTitle>
        <StyledButton size="small" onClick={() => router.push(newEventRoute)}>
          {t("communities:create_new_event")}
        </StyledButton>
      </StyledHeaderRow>
      <StyledColumn>
        <Typography variant="h2">{t("communities:your_events")}</Typography>
        <MyEventsList />
      </StyledColumn>
      <DiscoverEventsList />
    </div>
  );
};
 
export default EventsPage;