Skip to content

Commit

Permalink
Spam history again to prevent broken links
Browse files Browse the repository at this point in the history
  • Loading branch information
veu committed Feb 15, 2020
1 parent 9e185db commit 1d800c1
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 38 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "quood",
"version": "1.0.0",
"version": "1.0.1",
"private": true,
"dependencies": {
"@babel/core": "7.1.0",
Expand Down
2 changes: 1 addition & 1 deletion public/manifest.webapp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.0.0",
"version": "1.0.1",
"name": "Quood",
"description": "A relaxing puzzle game",
"type": "web",
Expand Down
27 changes: 27 additions & 0 deletions src/components/BackLink.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React from 'react';
import { connect } from 'react-redux';
import { Link } from 'react-router-dom';
import { goBack } from 'connected-react-router';
import { IS_KAY_OS } from '../config';

function BackLink({
children,
goBack,
onClick = () => {},
...props
}) {
const goBackKaiOs = (event) => {
onClick();

if (IS_KAY_OS) {
goBack();
event.preventDefault();
}
};

return <Link {...props} onClick={goBackKaiOs}>
{children || 'Back'}
</Link>
}

export default connect(null, { goBack })(BackLink);
19 changes: 7 additions & 12 deletions src/components/Menu.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from 'react';
import { useSelector, connect } from 'react-redux';
import { useSelector } from 'react-redux';
import { Link } from 'react-router-dom';
import { goBack } from 'connected-react-router';
import {
isGameActive as getIsGameActive,
getScore,
Expand All @@ -10,10 +9,11 @@ import {
getStreakCount,
getHues
} from '../state/selectors';
import { OPTIONS_URL, IS_KAY_OS } from '../config';
import { OPTIONS_URL, IS_KAY_OS, TITLE_URL } from '../config';
import { useKaiOsSoftwareKeys } from '../hooks';
import BackLink from './BackLink';

function Menu({ goBack }) {
function Menu() {
const { refLeft, refRight } = useKaiOsSoftwareKeys();
const isGameActive = useSelector(getIsGameActive);
const highscore = useSelector(getHighscore);
Expand Down Expand Up @@ -57,13 +57,8 @@ function Menu({ goBack }) {
{getStats()}
</div>
<div block="main-menu">
<div
block="main-menu"
elem="action"
onClick={() => goBack()}
ref={refLeft}
>
Back
<div block="main-menu" elem="action">
<BackLink to={TITLE_URL} innerRef={refLeft} />
</div>
<div block="main-menu" elem="action" mods={{inactive: !IS_KAY_OS}}>
SELECT
Expand All @@ -75,4 +70,4 @@ function Menu({ goBack }) {
</>);
}

export default connect(null, { goBack })(Menu);
export default Menu;
24 changes: 8 additions & 16 deletions src/components/Options.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import React from 'react';
import { useDispatch, useSelector, connect } from 'react-redux';
import { goBack } from 'connected-react-router';
import range from 'ramda/src/range';
import { SQUARE_TYPES, IS_KAY_OS } from '../config';
import { SQUARE_TYPES, IS_KAY_OS, GAME_URL } from '../config';
import { resetHues, changeInputMode, requestStartGame } from '../state/actions';
import HueSlider from './HueSlider';
import { getInputMode } from '../state/selectors';
import { useKaiOsSoftwareKeys } from '../hooks';
import { INPUT_MODE_TOUCH } from '../state/reducers/options';
import BackLink from './BackLink';

function Options({ goBack }) {
const { refLeft, refRight } = useKaiOsSoftwareKeys();
Expand All @@ -20,7 +21,6 @@ function Options({ goBack }) {

const restart = () => {
dispatch(requestStartGame());
goBack();
};

return (
Expand All @@ -43,24 +43,16 @@ function Options({ goBack }) {
</div>
</div>
<div block="main-menu">
<div
block="main-menu"
elem="action"
onClick={() => goBack()}
ref={refLeft}
>
Back
<div block="main-menu" elem="action">
<BackLink to={GAME_URL} innerRef={refLeft} />
</div>
<div block="main-menu" elem="action" mods={{inactive: !IS_KAY_OS}}>
SELECT
</div>
<div
block="main-menu"
elem="action"
onClick={restart}
ref={refRight}
>
Restart
<div block="main-menu" elem="action">
<BackLink to={GAME_URL} innerRef={refRight} onClick={restart}>
Restart
</BackLink>
</div>
</div>
</>
Expand Down
12 changes: 4 additions & 8 deletions src/components/Tutorial.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { goBack } from 'connected-react-router';
import { getTutorialMessage } from '../state/selectors';
import Board from './Board';
import { useKaiOsSoftwareKeys } from '../hooks';
import { IS_KAY_OS } from '../config';
import { IS_KAY_OS, TITLE_URL } from '../config';
import BackLink from './BackLink';

function Tutorial({ goBack }) {
const { refLeft } = useKaiOsSoftwareKeys();
Expand All @@ -17,13 +18,8 @@ function Tutorial({ goBack }) {
<div block="message">{message}</div>
</div>
<div block="main-menu">
<div
block="main-menu"
elem="action"
onClick={() => goBack()}
ref={refLeft}
>
Back
<div block="main-menu" elem="action">
<BackLink to={TITLE_URL} innerRef={refLeft} />
</div>
<div block="main-menu" elem="action" mods={{inactive: !IS_KAY_OS}}>
SELECT
Expand Down

0 comments on commit 1d800c1

Please sign in to comment.