All files / app/features/dashboard CommunitiesSection.tsx

0% Statements 0/14
100% Branches 0/0
0% Functions 0/2
0% Lines 0/13

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 63 64 65                                                                                                                                 
import { Link as MuiLink, Typography } from "@mui/material";
import makeStyles from "@mui/styles/makeStyles";
import StyledLink from "components/StyledLink";
import useAccountInfo from "features/auth/useAccountInfo";
import CommunitiesList from "features/dashboard/CommunitiesList";
import { Trans, useTranslation } from "i18n";
import { DASHBOARD, GLOBAL } from "i18n/namespaces";
import { communityCreationFormURL } from "routes";
 
const useStyles = makeStyles((theme) => ({
  createCommunityText: {
    paddingBlockStart: theme.spacing(2),
  },
  browseCommunitiesLink: {
    verticalAlign: "baseline",
  },
}));
 
export default function CommunitiesSection() {
  const { t } = useTranslation([GLOBAL, DASHBOARD]);
  const classes = useStyles();
 
  const { data: accountInfo } = useAccountInfo();
 
  return (
    <>
      <Typography variant="h2" gutterBottom>
        {t("dashboard:your_communities_heading")}
      </Typography>
      <Typography variant="body1" paragraph>
        <Trans i18nKey="dashboard:your_communities_helper_text">
          {`You have been added to all communities based on your location. Feel free to `}
          <StyledLink
            href="/communities"
            className={classes.browseCommunitiesLink}
            underline="hover"
          >
            browse communities
          </StyledLink>
          {` in other locations as well.`}
        </Trans>
      </Typography>
      <CommunitiesList />
 
      <Typography
        variant="body1"
        paragraph
        className={classes.createCommunityText}
      >
        <Trans i18nKey="dashboard:your_communities_helper_text2">
          {`Don't see your community? `}
          <MuiLink
            href={communityCreationFormURL(accountInfo?.username)}
            target="_blank"
            rel="noreferrer noopener"
            underline="hover"
          >
            Get it started!
          </MuiLink>
        </Trans>
      </Typography>
    </>
  );
}