Skip to content

Commit 60e632e

Browse files
ning-yremo5000
authored andcommitted
Change some game redirects to LumiNUS, Piazza (#292)
* Fix dead links in game, refactor most links as constants * Bump version (v0.1.8 -> v1.0.0) * Make LINKS an enum
1 parent 2a13185 commit 60e632e

File tree

8 files changed

+34
-24
lines changed

8 files changed

+34
-24
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "cadet-frontend",
4-
"version": "0.1.8",
4+
"version": "1.0.0",
55
"scripts-info": {
66
"format": "Format source code",
77
"start": "Start the Webpack development server",

src/components/NavigationBar.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,9 @@ import * as React from 'react'
1111
import { NavLink } from 'react-router-dom'
1212

1313
import { Role } from '../reducers/states'
14+
import { LINKS } from '../utils/constants'
1415
import Dropdown from './dropdown'
1516

16-
const LUMINUS_LINK = 'https://luminus.nus.edu.sg/modules/8722e9a5-abc5-4160-820d-bf69d8a63c6f'
17-
18-
const PIAZZA_LINK = 'https://piazza.com/nus.edu.sg/fall2018/cs1101s'
19-
2017
export interface INavigationBarProps {
2118
handleLogOut: () => void
2219
role?: Role
@@ -40,7 +37,7 @@ const NavigationBar: React.SFC<INavigationBarProps> = props => (
4037
activeClassName="pt-active"
4138
className="NavigationBar__link pt-button pt-minimal"
4239
target="_blank"
43-
to={LUMINUS_LINK}
40+
to={LINKS.LUMINUS}
4441
>
4542
<Icon icon={IconNames.BOOK} />
4643
<div className="navbar-button-text hidden-xs">News &amp; Material</div>
@@ -50,7 +47,7 @@ const NavigationBar: React.SFC<INavigationBarProps> = props => (
5047
activeClassName="pt-active"
5148
className="NavigationBar__link pt-button pt-minimal"
5249
target="_blank"
53-
to={PIAZZA_LINK}
50+
to={LINKS.PIAZZA}
5451
>
5552
<Icon icon={IconNames.CHAT} />
5653
<div className="navbar-button-text hidden-xs">Forum</div>

src/components/Playground.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@ import { HotKeys } from 'react-hotkeys'
44
import { RouteComponentProps } from 'react-router'
55

66
import { InterpreterOutput } from '../reducers/states'
7+
import { LINKS } from '../utils/constants'
78
import { ExternalLibraryName } from './assessment/assessmentShape'
89
import Markdown from './commons/Markdown'
910
import Workspace, { WorkspaceProps } from './workspace'
1011
import { SideContentTab } from './workspace/side-content'
1112
import ListVisualizer from './workspace/side-content/ListVisualizer'
1213

13-
const SICP_SITE = 'https://www.comp.nus.edu.sg/~cs1101s/source/'
14-
1514
const CHAP = '\xa7'
1615

1716
const INTRODUCTION = `
@@ -21,8 +20,8 @@ The language _Source_ is the official language of the textbook _Structure and
2120
Interpretation of Computer Programs, JavaScript Adaptation_. You have never
2221
heard of Source? No worries! It was invented just for the purpose of the book.
2322
Source is a sublanguage of ECMAScript 2016 (7th Edition) and defined in [the
24-
documents titled _"Source ${CHAP}x"_](${SICP_SITE}), where x refers to the
25-
respective textbook chapter. For example, Source ${CHAP}3 is suitable for
23+
documents titled _"Source ${CHAP}x"_](${LINKS.SOURCE_DOCS}), where x refers to
24+
the respective textbook chapter. For example, Source ${CHAP}3 is suitable for
2625
textbook Chapter 3 and the preceeding chapters.
2726
2827
The playground comes with an editor and a REPL, on the left and right of the

src/components/academy/game/create-initializer.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { LINKS } from '../../../utils/constants'
12
import { history } from '../../../utils/history'
23

34
export default function (StoryXMLPlayer, story, username, attemptedAll) {
@@ -20,21 +21,21 @@ export default function (StoryXMLPlayer, story, username, attemptedAll) {
2021
openTemplate: function (name) {
2122
switch (name) {
2223
case 'textbook':
23-
return window.open('https://www.comp.nus.edu.sg/~cs1101s/sicp/', '_blank');
24+
return window.open(LINKS.TEXTBOOK, '_blank');
2425
case 'announcements':
25-
return history.push('/news');
26+
return history.push(LINKS.LUMINUS);
2627
case 'lesson_plan':
2728
return history.push('/academy/missions');
2829
case 'students':
29-
return history.push('/news');
30+
return history.push(LINKS.PIAZZA);
3031
case 'materials':
31-
return history.push('/material');
32+
return history.push(LINKS.LUMINUS);
3233
case 'IDE':
3334
return history.push('/playground');
3435
case 'path':
3536
return history.push('/academy/paths');
3637
default:
37-
return history.push('/news');
38+
return history.push(LINKS.LUMINUS);
3839
}
3940
},
4041
pickUpCollectible: function () { },

src/components/dropdown/About.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { Classes, Dialog, Tab, Tabs } from '@blueprintjs/core'
22
import { IconNames } from '@blueprintjs/icons'
33
import * as React from 'react'
44

5+
import { LINKS } from '../../utils/constants'
6+
57
type DialogProps = {
68
isOpen: boolean
79
onClose: () => void
@@ -38,7 +40,7 @@ const panelAbout = (
3840
<p>
3941
This iteration of Source Academy, code-named <i>Cadet</i>, is available under the MIT License.
4042
You may find the source code for Cadet at our GitHub organisation,{' '}
41-
<a href="https://github.com/source-academy">Source Academy</a>.
43+
<a href={LINKS.GITHUB_ORG}>Source Academy</a>.
4244
</p>
4345
</>
4446
)

src/components/dropdown/Help.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { Classes, Dialog } from '@blueprintjs/core'
22
import { IconNames } from '@blueprintjs/icons'
33
import * as React from 'react'
44

5+
import { LINKS } from '../../utils/constants'
6+
57
type DialogProps = {
68
isOpen: boolean
79
onClose: () => void
@@ -22,17 +24,16 @@ const Help: React.SFC<DialogProps> = props => (
2224
<li>
2325
For critical technical issues that seriously affect your learning experience, email the
2426
Technical Services of the NUS School of Computing at{' '}
25-
<a href="mailto:[email protected]">[email protected]</a> or call 6516 2736.
27+
<a href={LINKS.TECH_SVC}>[email protected]</a> or call 6516 2736.
2628
</li>
2729
<li>
2830
For non-critical technical issues, such as enhancement suggestions, please use the issue
29-
system of the{' '}
30-
<a href="https://github.com/source-academy">Source Academy repositories on GitHub</a>.
31+
system of the <a href={LINKS.GITHUB_ISSUES}>Source Academy repositories on GitHub</a>.
3132
</li>
3233
<li>
3334
For issues related to the content of missions, quests, paths and contests, use the
34-
respective forum at <a href="https://piazza.com/nus.edu.sg/fall2018/cs1101s"> piazza</a>,{' '}
35-
or approach your Avenger, Reflection instructor or lecturer.
35+
respective forum at <a href={LINKS.PIAZZA}> piazza</a>, or approach your Avenger,
36+
Reflection instructor or lecturer.
3637
</li>
3738
</ul>
3839
</div>

src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { ConnectedRouter } from 'react-router-redux'
55

66
import ApplicationContainer from './containers/ApplicationContainer'
77
import { store } from './createStore'
8-
import { VERSION } from './utils/constants'
8+
import { LINKS, VERSION } from './utils/constants'
99
import { history } from './utils/history'
1010
import registerServiceWorker from './utils/registerServiceWorker'
1111

@@ -16,7 +16,7 @@ const rootContainer = document.getElementById('root') as HTMLElement
1616
// tslint:disable-next-line
1717
console.log(
1818
`%c Source Academy v${VERSION}; ` +
19-
'Please visit https://github.com/source-academy/cadet-frontend/issues to report bugs or issues.',
19+
`Please visit ${LINKS.GITHUB_ISSUES} to report bugs or issues.`,
2020
'font-weight: bold;'
2121
)
2222

src/utils/constants.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,13 @@ export const IVLE_KEY = process.env.REACT_APP_IVLE_KEY
1111
export const VERSION = process.env.REACT_APP_VERSION
1212
export const BACKEND_URL = process.env.REACT_APP_BACKEND_URL
1313
export const USE_BACKEND = process.env.REACT_APP_USE_BACKEND
14+
15+
export enum LINKS {
16+
GITHUB_ISSUES = 'https://github.com/source-academy/cadet-frontend/issues',
17+
GITHUB_ORG = 'https://github.com/source-academy',
18+
LUMINUS = 'https://luminus.nus.edu.sg/modules/8722e9a5-abc5-4160-820d-bf69d8a63c6f',
19+
PIAZZA = 'https://piazza.com/nus.edu.sg/fall2018/cs1101s',
20+
SOURCE_DOCS = 'https://www.comp.nus.edu.sg/~cs1101s/source/',
21+
TECH_SVC = 'mailto:[email protected]',
22+
TEXTBOOK = 'https://www.comp.nus.edu.sg/~cs1101s/sicp/'
23+
}

0 commit comments

Comments
 (0)