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 5514x 14x 14x 14x 14x 14x 14x 14x                                 516x 516x   516x                                                      
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";
 
export type ProfileIncompleteAction =
  | "create_event"
  | "send_message"
  | "send_request"
  | "create_public_trip"
  | "send_friend_request"
  | "create_discussion"
  | "post_comment";
 
interface ProfileIncompleteDialogProps {
  open: boolean;
  onClose: () => void;
  attempted_action: ProfileIncompleteAction;
}
 
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 }} />
        </DialogContentText>
        <DialogContentText>
          <Trans
            i18nKey="profile:complete_profile_dialog.description_2"
            components={{ helpLink: <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>
  );
}