All files / app/features/dashboard CommunitiesSection.tsx

0% Statements 0/15
100% Branches 0/0
0% Functions 0/3
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                                                                                                           
import { Link as MuiLink, styled, Typography } from "@mui/material";
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";
import { theme } from "theme";
 
const StyledBrowseCommunitiesLink = styled(StyledLink)(() => ({
  verticalAlign: "baseline",
}));
 
const StyledCreateCommunityText = styled(Typography)(() => ({
  paddingBlockStart: theme.spacing(2),
}));
 
export default function CommunitiesSection() {
  const { t } = useTranslation([GLOBAL, DASHBOARD]);
  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 `}
          <StyledBrowseCommunitiesLink href="/communities" underline="hover">
            browse communities
          </StyledBrowseCommunitiesLink>
          {` in other locations as well.`}
        </Trans>
      </Typography>
      <CommunitiesList />
 
      <StyledCreateCommunityText variant="body1" paragraph>
        <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>
      </StyledCreateCommunityText>
    </>
  );
}