All files / app/features/communities CommunityInfoPage.tsx

100% Statements 15/15
75% Branches 3/4
100% Functions 2/2
100% Lines 14/14

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 586x 6x 6x 6x 6x   6x 6x   6x 6x   7x                     6x     7x 7x   7x                                                        
import { InfoIcon } from "components/Icons";
import Markdown from "components/Markdown";
import StyledLink from "components/StyledLink";
import { useTranslation } from "i18n";
import { COMMUNITIES, GLOBAL } from "i18n/namespaces";
import { Community } from "proto/communities_pb";
import { routeToEditCommunityPage } from "routes";
import makeStyles from "utils/makeStyles";
 
import CommunityModeratorsSection from "./CommunityModeratorsSection";
import { SectionTitle } from "./CommunityPage";
 
const useStyles = makeStyles((theme) => ({
  titleContainer: {
    display: "flex",
    justifyContent: "space-between",
  },
}));
 
interface CommunityInfoPageProps {
  community: Community.AsObject;
}
 
export default function CommunityInfoPage({
  community,
}: CommunityInfoPageProps) {
  const { t } = useTranslation([COMMUNITIES, GLOBAL]);
  const classes = useStyles();
 
  return (
    <>
      <section>
        <div className={classes.titleContainer}>
          <SectionTitle icon={<InfoIcon />}>
            {t("communities:local_info_title", { name: community.name })}
          </SectionTitle>
          {community.mainPage?.canEdit && (
            <StyledLink
              href={routeToEditCommunityPage(
                community.communityId,
                community.slug
              )}
            >
              {t("global:edit")}
            </StyledLink>
          )}
        </div>
        <Markdown
          topHeaderLevel={3}
          source={community.mainPage?.content || ""}
          allowImages="couchers"
        />
      </section>
      <CommunityModeratorsSection community={community} />
    </>
  );
}