All files / app/components/ProfileIncompleteDialog ProfileIncompleteDialog.tsx

100% Statements 11/11
100% Branches 0/0
100% Functions 1/1
100% Lines 11/11

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 8211x             11x 11x 11x 11x 11x 11x 11x                           101x         101x   101x                                                                                              
import Button from "components/Button";
import {
  Dialog,
  DialogActions,
  DialogContent,
  DialogContentText,
  DialogTitle,
} from "components/Dialog";
import StyledLink from "components/StyledLink";
import { Trans, useTranslation } from "i18n";
import { PROFILE } from "i18n/namespaces";
import Link from "next/link";
import React from "react";
import { howToCompleteProfileUrl, routeToEditProfile } from "routes";
 
interface ProfileIncompleteDialogProps {
  open: boolean;
  onClose: () => void;
  attempted_action:
    | "create_event"
    | "send_message"
    | "send_request"
    | "create_public_trip"
    | "send_friend_request"
    | "create_discussion";
}
 
export default function ProfileIncompleteDialog({
  open,
  onClose,
  attempted_action,
}: ProfileIncompleteDialogProps) {
  const { t } = useTranslation([PROFILE]);
 
  const action_text = t(
    `profile:complete_profile_dialog.actions.${attempted_action}`,
  );
 
  return (
    <Dialog
      aria-labelledby="profile-incomplete-dialog-title"
      open={open}
      onClose={onClose}
    >
      <DialogTitle id="profile-incomplete-dialog-title">
        {t("profile:complete_profile_dialog.title")}
      </DialogTitle>
      <DialogContent>
        <DialogContentText>
          <Trans
            i18nKey="profile:complete_profile_dialog.description_1"
            values={{ action_name: action_text }}
            components={{ 4: <strong />, 7: <strong /> }}
          />
        </DialogContentText>
        <DialogContentText>
          <Trans
            i18nKey="profile:complete_profile_dialog.description_2"
            components={{ 2: <StyledLink href={howToCompleteProfileUrl} /> }}
          />
        </DialogContentText>
      </DialogContent>
      <DialogActions>
        <Button
          variant="outlined"
          onClick={onClose}
          sx={{ textAlign: "center" }}
        >
          {t("profile:complete_profile_dialog.cancel_button")}
        </Button>
        <Button
          component={Link}
          href={routeToEditProfile()}
          sx={{ textAlign: "center" }}
        >
          {t("profile:complete_profile_dialog.edit_profile_button")}
        </Button>
      </DialogActions>
    </Dialog>
  );
}