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 66 67 68 69 70 71 72 73 74 75 76 77 | 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 5x 7x 7x 23x 23x 23x 23x 4x 3x | import { Typography } from "@mui/material"; import Button from "components/Button"; import { CommunityLeadersIcon } from "components/Icons"; import UsersList from "components/UsersList"; import { useTranslation } from "i18n"; import { COMMUNITIES } from "i18n/namespaces"; import { Community } from "proto/communities_pb"; import { useState } from "react"; import makeStyles from "utils/makeStyles"; import CommunityModeratorsDialog from "./CommunityModeratorsDialog"; import { SectionTitle } from "./CommunityPage"; import { useListAdmins } from "./hooks"; const useStyles = makeStyles((theme) => ({ section: { display: "grid", rowGap: theme.spacing(2), }, loadMoreModeratorsButton: { justifySelf: "center", }, moderatorsContainer: { display: "grid", gap: theme.spacing(3), gridTemplateColumns: `repeat(auto-fit, minmax(auto, 21.875rem))`, }, })); interface CommunityModeratorsSectionProps { community: Community.AsObject; } export default function CommunityModeratorsSection({ community, }: CommunityModeratorsSectionProps) { const { t } = useTranslation([COMMUNITIES]); const classes = useStyles(); const { adminIds, error, hasNextPage } = useListAdmins( community.communityId, "summary" ); const [isModeratorsDialogOpen, setIsModeratorsDialogOpen] = useState(false); return ( <section className={classes.section}> <SectionTitle icon={<CommunityLeadersIcon />} variant="h2"> {t("communities:community_moderators")} </SectionTitle> <UsersList error={error} userIds={adminIds} emptyListChildren={ <Typography variant="body1"> {t("communities:no_moderators")} </Typography> } /> {hasNextPage && ( <> <Button className={classes.loadMoreModeratorsButton} onClick={() => setIsModeratorsDialogOpen(true)} > {t("communities:see_all_moderators")} </Button> <CommunityModeratorsDialog community={community} onClose={() => setIsModeratorsDialogOpen(false)} open={isModeratorsDialogOpen} /> </> )} </section> ); } |