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 | 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 4x 21x 11x 7x 21x 21x 21x 4x 3x | import { styled, 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 { theme } from "theme";
import CommunityModeratorsDialog from "./CommunityModeratorsDialog";
import { SectionTitle } from "./CommunityPage";
import { useListAdmins } from "./hooks";
const StyledSection = styled("section")(() => ({
display: "grid",
rowGap: theme.spacing(2),
}));
const StyledLoadMoreModeratorsButton = styled(Button)(() => ({
justifySelf: "center",
}));
interface CommunityModeratorsSectionProps {
community: Community.AsObject;
}
export default function CommunityModeratorsSection({
community,
}: CommunityModeratorsSectionProps) {
const { t } = useTranslation([COMMUNITIES]);
const { adminIds, error, hasNextPage } = useListAdmins(
community.communityId,
"summary",
);
const [isModeratorsDialogOpen, setIsModeratorsDialogOpen] = useState(false);
return (
<StyledSection>
<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 && (
<>
<StyledLoadMoreModeratorsButton
onClick={() => setIsModeratorsDialogOpen(true)}
>
{t("communities:see_all_moderators")}
</StyledLoadMoreModeratorsButton>
<CommunityModeratorsDialog
community={community}
onClose={() => setIsModeratorsDialogOpen(false)}
open={isModeratorsDialogOpen}
/>
</>
)}
</StyledSection>
);
}
|