All files / components/Onboarding OnboardingSelectCoursesComponent.jsx

100% Statements 4/4
100% Branches 6/6
100% Functions 3/3
100% Lines 3/3

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                15x 5x                 26x                                                                        
import { Row, Button, Col } from "react-bootstrap";
import { Link } from "react-router";
import {
  StudentCoursesTable,
  StudentCoursesTableView,
} from "main/components/Courses/StudentCoursesTable";
 
// Stryker disable all : no-op defaults used only when a preview omits a handler
const notJoining = () => false;
const noop = () => {};
// Stryker restore all
 
export default function OnboardingSelectCoursesComponent({
  courses,
  onJoinCourse = noop,
  onViewInvite = noop,
  onContinue,
}) {
  return (
    <>
      <Row>
        <h1>Joining Courses</h1>
        <p>
          Next, you&#39;re listed on the roster of the courses below. Follow the
          prompts to join:
        </p>
        {courses ? (
          // Preview mode: no course name links and no real GitHub invite, so
          // every control stays inside the preview
          <StudentCoursesTableView
            courses={courses}
            testid={"OnboardingCoursesTable"}
            joinCallback={onJoinCourse}
            isLoading={notJoining}
            viewInviteCallback={onViewInvite}
          />
        ) : (
          <StudentCoursesTable testid={"OnboardingCoursesTable"} />
        )}
      </Row>
      <Row className="pt-5 justify-content-center pb-3">
        <Col xs="auto" className="text-center">
          {onContinue ? (
            <Button onClick={onContinue}>Continue</Button>
          ) : (
            <Button as={Link} to="/onboarding/success">
              Continue
            </Button>
          )}
        </Col>
      </Row>
    </>
  );
}