Skip to content

Commit

Permalink
Rename Sidequests to Quests in NavBar (#296)
Browse files Browse the repository at this point in the history
* Rename Sidequests button to Quests

* Update test

* Add exception to assessment url helper for quests

Usually, we just take the lowercase + 's', but we make an exception in
this case.

* Update tests

* Bump version (v1.0.0 -> v1.0.1)
  • Loading branch information
remo5000 authored and ning-y committed Aug 14, 2018
1 parent 276c6b3 commit 3cc51d4
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "cadet-frontend",
"version": "1.0.0",
"version": "1.0.1",
"scripts-info": {
"format": "Format source code",
"start": "Start the Webpack development server",
Expand Down
2 changes: 1 addition & 1 deletion src/components/academy/NavigationBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const NavigationBar: React.SFC<NavigationBarProps> = props => (
className="NavigationBar__link pt-button pt-minimal"
>
<Icon icon={IconNames.LIGHTBULB} />
<div className="navbar-button-text hidden-xs">Sidequests</div>
<div className="navbar-button-text hidden-xs">Quests</div>
</NavLink>

<NavLink
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ exports[`Grading NavLink does NOT renders for Role.Student 1`] = `
Missions
</div>
</NavLink>
<NavLink to=\\"/academy/sidequests\\" activeClassName=\\"pt-active\\" className=\\"NavigationBar__link pt-button pt-minimal\\" ariaCurrent=\\"true\\">
<NavLink to=\\"/academy/quests\\" activeClassName=\\"pt-active\\" className=\\"NavigationBar__link pt-button pt-minimal\\" ariaCurrent=\\"true\\">
<Blueprint2.Icon icon=\\"lightbulb\\" />
<div className=\\"navbar-button-text hidden-xs\\">
Sidequests
Quests
</div>
</NavLink>
<NavLink to=\\"/academy/paths\\" activeClassName=\\"pt-active\\" className=\\"NavigationBar__link pt-button pt-minimal\\" ariaCurrent=\\"true\\">
Expand Down Expand Up @@ -40,10 +40,10 @@ exports[`Grading NavLink renders for Role.Admin 1`] = `
Missions
</div>
</NavLink>
<NavLink to=\\"/academy/sidequests\\" activeClassName=\\"pt-active\\" className=\\"NavigationBar__link pt-button pt-minimal\\" ariaCurrent=\\"true\\">
<NavLink to=\\"/academy/quests\\" activeClassName=\\"pt-active\\" className=\\"NavigationBar__link pt-button pt-minimal\\" ariaCurrent=\\"true\\">
<Blueprint2.Icon icon=\\"lightbulb\\" />
<div className=\\"navbar-button-text hidden-xs\\">
Sidequests
Quests
</div>
</NavLink>
<NavLink to=\\"/academy/paths\\" activeClassName=\\"pt-active\\" className=\\"NavigationBar__link pt-button pt-minimal\\" ariaCurrent=\\"true\\">
Expand Down Expand Up @@ -79,10 +79,10 @@ exports[`Grading NavLink renders for Role.Staff 1`] = `
Missions
</div>
</NavLink>
<NavLink to=\\"/academy/sidequests\\" activeClassName=\\"pt-active\\" className=\\"NavigationBar__link pt-button pt-minimal\\" ariaCurrent=\\"true\\">
<NavLink to=\\"/academy/quests\\" activeClassName=\\"pt-active\\" className=\\"NavigationBar__link pt-button pt-minimal\\" ariaCurrent=\\"true\\">
<Blueprint2.Icon icon=\\"lightbulb\\" />
<div className=\\"navbar-button-text hidden-xs\\">
Sidequests
Quests
</div>
</NavLink>
<NavLink to=\\"/academy/paths\\" activeClassName=\\"pt-active\\" className=\\"NavigationBar__link pt-button pt-minimal\\" ariaCurrent=\\"true\\">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -651,10 +651,10 @@ exports[`Assessment page with multiple loaded missions renders correctly 1`] = `
Due: 18th June, 13:24
</div>
</Text>
<NavLink to=\\"/academy/sidequests/2/0\\" activeClassName=\\"active\\" ariaCurrent=\\"true\\">
<Route path=\\"/academy/sidequests/2/0\\" exact={[undefined]} strict={[undefined]} location={[undefined]}>
<Link to=\\"/academy/sidequests/2/0\\" className={[undefined]} style={[undefined]} aria-current={false} replace={false}>
<a className={[undefined]} style={[undefined]} aria-current={false} onClick={[Function]} href=\\"/academy/sidequests/2/0\\">
<NavLink to=\\"/academy/quests/2/0\\" activeClassName=\\"active\\" ariaCurrent=\\"true\\">
<Route path=\\"/academy/quests/2/0\\" exact={[undefined]} strict={[undefined]} location={[undefined]}>
<Link to=\\"/academy/quests/2/0\\" className={[undefined]} style={[undefined]} aria-current={false} replace={false}>
<a className={[undefined]} style={[undefined]} aria-current={false} onClick={[Function]} href=\\"/academy/quests/2/0\\">
<Blueprint2.Button fill={false} intent=\\"none\\" minimal={true} className=\\"\\" icon=\\"step-forward\\">
<button type=\\"button\\" className=\\"pt-button pt-minimal\\" disabled={[undefined]} onClick={[undefined]} onKeyDown={[Function]} onKeyUp={[Function]}>
<Blueprint2.Icon icon=\\"step-forward\\">
Expand Down
8 changes: 6 additions & 2 deletions src/utils/paramParseHelpers.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import { AssessmentCategory } from '../components/assessment/assessmentShape'
import { AssessmentCategories, AssessmentCategory } from '../components/assessment/assessmentShape'

/**
* Converts an AssessmentCategory into a string for use in URLs.
*
* Note that there is an exception to the usual logic, for sidequests.
* Sidequests show up on the frontend as 'Quests' (#295) and the URLs
* must be represented as such.
*
* @param {AssessmentCategory} cat - Any AssessmentCategory, usually
* retrieved from the AssessmentCategories enum
*/
export const assessmentCategoryLink = (cat: AssessmentCategory): string =>
cat.toLowerCase().concat('s')
cat === AssessmentCategories.Sidequest ? 'quests' : cat.toLowerCase().concat('s')

/** Converts an optinal string
* parameter into an integer or null value.
Expand Down

0 comments on commit 3cc51d4

Please sign in to comment.