Skip to content

Commit dd5e5d4

Browse files
committed
Merge pull request #259 from parallaxinc/helpOverlay
add help overlay
2 parents 3e0c795 + 3c67e49 commit dd5e5d4

File tree

8 files changed

+82
-1
lines changed

8 files changed

+82
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"codemirror": "^4.13.0",
1313
"frylord": "^0.7.1",
1414
"holovisor": "^0.2.0",
15-
"iggins": "^0.3.0",
15+
"iggins": "^0.4.0",
1616
"irken": "^0.8.0",
1717
"lodash": "^3.9.1",
1818
"react": "^0.13.1",

src/constants/overlay-states.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const overlayStates = {
44
NO_OVERLAY: 'NO_OVERLAY',
5+
HELP_OVERLAY: 'HELP_OVERLAY',
56
SAVE_OVERLAY: 'SAVE_OVERLAY',
67
DOWNLOAD_OVERLAY: 'DOWNLOAD_OVERLAY',
78
PROJECTS_OVERLAY: 'PROJECTS_OVERLAY',

src/creators/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const creators = {
88
showDownloadOverlay: require('./show-download-overlay'),
99
showProjectsOverlay: require('./show-projects-overlay'),
1010
showSaveOverlay: require('./show-save-overlay'),
11+
showHelpOverlay: require('./show-help-overlay'),
1112
hideOverlay: require('./hide-overlay'),
1213
// terminal creators
1314
rxOn: require('./rx-on'),

src/creators/show-help-overlay.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
'use strict';
2+
3+
const {
4+
SHOW_OVERLAY
5+
} = require('../constants/action-types');
6+
7+
const {
8+
HELP_OVERLAY
9+
} = require('../constants/overlay-states');
10+
11+
function showHelpOverlay(){
12+
return {
13+
type: SHOW_OVERLAY,
14+
payload: {
15+
state: HELP_OVERLAY
16+
}
17+
};
18+
}
19+
20+
module.exports = showHelpOverlay;

src/plugins/handlers.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,10 @@ function handlers(app, opts, done){
225225
store.dispatch(creators.showDeleteProjectOverlay());
226226
}
227227

228+
function showHelpOverlay(){
229+
store.dispatch(creators.showHelpOverlay());
230+
}
231+
228232
function showSaveOverlay(){
229233
store.dispatch(creators.showSaveOverlay());
230234
}
@@ -572,6 +576,7 @@ function handlers(app, opts, done){
572576
deleteProject,
573577
deleteProjectConfirm,
574578
// overlay methods
579+
showHelpOverlay,
575580
showSaveOverlay,
576581
showDownloadOverlay,
577582
showProjectsOverlay,

src/plugins/keyboard-shortcuts.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ function keyboardShortcuts(app, opts, done){
1414
const { keypress, handlers } = app;
1515

1616
const {
17+
F1,
1718
F3,
1819
F6,
1920
F7,
@@ -39,6 +40,7 @@ function keyboardShortcuts(app, opts, done){
3940
newFile,
4041
saveFile,
4142
hideOverlay,
43+
showHelpOverlay,
4244
showSaveOverlay,
4345
showDownloadOverlay,
4446
showProjectsOverlay,
@@ -81,6 +83,11 @@ function keyboardShortcuts(app, opts, done){
8183
hideOverlay();
8284
});
8385

86+
keypress(F1, function(evt){
87+
evt.preventDefault();
88+
showHelpOverlay();
89+
});
90+
8491
keypress(F3, function(evt){
8592
evt.preventDefault();
8693
findNext();

src/plugins/overlays.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
const React = require('react');
44

5+
const HelpOverlay = require('../views/help-overlay');
56
const SaveOverlay = require('../views/save-overlay');
67
const ProjectOverlay = require('../views/project-overlay');
78
const DownloadOverlay = require('../views/download-overlay');
@@ -12,6 +13,7 @@ const store = require('../store');
1213

1314
const {
1415
NO_OVERLAY,
16+
HELP_OVERLAY,
1517
SAVE_OVERLAY,
1618
DOWNLOAD_OVERLAY,
1719
PROJECTS_OVERLAY,
@@ -35,6 +37,9 @@ function overlays(app, opts, done){
3537
const { overlayState } = store.getState();
3638

3739
switch(overlayState){
40+
case HELP_OVERLAY:
41+
renderOverlay(<HelpOverlay workspace={workspace} handlers={handlers} />);
42+
break;
3843
case SAVE_OVERLAY:
3944
renderOverlay(<SaveOverlay workspace={workspace} handlers={handlers} />);
4045
break;

src/views/help-overlay.js

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
'use strict';
2+
3+
const React = require('react');
4+
const Button = require('react-material/components/Button');
5+
6+
const Overlay = require('../components/overlay');
7+
const OverlayTitle = require('../components/overlay-title');
8+
const OverlayFooter = require('../components/overlay-footer');
9+
10+
const helpStyle = {
11+
position: 'relative'
12+
};
13+
14+
const helpLink = 'http://www.parallax.com/go/PBASICHelp';
15+
16+
class HelpOverlay extends React.Component {
17+
18+
19+
render(){
20+
const {
21+
handlers
22+
} = this.props;
23+
24+
const {
25+
hideOverlay
26+
} = handlers;
27+
28+
return (
29+
<Overlay>
30+
<OverlayTitle>Help</OverlayTitle>
31+
<div style={helpStyle}>
32+
For help with PBASIC go here: <a href={helpLink} target="_blank">{helpLink}</a>
33+
</div>
34+
<OverlayFooter>
35+
<Button onClick={hideOverlay}>OK</Button>
36+
</OverlayFooter>
37+
</Overlay>
38+
);
39+
}
40+
}
41+
42+
module.exports = HelpOverlay;

0 commit comments

Comments
 (0)