Skip to content

Commit

Permalink
close #1, close #6, close #7, close #15, close #16
Browse files Browse the repository at this point in the history
add better navigation, item tracking, and speedups
  • Loading branch information
mracsys committed Jul 10, 2021
2 parents a11bd24 + 3397c45 commit 830b0f0
Show file tree
Hide file tree
Showing 191 changed files with 15,765 additions and 869 deletions.
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tootr",
"version": "0.1.0",
"version": "0.2.0",
"private": true,
"homepage": "https://mracsys.github.io/tootr",
"dependencies": {
Expand All @@ -13,8 +13,8 @@
"gh-pages": "^3.1.0",
"local-storage": "^2.0.0",
"node-sass": "^4.14.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react": "^16.14.0",
"react-dom": "^16.14.0",
"react-scripts": "3.4.3"
},
"scripts": {
Expand Down
3 changes: 3 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
name="description"
content="Ocarina of Time Randomizer Entrance Tracker"
/>
<!--
iOS favicon equivalent, no SVG support. Generate png from poop emoji svg at some point.
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
-->
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
Expand Down
18 changes: 1 addition & 17 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,23 +1,7 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"icons": [],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
Expand Down
44 changes: 44 additions & 0 deletions src/ContextMenuHandler.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const longPressDuration = 300;

export default class ContextMenuHandler {
constructor(callback) {
this.callback = callback;
this.longPressCountdown = null;
this.contextMenuPossible = false;
}

onTouchStart = e => {
this.contextMenuPossible = true;

const touch = e.currentTarget;
const source = e.currentTarget.getAttribute('data-source');

this.longPressCountdown = setTimeout(() => {
this.contextMenuPossible = false;
this.callback(touch, source);
}, longPressDuration);
};

onTouchMove = e => {
clearTimeout(this.longPressCountdown);
};

onTouchCancel = e => {
this.contextMenuPossible = false;
clearTimeout(this.longPressCountdown);
};

onTouchEnd = e => {
this.contextMenuPossible = false;
clearTimeout(this.longPressCountdown);
};

onContextMenu = e => {
this.contextMenuPossible = false;

clearTimeout(this.longPressCountdown);

this.callback(e.currentTarget, e.currentTarget.getAttribute('data-source'));
e.preventDefault();
};
}
78 changes: 78 additions & 0 deletions src/EntranceMenu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import React from 'react';
import Menu from '@material-ui/core/Menu';

const ITEM_HEIGHT = 31;

class EntranceMenu extends React.Component {
shouldComponentUpdate(nextProps) {
return true;
}
render() {
let entranceList = this.props.allAreas.entrances;
if (typeof this.props.entrancePool === "undefined") {
return null;
} else {
return (
<Menu
id={this.props.id + "Element"}
anchorEl={this.props.anchorLocation}
open={Boolean(this.props.anchorLocation)}
onClose={this.props.handleClose}
PaperProps={{
style: {
maxHeight: ITEM_HEIGHT * 19,
border: '1px black solid',
},
}}
TransitionProps={{
timeout: 0,
}}
getContentAnchorEl={null}
anchorOrigin={{
vertical: 'bottom',
horizontal: 'right',
}}
transformOrigin={{
vertical: 'top',
horizontal: 'right',
}}
disableScrollLock={true}
>
{Object.keys(this.props.entrancePool).sort().map((areaCategory, l) => {
if (((areaCategory === this.props.title && areaCategory !== "Spawn Points") || areaCategory === "Warp Songs" || this.props.entrancePool[areaCategory].length === 0) && this.props.connector === false) {
return null;
} else {
let eOptions = this.props.entrancePool[areaCategory].sort(function(a,b) {
let aName = entranceList[a].tag === "" ?
entranceList[a].alias :
entranceList[a].tag;
let bName = entranceList[b].tag === "" ?
entranceList[b].alias :
entranceList[b].tag;
return aName.localeCompare(bName);
}).map((subArea, j) => {
if ((this.props.allAreas.entrances[subArea].tagRep || this.props.allAreas.entrances[subArea].tag === "")) {
return (<div
key={this.props.pool + "option" + j}
className={this.props.classes.entranceText}
data-link-to={subArea}
data-link-from={this.props.sourceEntrance}
onClick={this.props.handleLink}>
{(this.props.allAreas.entrances[subArea].tag === "") ?
this.props.allAreas.entrances[subArea].alias :
this.props.allAreas.entrances[subArea].tag}
</div>);
} else { return null }
});
return [
<div className={this.props.classes.entranceAreaText} key={this.props.entrance + "header" + l}><em>{areaCategory}</em></div>,
eOptions
];
}})}
</Menu>
);
}
}
}

export default EntranceMenu
34 changes: 34 additions & 0 deletions src/FixedShopCheck.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from 'react';

import OotIcon from './OotIcon';
import AddIcon from '@material-ui/icons/Add';

class FixedShopCheck extends React.Component {
render() {
return (
<div
key={this.props.lkey}
onClick={this.props.handleContextMenu.onContextMenu}
onContextMenu={this.props.handleContextMenu.onContextMenu}
onTouchStart={this.props.handleContextMenu.onTouchStart}
onTouchCancel={this.props.handleContextMenu.onTouchCancel}
onTouchEnd={this.props.handleContextMenu.onTouchEnd}
onTouchMove={this.props.handleContextMenu.onTouchMove}
data-source={this.props.location}
>
{
this.props.allAreas.locations[this.props.location].foundItem === "" ?
<AddIcon className={this.props.classes.fixedShopIcon} />
/*<p className={this.props.classes.fixedShopIcon}>+</p>*/ :
<OotIcon
itemName={this.props.allAreas.locations[this.props.location].foundItem}
className={this.props.classes.locationKnownItem}
classes={this.props.classes}
/>
}
</div>
);
}
}

export default FixedShopCheck
47 changes: 35 additions & 12 deletions src/GameArea.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import React from 'react';
import Card from '@material-ui/core/Card';
import Switch from '@material-ui/core/Switch';
import { withStyles } from '@material-ui/core/styles';

import UnknownEntrance from './UnknownEntrance'
import LocationCheck from './LocationCheck'
import { Typography, Box } from '@material-ui/core';
import Link from '@material-ui/core/Link';

const YellowSwitch = withStyles({
switchBase: {
Expand All @@ -23,35 +20,40 @@ const YellowSwitch = withStyles({
})(Switch);

class GameArea extends React.Component {

shouldComponentUpdate(nextProps) {
return true;
}

render() {
Object.filterLocations = (locations, predicate) =>
Object.keys(locations)
.filter( key => predicate(locations[key].visible) );
const preventDefault = (event) => event.preventDefault();
return (
<Card className={this.props.classes.areaCard}>
<Link className={this.props.classes.entranceAnchor} color="inherit" id={this.props.title} onClick={preventDefault}>
<div className={this.props.classes.areaCard}>
<a className={this.props.classes.entranceAnchor} href={this.props.title} id={this.props.title} onClick={preventDefault}>
{/* Fake text here to make eslint happy.
Can't wrap the actual title with the link because the areaTitle class breaks margin collapse needed
to offset the anchor below the appbar */}
<span className={this.props.classes.entranceAnchorFakeText}>&nbsp;</span>
</Link>
</a>
<div className={this.props.classes.areaHeader} />
<Box className={this.props.classes.areaTitle}>
<Typography variant="h6" component="span" className={this.props.classes.areaTitleText}>
<div className={this.props.classes.areaTitle}>
<span className={this.props.classes.areaTitleText}>
{this.props.title}
</Typography>
</span>
{this.props.dungeon ?
<React.Fragment>
<Typography className={this.props.classes.mqSwitchLabel} component="span">MQ</Typography>
<span className={this.props.classes.mqSwitchLabel}>MQ</span>
<YellowSwitch
checked={this.props.isMQ}
onChange={() => {this.props.mqSwitch(this.props.title + " MQ")}}
name={this.props.title + "MQ"}
/>
</React.Fragment>
: null}
</Box>
</div>
<div>
<div className={this.props.locationList}>
{ Object.keys(this.props.locations).map((location, i) => { return (
Expand All @@ -64,6 +66,14 @@ class GameArea extends React.Component {
classes={this.props.classes}
handleCheck={this.props.handleCheck}
handleUnCheck={this.props.handleUnCheck}
handleItemMenuOpen={this.props.handleItemMenuOpen}
handleItemMenuClose={this.props.handleItemMenuClose}
handleContextMenu={this.props.handleContextMenu}
handleFind={this.props.handleFind}
toggleWalletTiers={this.props.toggleWalletTiers}
updateShopPrice={this.props.updateShopPrice}
showShopInput={this.props.showShopInput}
showShopRupee={this.props.showShopRupee}
/>
</React.Fragment>
)})}
Expand All @@ -90,6 +100,19 @@ class GameArea extends React.Component {
handleUnLink={this.props.handleUnLink}
handleCheck={this.props.handleCheck}
handleUnCheck={this.props.handleUnCheck}
handleItemMenuOpen={this.props.handleItemMenuOpen}
handleItemMenuClose={this.props.handleItemMenuClose}
handleContextMenu={this.props.handleContextMenu}
handleShopContextMenu={this.props.handleShopContextMenu}
handleEntranceMenuOpen={this.props.handleEntranceMenuOpen}
handleFind={this.props.handleFind}
toggleWalletTiers={this.props.toggleWalletTiers}
updateShopPrice={this.props.updateShopPrice}
showShops={this.props.showShops}
showShopInput={this.props.showShopInput}
showShopRupee={this.props.showShopRupee}
handleDungeonTravel={this.props.handleDungeonTravel}
dungeon={this.props.dungeon}
classes={this.props.classes}
ekey={this.props.title + "entrance" + i}
key={this.props.title + "entranceContainer" + i}
Expand All @@ -98,7 +121,7 @@ class GameArea extends React.Component {
} else { return null }
})}
</div>
</Card>
</div>
);
}
}
Expand Down
Loading

0 comments on commit 830b0f0

Please sign in to comment.