All files / pages HomePageConnectGithub.jsx

100% Statements 46/46
100% Branches 3/3
100% Functions 3/3
100% Lines 46/46

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 651x 1x 1x 1x 1x 1x   1x 4x 4x 4x 4x     4x 4x   4x 1x 1x   4x   4x 4x   4x 4x 4x 4x 4x 4x 4x 4x   4x   4x 4x 4x 4x 4x   4x 4x 4x     4x 4x 4x 4x 4x 4x 4x 4x 4x             4x  
import BasicLayout from "main/layouts/BasicLayout/BasicLayout";
import { FaGithubSquare } from "react-icons/fa";
import { useSystemInfo } from "main/utils/systemInfo";
import { Row, Button, Container } from "react-bootstrap";
import SignInCard from "main/components/Auth/SignInCard";
import { useLocation } from "react-router";
 
export default function HomePageConnectGithub() {
  const githubIcon = () => {
    return (
      <span data-testid={"HomePageConnectGithub-githubIcon"}>
        <FaGithubSquare size={"10em"} role={"img"} />
      </span>
    );
  };
  const location = useLocation();
 
  const setRedirect = () => {
    sessionStorage.setItem("redirect", location.pathname);
  };
 
  const { data: systemInfo } = useSystemInfo();
 
  var githubOauthLogin =
    systemInfo.githubOauthLogin || "/oauth2/authorization/github";
 
  return (
    <BasicLayout>
      <Container className="text-center">
        <Row
          xs={1}
          md={2}
          className={
            "g-5 d-flex gap-5 justify-content-center align-items-center"
          }
          data-testid={"HomePageConnectGithub-cardDisplay"}
        >
          <SignInCard
            Icon={githubIcon}
            title={"Sign in with Github"}
            description={
              "Please connect your account with a GitHub account to continue to Frontiers."
            }
            url={githubOauthLogin}
            testid={"github"}
            onClick={setRedirect}
          />
        </Row>
        <div className="mt-4">
          <p>Don't have a GitHub account?</p>
          <Button
            variant="outline-primary"
            href="https://github.com/signup"
            target="_blank"
            rel="noopener noreferrer"
            data-testid="HomePageConnectGithub-createAccount"
          >
            Create GitHub Account
          </Button>
        </div>
      </Container>
    </BasicLayout>
  );
}