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 78 79 80 81 82 83 84 85 86 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { DialogProps, Link as MuiLink } from "@mui/material"; import Alert from "components/Alert"; import Button from "components/Button"; import { Dialog, DialogActions, DialogContent, DialogContentText, DialogTitle, } from "components/Dialog"; import { eventKey } from "features/queryKeys"; import { Empty } from "google-protobuf/google/protobuf/empty_pb"; import { RpcError } from "grpc-web"; import { useTranslation } from "i18n"; import { COMMUNITIES, GLOBAL } from "i18n/namespaces"; import React from "react"; import { useMutation, useQueryClient } from "react-query"; import { howToInviteCommunityUrl } from "routes"; import { service } from "service"; export default function InviteCommunityDialog({ eventId, afterSuccess, ...props }: DialogProps & { eventId: number; afterSuccess: () => void }) { const { t } = useTranslation([GLOBAL, COMMUNITIES]); const queryClient = useQueryClient(); const inviteCommunityMutation = useMutation<Empty, RpcError, void>( () => service.events.RequestCommunityInvite(eventId), { onSuccess: () => { afterSuccess(); queryClient.invalidateQueries(eventKey(eventId)); Iif (props.onClose) props.onClose({}, "escapeKeyDown"); }, } ); const inviteCommunity = () => inviteCommunityMutation.mutate(); return ( <Dialog {...props} aria-labelledby="invite-community-dialog-title"> <DialogTitle id="invite-community-dialog-title"> {t("communities:invite_community_dialog.title")} </DialogTitle> <DialogContent> {inviteCommunityMutation.error && ( <Alert severity="error"> {inviteCommunityMutation.error?.message} </Alert> )} <DialogContentText> {t("communities:invite_community_dialog.message")} <br /> <br /> <MuiLink key={"link_invite_community"} target="_blank" rel="noreferrer" href={howToInviteCommunityUrl} underline="hover" > {t("communities:invite_community_dialog.link")} </MuiLink> </DialogContentText> </DialogContent> <DialogActions> <Button onClick={inviteCommunity} loading={inviteCommunityMutation.isLoading} > {t("communities:invite_community_dialog_buttons.confirm")} </Button> <Button onClick={() => props.onClose ? props.onClose({}, "escapeKeyDown") : null } loading={inviteCommunityMutation.isLoading} > {t("communities:invite_community_dialog_buttons.close")} </Button> </DialogActions> </Dialog> ); } |