diff --git a/src/components/assessment/__tests__/__snapshots__/index.tsx.snap b/src/components/assessment/__tests__/__snapshots__/index.tsx.snap index aa7d5349d2..b5631c9349 100644 --- a/src/components/assessment/__tests__/__snapshots__/index.tsx.snap +++ b/src/components/assessment/__tests__/__snapshots__/index.tsx.snap @@ -80,13 +80,39 @@ exports[`Assessment page does not show attempt Button for upcoming assessments f
- -
+ +

An Odessey to Runes (Duplicate)

+
+ + + + +
+ + + +
+
+ +
+
+
+
@@ -147,13 +173,39 @@ exports[`Assessment page does not show attempt Button for upcoming assessments f
- -
+ +

An Odessey to Runes

+
+ + + + +
+ + + +
+
+ +
+
+
+
@@ -216,13 +268,39 @@ exports[`Assessment page does not show attempt Button for upcoming assessments f
- -
+ +

The Secret to Streams

+
+ + + + +
+ + + +
+
+ +
+
+
+
@@ -285,13 +363,39 @@ exports[`Assessment page does not show attempt Button for upcoming assessments f
- -
+ +

A sample Sidequest

+
+ + + + +
+ + + +
+
+ +
+
+
+
@@ -462,13 +566,39 @@ exports[`Assessment page with multiple loaded missions renders correctly 1`] = `
- -
+ +

An Odessey to Runes (Duplicate)

+
+ + + + +
+ + + +
+
+ +
+
+
+
@@ -553,13 +683,39 @@ exports[`Assessment page with multiple loaded missions renders correctly 1`] = `
- -
+ +

An Odessey to Runes

+
+ + + + +
+ + + +
+
+ +
+
+
+
@@ -622,13 +778,39 @@ exports[`Assessment page with multiple loaded missions renders correctly 1`] = `
- -
+ +

The Secret to Streams

+
+ + + + +
+ + + +
+
+ +
+
+
+
@@ -691,13 +873,39 @@ exports[`Assessment page with multiple loaded missions renders correctly 1`] = `
- -
+ +

A sample Sidequest

+
+ + + + +
+ + + +
+
+ +
+
+
+
diff --git a/src/components/assessment/index.tsx b/src/components/assessment/index.tsx index 621b61f0af..b1973ec5ab 100644 --- a/src/components/assessment/index.tsx +++ b/src/components/assessment/index.tsx @@ -23,7 +23,6 @@ import { NavLink } from 'react-router-dom' import defaultCoverImage from '../../assets/default_cover_image.jpg' import AssessmentWorkspaceContainer from '../../containers/assessment/AssessmentWorkspaceContainer' -import { IS_XP_IMPLEMENTED } from '../../utils/constants' import { beforeNow, getPrettyDate } from '../../utils/dateHelpers' import { assessmentCategoryLink, stringParamToInt } from '../../utils/paramParseHelpers' import { @@ -312,16 +311,14 @@ const makeOverviewCardTitle = ( setBetchaAssessment: (assessment: IAssessmentOverview | null) => void ) => (
- +

{overview.title}

- {IS_XP_IMPLEMENTED ? ( -
- -
- ) : null} +
+ +
) diff --git a/src/components/dropdown/Profile.tsx b/src/components/dropdown/Profile.tsx index e53b40d9d9..083eb1efc2 100644 --- a/src/components/dropdown/Profile.tsx +++ b/src/components/dropdown/Profile.tsx @@ -1,19 +1,18 @@ -import { Classes, Dialog, NonIdealState, ProgressBar, Spinner, Tooltip } from '@blueprintjs/core' +import { Classes, Dialog, NonIdealState, ProgressBar, Spinner } from '@blueprintjs/core' import { IconNames } from '@blueprintjs/icons' import * as React from 'react' import { Role } from '../../reducers/states' -import { IS_XP_IMPLEMENTED } from '../../utils/constants' type ProfileProps = OwnProps & StateProps export type StateProps = { - grade?: number - maxGrade?: number - maxXp?: number + grade: number + maxGrade: number + maxXp: number name?: string role?: Role - xp?: number + xp: number } type OwnProps = { @@ -37,31 +36,14 @@ class Profile extends React.Component {
Grade - - {this.props.grade !== undefined ? this.props.grade : '???'} - + {this.props.grade}
- {IS_XP_IMPLEMENTED ? ( - <> - {/* TODO: Move tooltip out of this tenary once max grade for a - user is implemented in GET /user. - https://github.com/source-academy/cadet/issues/205 */} - - - -
- XP - - - {this.props.xp ? this.props.xp : '???'} - - -
- - - - - ) : null} + +
+ XP + {this.props.xp} +
+
) diff --git a/src/containers/ProfileContainer.ts b/src/containers/ProfileContainer.ts index a18f4ba99e..c5298057e7 100644 --- a/src/containers/ProfileContainer.ts +++ b/src/containers/ProfileContainer.ts @@ -3,14 +3,13 @@ import { connect, MapStateToProps } from 'react-redux' import Profile, { StateProps } from '../components/dropdown/Profile' import { IState } from '../reducers/states' -// TODO: connect to actual state once backend implements these features const mapStateToProps: MapStateToProps = state => ({ grade: state.session.grade, - maxGrade: undefined, - maxXp: undefined, + maxGrade: state.session.maxGrade, + maxXp: state.session.maxXp, name: state.session.name, role: state.session.role, - xp: undefined + xp: state.session.xp }) export default connect(mapStateToProps)(Profile) diff --git a/src/reducers/states.ts b/src/reducers/states.ts index 9a0c85949c..eff90a88f5 100644 --- a/src/reducers/states.ts +++ b/src/reducers/states.ts @@ -78,10 +78,13 @@ export interface ISessionState { readonly gradingOverviews?: GradingOverview[] readonly gradings: Map readonly historyHelper: HistoryHelper + readonly maxGrade: number + readonly maxXp: number readonly refreshToken?: string readonly role?: Role readonly story?: Story readonly name?: string + readonly xp: number } type ReplHistory = { @@ -247,8 +250,11 @@ export const defaultSession: ISessionState = { lastAcademyLocations: [null, null], lastGeneralLocations: [null, null] }, + maxGrade: 0, + maxXp: 0, refreshToken: undefined, - name: undefined + name: undefined, + xp: 0 } export const defaultState: IState = { diff --git a/src/utils/constants.ts b/src/utils/constants.ts index da3d9ed628..85c264beea 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -2,11 +2,6 @@ import * as dotenv from 'dotenv' dotenv.config() -/* Remove this variable entirely when implemented. DO NOT just set to true; - * also check that the CSS looks acceptable, since there will be className - * changes. */ -export const IS_XP_IMPLEMENTED = false - export const IVLE_KEY = process.env.REACT_APP_IVLE_KEY export const VERSION = process.env.REACT_APP_VERSION export const BACKEND_URL = process.env.REACT_APP_BACKEND_URL