Skip to content

Commit

Permalink
Fixed bug with redirecting to GitHub Classrooms
Browse files Browse the repository at this point in the history
  • Loading branch information
chekjun committed Jun 18, 2021
1 parent 537862c commit a12e707
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import { Octokit } from '@octokit/rest';
import classNames from 'classnames';
import * as React from 'react';
import { NavLink } from 'react-router-dom';
import { assessmentTypeLink } from 'src/commons/utils/ParamParseHelper';
import { GHAssessmentTypeOverview } from 'src/pages/githubAssessments/GitHubClassroom';

import { assessmentTypeLink } from '../../../commons/utils/ParamParseHelper';
import { GHAssessmentTypeOverview } from '../../../pages/githubAssessments/GitHubClassroom';
import { ControlBarGitHubLoginButton } from '../../controlBar/github/ControlBarGitHubLoginButton';

type GitHubAssessmentsNavigationBarProps = DispatchProps & StateProps;
Expand Down
10 changes: 7 additions & 3 deletions src/pages/githubAssessments/GitHubAssessmentListing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ const GitHubAssessmentListing: React.FC<GitHubAssessmentListingProps> = props =>
);

const refreshButton = useMemo(
() => <Button icon={IconNames.REFRESH} onClick={props.refreshAssessmentOverviews} />,
() => (
<Button icon={IconNames.REFRESH} onClick={props.refreshAssessmentOverviews}>
Refresh Assessments
</Button>
),
[props.refreshAssessmentOverviews]
);

Expand Down Expand Up @@ -106,11 +110,11 @@ function convertAssessmentOverviewToCard(

const assessmentNotAccepted = assessmentOverview.link !== undefined;
let buttonText = 'Open';
const handleClick = () => history.push(`/githubassessments/editor`, assessmentOverview);
let handleClick = () => history.push(`/githubassessments/editor`, assessmentOverview);

if (assessmentNotAccepted) {
buttonText = 'Accept';
window.open(assessmentOverview.link);
handleClick = () => window.open(assessmentOverview.link);
}

if (isOverdue) {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/githubAssessments/GitHubClassroom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import * as React from 'react';
import { useEffect, useState } from 'react';
import { useSelector } from 'react-redux';
import { Redirect, Route, Switch, useLocation } from 'react-router-dom';
import { assessmentTypeLink } from 'src/commons/utils/ParamParseHelper';

import { OverallState } from '../../commons/application/ApplicationTypes';
import ContentDisplay from '../../commons/ContentDisplay';
import { MissionRepoData } from '../../commons/githubAssessments/GitHubMissionTypes';
import GitHubAssessmentsNavigationBar from '../../commons/navigationBar/subcomponents/GitHubAssessmentsNavigationBar';
import { showWarningMessage } from '../../commons/utils/NotificationsHelper';
import { assessmentTypeLink } from '../../commons/utils/ParamParseHelper';
import GitHubAssessmentListing from './GitHubAssessmentListing';
import GitHubAssessmentWorkspaceContainer from './GitHubAssessmentWorkspaceContainer';
import GitHubClassroomWelcome from './GitHubClassroomWelcome';
Expand Down

0 comments on commit a12e707

Please sign in to comment.