Skip to content

Commit

Permalink
Trails B
Browse files Browse the repository at this point in the history
  • Loading branch information
sarithapillai8 committed Nov 29, 2024
1 parent d69bd05 commit 4bda94e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 22 deletions.
1 change: 1 addition & 0 deletions DotTouch/src/components/DotTouch/DotTouch.css
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ body{background: rgba(53,159,254,1);}
.back-link{
position: absolute;
left: 0;
top: 10px;
}
@-webkit-keyframes App-logo-spin {
0% {
Expand Down
31 changes: 9 additions & 22 deletions DotTouch/src/components/DotTouch/DotTouch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
* @copyright (c) 2020, ZCO
*/
import * as React from 'react';
import Button from '@material-ui/core/Button';
// import Button from '@material-ui/core/Button';
import { Dot } from './Dot';
import { getRandomAlphaNumeric,getRandomNumbers , shuffle} from '../../functions';
import UndoIcon from '@material-ui/icons/Undo';
import RefreshRounded from '@material-ui/icons/RefreshRounded';
import ArrowBackIcon from '@material-ui/icons/ArrowBack';
import { Timer } from '../common/Timer';
import './DotTouch.css';
Expand Down Expand Up @@ -309,33 +309,20 @@ class DotTouch extends React.Component<any, DotState> {
return routeList;
}

// Undo button action
undoAction = () => {
if(this.state.startGame) {
const item = this.state.lastWrongClick;
if(item !== null) {
item.className ='dot-style';
}
const routeList = this.updateRouteList();
this.setState({
route:[],
stateRoutes:JSON.stringify(routeList)
});
}
}

clickBack = () => {
this.sendGameResult(true)
}

// To refresh the game
clickHome = () => {
window.location.reload();
};

// Render the game board
render() {
const alertMsg = this.state.gameOver ? 'Congrats !!' : (this.state.timeout ? 'Timeout !' :
this.state.tapCount === 0 ? (this.state.gameLevel === 1 ? "Tap '1' to start the test": "Tap '1' to begin") :
(this.state.tapCount === 1 ? "Pick the matching alphabet" :
<Button variant="outlined" color="primary" onClick={this.restartState}>
Restart
</Button>));
(this.state.tapCount === 1 ? "Pick the matching alphabet" : null));

return (
<div className="dot-touch-board">
Expand All @@ -344,7 +331,7 @@ class DotTouch extends React.Component<any, DotState> {
{/* <ArrowBackIcon icon={faRedo} onClick={this.undoAction}/> */}
</nav>
<nav className="home-link">
<UndoIcon color="primary" onClick={this.undoAction}/>
<RefreshRounded color="primary" onClick={this.clickHome}/>
{/* <FontAwesomeIcon icon={faRedo} onClick={this.undoAction}/> */}
</nav>
<div className="heading">Dot touch</div>
Expand Down

0 comments on commit 4bda94e

Please sign in to comment.