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 | 7x 7x 7x 7x 7x 7x 7x 19x 31x 35x 35x 35x | import { styled } from "@mui/material"; import Alert from "components/Alert"; import CenteredSpinner from "components/CenteredSpinner/CenteredSpinner"; import { useCommunity } from "features/communities/hooks"; import { useTranslation } from "i18n"; import { COMMUNITIES } from "i18n/namespaces"; import { Community } from "proto/communities_pb"; import React from "react"; interface CommunityBaseProps { children(communityParams: { community: Community.AsObject }): React.ReactNode; communityId: number; } const StyledWrapper = styled("div")(({ theme }) => ({ marginBottom: theme.spacing(2), "& > section": { margin: theme.spacing(3, 0), }, })); export default function CommunityBase({ children, communityId, }: CommunityBaseProps) { const { t } = useTranslation([COMMUNITIES]); const { isLoading: isCommunityLoading, error: communityError, data: community, } = useCommunity(communityId); if (!communityId) return ( <Alert severity="error">{t("communities:invalid_community_id")}</Alert> ); if (isCommunityLoading) return <CenteredSpinner />; if (!community || communityError) return ( <Alert severity="error"> {communityError?.message || t("communities:error_loading_community")} </Alert> ); return <StyledWrapper>{children({ community })}</StyledWrapper>; } |