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 | 4x 4x 4x 4x 4x 4x 4x 11x 16x 16x 1x | import Button from "components/Button";
import {
AccessibleDialogProps,
Dialog,
DialogActions,
DialogContent,
DialogTitle,
} from "components/Dialog";
import UsersList from "components/UsersList";
import { useTranslation } from "i18n";
import { COMMUNITIES } from "i18n/namespaces";
import { Community } from "proto/communities_pb";
import { useListAdmins } from "./hooks";
interface CommunityModeratorsDialogProps {
community: Community.AsObject;
onClose: AccessibleDialogProps["onClose"];
open?: boolean;
}
export const DIALOG_LABEL_ID = "moderator-title";
export default function CommunityModeratorsDialog({
community,
onClose,
open = false,
}: CommunityModeratorsDialogProps) {
const { t } = useTranslation([COMMUNITIES]);
const { adminIds, error, fetchNextPage, isFetchingNextPage, hasNextPage } =
useListAdmins(community.communityId, "all");
return (
<Dialog aria-labelledby={DIALOG_LABEL_ID} open={open} onClose={onClose}>
<DialogTitle id={DIALOG_LABEL_ID}>
{t("communities:community_moderators")}
</DialogTitle>
<DialogContent>
<UsersList userIds={adminIds} error={error} />
</DialogContent>
{hasNextPage && (
<DialogActions>
<Button loading={isFetchingNextPage} onClick={() => fetchNextPage()}>
{t("communities:load_more_moderators")}
</Button>
</DialogActions>
)}
</Dialog>
);
}
|