1- import {
2- Button ,
3- Card ,
4- Elevation ,
5- H4 ,
6- H6 ,
7- Icon ,
8- Intent ,
9- Position ,
10- Text ,
11- Tooltip
12- } from '@blueprintjs/core' ;
1+ import { Card , Elevation , H4 , H6 , Icon , Intent , Position , Text , Tooltip } from '@blueprintjs/core' ;
132import { IconName , IconNames } from '@blueprintjs/icons' ;
143import classNames from 'classnames' ;
15- import { useDispatch } from 'react-redux' ;
16- import { NavLink } from 'react-router' ;
174import classes from 'src/styles/Academy.module.scss' ;
185
196import defaultCoverImage from '../../assets/default_cover_image.jpg' ;
20- import SessionActions from '../application/actions/SessionActions' ;
217import Markdown from '../Markdown' ;
228import NotificationBadge from '../notificationBadge/NotificationBadge' ;
239import { filterNotificationsByAssessment } from '../notificationBadge/NotificationBadgeHelper' ;
24- import Constants from '../utils/Constants' ;
2510import { beforeNow , getPrettyDate , getPrettyDateAfterHours } from '../utils/DateHelper' ;
26- import { useResponsive , useTypedSelector } from '../utils/Hooks' ;
27- import { assessmentTypeLink } from '../utils/ParamParseHelper ' ;
28- import { AssessmentOverview , AssessmentStatuses } from './AssessmentTypes' ;
11+ import { useResponsive } from '../utils/Hooks' ;
12+ import AssessmentInteractButton from './AssessmentInteractButton ' ;
13+ import { AssessmentOverview } from './AssessmentTypes' ;
2914
3015type AssessmentOverviewCardProps = {
3116 /** The assessment overview to display */
@@ -41,9 +26,7 @@ type AssessmentOverviewCardProps = {
4126 makeSubmissionButton : ( overview : AssessmentOverview , index : number ) => JSX . Element ;
4227} ;
4328
44- /**
45- * A card to display `AssessmentOverview`s.
46- */
29+ /** A card to display `AssessmentOverview`s. */
4730const AssessmentOverviewCard : React . FC < AssessmentOverviewCardProps > = ( {
4831 overview,
4932 index,
@@ -157,67 +140,6 @@ const AssessmentOverviewCardTitle: React.FC<AssessmentOverviewCardTitleProps> =
157140 </ div >
158141) ;
159142
160- type AssessmentInteractButtonProps = {
161- overview : AssessmentOverview ;
162- } ;
163-
164- const AssessmentInteractButton : React . FC < AssessmentInteractButtonProps > = ( { overview } ) => {
165- let icon : IconName ;
166- let label : string ;
167- let optionalLabel : string = '' ;
168-
169- switch ( overview . status ) {
170- case AssessmentStatuses . not_attempted :
171- icon = IconNames . PLAY ;
172- label = 'Attempt' ;
173- break ;
174- case AssessmentStatuses . attempting :
175- icon = IconNames . PLAY ;
176- label = 'Continue' ;
177- optionalLabel = ' Attempt' ;
178- break ;
179- case AssessmentStatuses . attempted :
180- icon = IconNames . EDIT ;
181- label = 'Review' ;
182- optionalLabel = ' Attempt' ;
183- break ;
184- case AssessmentStatuses . submitted :
185- icon = IconNames . EYE_OPEN ;
186- label = 'Review' ;
187- optionalLabel = ' Submission' ;
188- break ;
189- default :
190- // If we reach this case, backend data did not fit IAssessmentOverview
191- icon = IconNames . PLAY ;
192- label = 'Review' ;
193- break ;
194- }
195-
196- const courseId = useTypedSelector ( state => state . session . courseId ) ;
197- const dispatch = useDispatch ( ) ;
198-
199- return (
200- < NavLink
201- to = { `/courses/${ courseId } /${ assessmentTypeLink ( overview . type ) } /${ overview . id . toString ( ) } /${
202- Constants . defaultQuestionId
203- } `}
204- >
205- < Button
206- icon = { icon }
207- minimal = { true }
208- onClick = { ( ) =>
209- dispatch (
210- SessionActions . acknowledgeNotifications ( filterNotificationsByAssessment ( overview . id ) )
211- )
212- }
213- >
214- < span data-testid = "Assessment-Attempt-Button" > { label } </ span >
215- < span className = "custom-hidden-xxxs" > { optionalLabel } </ span >
216- </ Button >
217- </ NavLink >
218- ) ;
219- } ;
220-
221143const showGradingTooltip = ( isGradingPublished : boolean ) => {
222144 let iconName : IconName ;
223145 let intent : Intent ;
0 commit comments