update lint rules

This commit is contained in:
Daniel 2020-10-15 15:48:27 -04:00
parent 78bb073c2f
commit ae25fe8fe2
38 changed files with 653 additions and 394 deletions

120
.eslintrc Normal file
View File

@ -0,0 +1,120 @@
{
"root": true,
"parser": "babel-eslint",
"plugins": [
"babel",
"react",
"import",
"react-hooks"
],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:promise/recommended"
],
"env": {
"browser": true,
"es6": true,
"node": true
},
"parserOptions": {
"ecmaVersion": 8,
"sourceType": "module",
"ecmaFeatures": {
"modules": true,
"jsx": true,
"experimentalObjectRestSpread": true,
"legacyDecorators": true
}
},
"settings": {
"react": {
"version": "detect"
}
},
"ignorePatterns": [
"node_modules",
"build"
],
"rules": {
"arrow-parens": "off",
"dot-notation": "off",
"eqeqeq": "off",
"import/no-extraneous-dependencies": ["error", {"devDependencies": ["./webpack.config.babel.js"]}],
"linebreak-style": "off",
"no-plusplus": "off",
"no-prototype-builtins": "off",
"no-undef": "error",
"no-unused-expressions": ["error", { "allowShortCircuit": true, "allowTernary": true }],
"no-unused-vars": ["warn", { "argsIgnorePattern": "props|context|e", "varsIgnorePattern": "s" }],
"no-useless-escape": "off",
"object-curly-newline": "off",
"object-curly-spacing": ["warn", "always", {"objectsInObjects": false, "arraysInObjects": false}],
"prefer-destructuring": ["warn", {
"VariableDeclarator": { "array": false, "object": true },
"AssignmentExpression": { "array": false, "object": false }
}, {
"enforceForRenamedProperties": false
}],
"promise/always-return": "off",
"promise/catch-or-return": ["warn", {
"allowFinally": true
}],
"promise/no-callback-in-promise": "off",
"react/display-name": "off",
"react/forbid-prop-types": "off",
"react/jsx-curly-brace-presence": "off",
"react/jsx-filename-extension": ["warn", { "extensions": [".js", ".jsx"] }],
"react/jsx-indent": ["warn", 2, { "indentLogicalExpressions": true }],
"react/jsx-indent-props": ["warn", 2],
"react/no-unescaped-entities": "off",
"react/prop-types": "off"
},
"overrides": [
{
"files": ["*.ts", "*.tsx"],
"env": { "browser": true, "es6": true, "node": true, "mocha": true },
"extends": [
"plugin:@typescript-eslint/eslint-recommended"
],
"globals": { "Atomics": "readonly", "SharedArrayBuffer": "readonly" },
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": { "jsx": true },
"ecmaVersion": 2019,
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": [
"@typescript-eslint"
],
"rules": {
"@typescript-eslint/no-unused-vars": [1, {
"args": "after-used" ,
"argsIgnorePattern": "^_",
"ignoreRestSiblings": true
}],
"comma-dangle": ["error", {
"arrays": "only-multiline",
"objects": "only-multiline",
"imports": "never",
"exports": "never",
"functions": "never"
}],
"import/extensions": "off",
"import/named": "off",
"import/no-extraneous-dependencies": ["error", {"devDependencies": ["**/*.spec.ts"]}],
"import/no-unresolved": "off",
"lines-between-class-members": "off",
"no-param-reassign": "off",
"no-plusplus": "off",
"no-shadow": "off",
"no-unused-vars": "off",
"no-underscore-dangle": "off",
"no-use-before-define": "off",
"prefer-template": "error",
"react/jsx-filename-extension": [1, { "extensions": [".tsx"] }]
}
}
]
}

View File

@ -1,56 +0,0 @@
module.exports = {
"root": true,
"parser": "babel-eslint",
"extends": [
"eslint:recommended",
"plugin:react/recommended"
],
"env": {
"browser": true,
"es6": true,
"node": true
},
"parserOptions": {
"ecmaVersion": 8,
"sourceType": "module",
"ecmaFeatures": {
"modules": true,
"jsx": true,
"experimentalObjectRestSpread": true,
"legacyDecorators": true
}
},
"rules": {
"import/no-extraneous-dependencies": ["error", {"devDependencies": ["./webpack.config.babel.js"]}],
"react/forbid-prop-types": "off",
"react/jsx-filename-extension": "off",
"react/no-unescaped-entities": "off",
"react/prop-types": "off",
"react/display-name": "off",
"no-unused-expressions": ["error", { "allowShortCircuit": true, "allowTernary": true }],
"no-plusplus": "off",
"no-prototype-builtins": "off",
"object-curly-spacing": ["warn", "always", {"objectsInObjects": false, "arraysInObjects": false}],
"object-curly-newline": "off",
"linebreak-style": "off",
"eqeqeq": "off",
"dot-notation": "off",
"no-unused-vars": ["warn", { "argsIgnorePattern": "props|context|e", "varsIgnorePattern": "s" }],
"no-undef": "error",
"no-useless-escape": "off"
},
"settings": {
"react": {
"version": require('./package.json').dependencies.react
}
},
"plugins": [
"react",
"import",
"react-hooks"
],
"ignorePatterns": [
"node_modules",
"build"
]
}

170
package-lock.json generated
View File

@ -3499,6 +3499,12 @@
"resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.3.3.tgz",
"integrity": "sha512-LKVP3cgXBT9RYj+t+9FDKwS5tdI+rPBXaNSkma7hvqy35lc7mAokC2zsqWJH0LaqIt3B962nuYI77hsJoT1gow=="
},
"@types/eslint-visitor-keys": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz",
"integrity": "sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag==",
"dev": true
},
"@types/glob": {
"version": "7.1.2",
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.2.tgz",
@ -3640,6 +3646,140 @@
"@types/node": "*"
}
},
"@typescript-eslint/eslint-plugin": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.10.1.tgz",
"integrity": "sha512-PQg0emRtzZFWq6PxBcdxRH3QIQiyFO3WCVpRL3fgj5oQS3CDs3AeAKfv4DxNhzn8ITdNJGJ4D3Qw8eAJf3lXeQ==",
"dev": true,
"requires": {
"@typescript-eslint/experimental-utils": "3.10.1",
"debug": "^4.1.1",
"functional-red-black-tree": "^1.0.1",
"regexpp": "^3.0.0",
"semver": "^7.3.2",
"tsutils": "^3.17.1"
},
"dependencies": {
"debug": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz",
"integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==",
"dev": true,
"requires": {
"ms": "2.1.2"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true
},
"regexpp": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.1.0.tgz",
"integrity": "sha512-ZOIzd8yVsQQA7j8GCSlPGXwg5PfmA1mrq0JP4nGhh54LaKN3xdai/vHUDu74pKwV8OxseMS65u2NImosQcSD0Q==",
"dev": true
},
"semver": {
"version": "7.3.2",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz",
"integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==",
"dev": true
}
}
},
"@typescript-eslint/experimental-utils": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.10.1.tgz",
"integrity": "sha512-DewqIgscDzmAfd5nOGe4zm6Bl7PKtMG2Ad0KG8CUZAHlXfAKTF9Ol5PXhiMh39yRL2ChRH1cuuUGOcVyyrhQIw==",
"dev": true,
"requires": {
"@types/json-schema": "^7.0.3",
"@typescript-eslint/types": "3.10.1",
"@typescript-eslint/typescript-estree": "3.10.1",
"eslint-scope": "^5.0.0",
"eslint-utils": "^2.0.0"
},
"dependencies": {
"eslint-utils": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-2.1.0.tgz",
"integrity": "sha512-w94dQYoauyvlDc43XnGB8lU3Zt713vNChgt4EWwhXAP2XkBvndfxF0AgIqKOOasjPIPzj9JqgwkwbCYD0/V3Zg==",
"dev": true,
"requires": {
"eslint-visitor-keys": "^1.1.0"
}
}
}
},
"@typescript-eslint/parser": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.10.1.tgz",
"integrity": "sha512-Ug1RcWcrJP02hmtaXVS3axPPTTPnZjupqhgj+NnZ6BCkwSImWk/283347+x9wN+lqOdK9Eo3vsyiyDHgsmiEJw==",
"dev": true,
"requires": {
"@types/eslint-visitor-keys": "^1.0.0",
"@typescript-eslint/experimental-utils": "3.10.1",
"@typescript-eslint/types": "3.10.1",
"@typescript-eslint/typescript-estree": "3.10.1",
"eslint-visitor-keys": "^1.1.0"
}
},
"@typescript-eslint/types": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-3.10.1.tgz",
"integrity": "sha512-+3+FCUJIahE9q0lDi1WleYzjCwJs5hIsbugIgnbB+dSCYUxl8L6PwmsyOPFZde2hc1DlTo/xnkOgiTLSyAbHiQ==",
"dev": true
},
"@typescript-eslint/typescript-estree": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.10.1.tgz",
"integrity": "sha512-QbcXOuq6WYvnB3XPsZpIwztBoquEYLXh2MtwVU+kO8jgYCiv4G5xrSP/1wg4tkvrEE+esZVquIPX/dxPlePk1w==",
"dev": true,
"requires": {
"@typescript-eslint/types": "3.10.1",
"@typescript-eslint/visitor-keys": "3.10.1",
"debug": "^4.1.1",
"glob": "^7.1.6",
"is-glob": "^4.0.1",
"lodash": "^4.17.15",
"semver": "^7.3.2",
"tsutils": "^3.17.1"
},
"dependencies": {
"debug": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-4.2.0.tgz",
"integrity": "sha512-IX2ncY78vDTjZMFUdmsvIRFY2Cf4FnD0wRs+nQwJU8Lu99/tPFdb0VybiiMTPe3I6rQmwsqQqRBvxU+bZ/I8sg==",
"dev": true,
"requires": {
"ms": "2.1.2"
}
},
"ms": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==",
"dev": true
},
"semver": {
"version": "7.3.2",
"resolved": "https://registry.npmjs.org/semver/-/semver-7.3.2.tgz",
"integrity": "sha512-OrOb32TeeambH6UrhtShmF7CRDqhL6/5XpPNp2DuRH6+9QLw/orhp72j87v8Qa1ScDkvrrBNpZcDejAirJmfXQ==",
"dev": true
}
}
},
"@typescript-eslint/visitor-keys": {
"version": "3.10.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.10.1.tgz",
"integrity": "sha512-9JgC82AaQeglebjZMgYR5wgmfUdUc+EitGUUMW8u2nDckaeimzW+VsoLV6FoimPv2id3VQzfjwBxEMVz08ameQ==",
"dev": true,
"requires": {
"eslint-visitor-keys": "^1.1.0"
}
},
"@webassemblyjs/ast": {
"version": "1.9.0",
"resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.9.0.tgz",
@ -7151,6 +7291,15 @@
}
}
},
"eslint-plugin-babel": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-babel/-/eslint-plugin-babel-5.3.1.tgz",
"integrity": "sha512-VsQEr6NH3dj664+EyxJwO4FCYm/00JhYb3Sk3ft8o+fpKuIfQ9TaW6uVUfvwMXHcf/lsnRIoyFPsLMyiWCSL/g==",
"dev": true,
"requires": {
"eslint-rule-composer": "^0.3.0"
}
},
"eslint-plugin-import": {
"version": "2.22.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.22.1.tgz",
@ -7193,6 +7342,12 @@
}
}
},
"eslint-plugin-promise": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-4.2.1.tgz",
"integrity": "sha512-VoM09vT7bfA7D+upt+FjeBO5eHIJQBUWki1aPvB+vbNiHS3+oGIJGIeyBtKQTME6UPXXy3vV07OL1tHd3ANuDw==",
"dev": true
},
"eslint-plugin-react": {
"version": "7.21.4",
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.21.4.tgz",
@ -7238,6 +7393,12 @@
"integrity": "sha512-EjxTHxjLKIBWFgDJdhKKzLh5q+vjTFrqNZX36uIxWS4OfyXe5DawqPj3U5qeJ1ngLwatjzQnmR0Lz0J0YH3kxw==",
"dev": true
},
"eslint-rule-composer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/eslint-rule-composer/-/eslint-rule-composer-0.3.0.tgz",
"integrity": "sha512-bt+Sh8CtDmn2OajxvNO+BX7Wn4CIWMpTRm3MaiKPCQcnnlm0CS2mhui6QaoeQugs+3Kj2ESKEEGJUdVafwhiCg==",
"dev": true
},
"eslint-scope": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.0.0.tgz",
@ -15646,6 +15807,15 @@
"integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==",
"dev": true
},
"tsutils": {
"version": "3.17.1",
"resolved": "https://registry.npmjs.org/tsutils/-/tsutils-3.17.1.tgz",
"integrity": "sha512-kzeQ5B8H3w60nFY2g8cJIuH7JDpsALXySGtwGJ0p2LSjLgay3NdIpqq5SoOBe46bKDW2iq25irHCr8wjomUS2g==",
"dev": true,
"requires": {
"tslib": "^1.8.1"
}
},
"tty-browserify": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz",

View File

@ -5,8 +5,8 @@
"scripts": {
"start": "webpack serve --mode development --env development",
"build": "webpack -p",
"lint": "tsc --noEmit; eslint '*/**/*.{js,ts,tsx}'",
"lint:fix": "tsc --noEmit; eslint '*/**/*.{js,ts,tsx}' --quiet --fix",
"lint": "tsc --noEmit && eslint '*/**/*.{js,ts,tsx}'",
"lint:fix": "tsc --noEmit && eslint '*/**/*.{js,ts,tsx}' --quiet --fix",
"test": "cross-env TS_NODE_COMPILER_OPTIONS='{ \"module\": \"commonjs\" }' mocha -r ts-node/register -r ignore-styles -r jsdom-global/register src/**/*.spec.ts"
},
"repository": {
@ -60,14 +60,18 @@
"@types/react": "^16.9.52",
"@types/react-dom": "^16.9.8",
"@types/react-router-dom": "^5.1.6",
"@typescript-eslint/eslint-plugin": "^3.3.0",
"@typescript-eslint/parser": "^3.3.0",
"babel-eslint": "^10.1.0",
"babel-loader": "^8.1.0",
"chai": "^4.2.0",
"cross-env": "^7.0.2",
"css-loader": "^3.6.0",
"eslint": "^6.8.0",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-react": "^7.21.4",
"eslint-plugin-promise": "^4.2.1",
"eslint-plugin-react-hooks": "^3.0.0",
"ignore-styles": "^5.0.1",
"jsdom": "^16.4.0",

View File

@ -1,7 +1,7 @@
import React from 'react';
export function Initiative(props) {
let initiative = props.initiative;
let { initiative } = props;
let image = null;
if (["Danian", "Generic", "Mipedian", "OverWorld", "UnderWorld", "M'arrillian"].indexOf(initiative) > -1) {
image = <img className="icon16" style={{ verticalAlign: 'middle' }} src={("/src/img/icons/tribes/" + initiative + ".png").toLowerCase()} />

View File

@ -19,7 +19,7 @@ export function Rarity(props) {
return (
<span>
{set !== 'PE1' && <img className={props.size || "icon16"} style={{ verticalAlign: 'middle' }} src={("/src/img/icons/set/" + set + "/" + rarity + ".png").toLowerCase()} />}
{!props.notext && <React.Fragment>{API.sets[props.set]}&nbsp;|&nbsp;{props.rarity}</React.Fragment>}
{!props.notext && <>{API.sets[props.set]}&nbsp;|&nbsp;{props.rarity}</>}
</span>
);
}

View File

@ -26,7 +26,7 @@ export function Loading(props) {
}
export function Splash(props) {
let image = props.image;
let { image } = props;
return (
<div style={{ position: 'absolute', top: '0', left: '0', right: '0', bottom: '0', backgroundImage: 'url(\'' + image + '\') no-repeat center', backgroundSize: 'cover' }} />
);

View File

@ -203,7 +203,8 @@ class API {
this.buildCollection(collection)
.then(() => {
resolve();
});
})
.catch(() => {});
}
else resolve();
});

View File

@ -1,6 +1,6 @@
import React from 'react';
import {observable} from "mobx";
import {observer, inject} from 'mobx-react';
import { observable } from "mobx";
import { observer, inject } from 'mobx-react';
import Attack from './types/Attack';
import Battlegear from './types/Battlegear';
import Creature from './types/Creature';
@ -16,11 +16,11 @@ export default class CardList extends React.Component {
}
render() {
let cards = this.props.cards;
let { cards } = this.props;
if (cards.length == 1 && cards[0].text) {
return (
<div style={{textAlign: 'left'}}>{cards[0].text}</div>
<div style={{ textAlign: 'left' }}>{cards[0].text}</div>
);
}
return cards.map((card, i) => {

View File

@ -165,9 +165,9 @@ export default class SearchCollection extends React.Component {
}
handleChange = (event, obj) => {
const target = event.target;
const { target } = event;
const value = target.type === 'checkbox' ? target.checked : target.value;
const name = target.name;
const { name } = target;
if (!obj) this.input[name] = value;
else this.input[obj][name] = value;
}
@ -262,7 +262,7 @@ export default class SearchCollection extends React.Component {
<label className="mull"><input type="checkbox" name="legendary" checked={this.input.mull.legendary} onChange={e => this.handleChange(e, "mull")} />Legendary</label>
</div>
<div className="centeredCheckBox">
<label className="mull"><input type="checkbox" name="mixed" checked={this.input.mull.mixed} onChange={e => this.handleChange(e, "mull")} />Non-Loyal</label>
<label className="mull"><input type="checkbox" name="mixed" checked={this.input.mull.mixed} onChange={e => this.handleChange(e, "mull")} />Non-Loyal</label>
</div>
<hr />
<div className="tribes">

View File

@ -7,7 +7,7 @@ import { Rarity, Unique, Name, Element, Ability, AttackIcon } from '../../Snippe
export default class Attack extends React.Component {
render() {
let card = this.props.card;
let { card } = this.props;
if (this.props.ext == false) return (
<div className="card attack">
@ -39,9 +39,9 @@ export default class Attack extends React.Component {
<Name name={card.gsx$name} /><br />
<Ability ability={card.gsx$ability} />
<Unique data={{ unique: card.gsx$unique, loyal: card.gsx$loyal, legendary: card.gsx$legendary }} />
{card.gsx$flavortext && <React.Fragment>
{card.gsx$flavortext && <>
<span className="flavortext">{card.gsx$flavortext}</span><br />
</React.Fragment>}
</>}
<span>Art By: {card.gsx$artist}</span>
</div>
</div>

View File

@ -7,7 +7,7 @@ import { Rarity, Unique, Name, Ability, BattlegearIcon } from '../../Snippets';
export default class Battlegear extends React.Component {
render() {
let card = this.props.card;
let { card } = this.props;
if (this.props.ext == false) return (
<div className="card battlegear">
@ -31,9 +31,9 @@ export default class Battlegear extends React.Component {
<Name name={card.gsx$name} /><br />
<Ability ability={card.gsx$ability} />
<Unique data={{ unique: card.gsx$unique, loyal: card.gsx$loyal, legendary: card.gsx$legendary }} />
{card.gsx$flavortext && <React.Fragment>
{card.gsx$flavortext && <>
<span className="flavortext">{card.gsx$flavortext}</span><br />
</React.Fragment>}
</>}
<span>Art By: {card.gsx$artist}</span>
</div>
</div>

View File

@ -7,7 +7,7 @@ import { Rarity, Unique, Name, Element, Mugic, Discipline, Ability, Tribe } from
export default class Creature extends React.Component {
render() {
let card = this.props.card;
let { card } = this.props;
let mugic = [];
for (let i = 0; i < card.gsx$mugicability; i++) {
@ -56,27 +56,27 @@ export default class Creature extends React.Component {
<Unique data={{ unique: card.gsx$unique, loyal: card.gsx$loyal, legendary: card.gsx$legendary, tribe: card.gsx$tribe }} />
{/*chieftain*/
card.gsx$types.includes("Chieftain") &&
<span className="chieftain">(Minions use Brainwashed text. Minions may only play Generic Mugic.)<br /></span>
<span className="chieftain">(Minions use Brainwashed text. Minions may only play Generic Mugic.)<br /></span>
}
<span className="flavortext">{card.gsx$flavortext}</span>
</div>
<br />
<div className="stats">
<div className="energy">
{card.gsx$courage}<Discipline discipline="courage" />
</div>
<div className="energy">
{card.gsx$power}<Discipline discipline="power" />
</div>
<div className="energy">
{card.gsx$wisdom}<Discipline discipline="wisdom" />
</div>
<div className="energy">
{card.gsx$speed}<Discipline discipline="speed" />
</div>
<div className="energy" style={{ fontWeight: 'bold' }}>{card.gsx$energy}
</div>
<div className="stats">
<div className="energy">
{card.gsx$courage}<Discipline discipline="courage" />
</div>
<div className="energy">
{card.gsx$power}<Discipline discipline="power" />
</div>
<div className="energy">
{card.gsx$wisdom}<Discipline discipline="wisdom" />
</div>
<div className="energy">
{card.gsx$speed}<Discipline discipline="speed" />
</div>
<div className="energy" style={{ fontWeight: 'bold' }}>{card.gsx$energy}
</div>
</div>
</div>
)
else return (
@ -100,11 +100,11 @@ export default class Creature extends React.Component {
<Unique data={{ unique: card.gsx$unique, loyal: card.gsx$loyal, legendary: card.gsx$legendary, tribe: card.gsx$tribe }} />
{/*chieftain*/
card.gsx$types.includes("Chieftain") &&
<span className="chieftain">(Minions use Brainwashed text. Minions may only play Generic Mugic.)<br /></span>
<span className="chieftain">(Minions use Brainwashed text. Minions may only play Generic Mugic.)<br /></span>
}
{card.gsx$flavortext && <React.Fragment>
{card.gsx$flavortext && <>
<span className="flavortext">{card.gsx$flavortext}</span><br />
</React.Fragment>}
</>}
<span>Art By: {card.gsx$artist}</span>
</div>
</div>

View File

@ -8,7 +8,7 @@ import API from '../../SpreadsheetData';
export default class Location extends React.Component {
render() {
let card = this.props.card;
let { card } = this.props;
if (this.props.ext == false) return (
<div className="card location">
@ -34,9 +34,9 @@ export default class Location extends React.Component {
<Initiative initiative={card.gsx$initiative} />
<Ability ability={card.gsx$ability} />
<Unique data={{ unique: card.gsx$unique, loyal: card.gsx$loyal, legendary: card.gsx$legendary }} />
{card.gsx$flavortext && <React.Fragment>
{card.gsx$flavortext && <>
<span className="flavortext">{card.gsx$flavortext}</span><br />
</React.Fragment>}
</>}
<span>Art By: {card.gsx$artist}</span>
</div>
</div>

View File

@ -53,9 +53,9 @@ class Attack extends React.Component {
<Name name={card.gsx$name} /><br />
<Ability ability={card.gsx$ability} tribe={card.gsx$tribe} />
<Unique data={{ unique: card.gsx$unique, loyal: card.gsx$loyal, legendary: card.gsx$legendary }} />
{card.gsx$flavortext && <React.Fragment>
{card.gsx$flavortext && <>
<span className="flavortext">{card.gsx$flavortext}</span><br />
</React.Fragment>}
</>}
<span>Art By: {card.gsx$artist}</span>
</div>
</div>

View File

@ -1,12 +1,12 @@
import React from 'react';
import {observer, inject} from 'mobx-react';
import { observer, inject } from 'mobx-react';
@inject((stores, props, context) => props) @observer
export default class Create extends React.Component {
render() {
return (<div><span>This page is not yet available</span>
</div>);
</div>);
}
}

View File

@ -79,7 +79,7 @@ export default class EnterTheCode extends React.Component {
return(
<div>
<Interactive as={Link} {...s.link}
to={`/EnterTheCode/PackSimulator/`}>Pack Simulator</Interactive>
to={`/EnterTheCode/PackSimulator/`}>Pack Simulator</Interactive>
<br /><br />
<DigitInput
acceptedCharacters={/^[0-9a-z]$/i}
@ -87,23 +87,23 @@ export default class EnterTheCode extends React.Component {
value={this.code}
onChange={(value) => this.code = value}
>
{props => (
<div style={s.inputGroup}>
<input type="text" style={s.input} {...props[0]} />
<input type="text" style={s.input} {...props[1]} />
<input type="text" style={s.input} {...props[2]} />
<input type="text" style={s.input} {...props[3]} />
<span style={s.hyphen} />
<input type="text" style={s.input} {...props[4]} />
<input type="text" style={s.input} {...props[5]} />
<input type="text" style={s.input} {...props[6]} />
<input type="text" style={s.input} {...props[7]} />
<span style={s.hyphen} />
<input type="text" style={s.input} {...props[8]} />
<input type="text" style={s.input} {...props[9]} />
<input type="text" style={s.input} {...props[10]} />
<input type="text" style={s.input} {...props[11]} />
</div>
{props => (
<div style={s.inputGroup}>
<input type="text" style={s.input} {...props[0]} />
<input type="text" style={s.input} {...props[1]} />
<input type="text" style={s.input} {...props[2]} />
<input type="text" style={s.input} {...props[3]} />
<span style={s.hyphen} />
<input type="text" style={s.input} {...props[4]} />
<input type="text" style={s.input} {...props[5]} />
<input type="text" style={s.input} {...props[6]} />
<input type="text" style={s.input} {...props[7]} />
<span style={s.hyphen} />
<input type="text" style={s.input} {...props[8]} />
<input type="text" style={s.input} {...props[9]} />
<input type="text" style={s.input} {...props[10]} />
<input type="text" style={s.input} {...props[11]} />
</div>
)}
</DigitInput>
<br />

View File

@ -77,15 +77,15 @@ class GenerateCard {
}
else {
cards.push(
<div key={key++} className="card" style={{ backgroundImage: `url("${API.cardImage(card)}")` }}>
<div className="stats">
<span key="courage">{gendisp(card.gsx$courage)}</span>
<span key="power">{gendisp(card.gsx$power)}</span>
<span key="wisdom">{gendisp(card.gsx$wisdom)}</span>
<span key="speed">{gendisp(card.gsx$speed)}</span>
<span key="energy">{geneng(card.gsx$energy)}</span>
</div>
<div key={key++} className="card" style={{ backgroundImage: `url("${API.cardImage(card)}")` }}>
<div className="stats">
<span key="courage">{gendisp(card.gsx$courage)}</span>
<span key="power">{gendisp(card.gsx$power)}</span>
<span key="wisdom">{gendisp(card.gsx$wisdom)}</span>
<span key="speed">{gendisp(card.gsx$speed)}</span>
<span key="energy">{geneng(card.gsx$energy)}</span>
</div>
</div>
);
}

View File

@ -57,26 +57,26 @@ export default function (props) {
}
return (
<div className="packsim">
<Interactive as={Link} {...s.link} to={`/EnterTheCode/`}>Enter The Code</Interactive>
<br /><br />
<form onSubmit={handleSubmit}>
<label>Packs:
<input name="packs" type="number"
value={packs}
min="1" max="24"
style={{ width: "32px", padding: '0px' }}
onChange={onPacksChange} />
</label>
<select name="set" value={set} onChange={onSetChange}>
<option defaultValue="selected" hidden style={{ fontStyle: 'italic' }}>Select a Set</option>
{setsInput}
</select>
<br /><br />
<input disabled={!set} type="submit" value="Open Packs" />
</form>
<br /><br />
<div className="pack">{cards}</div>
</div>
<div className="packsim">
<Interactive as={Link} {...s.link} to={`/EnterTheCode/`}>Enter The Code</Interactive>
<br /><br />
<form onSubmit={handleSubmit}>
<label>Packs:
<input name="packs" type="number"
value={packs}
min="1" max="24"
style={{ width: "32px", padding: '0px' }}
onChange={onPacksChange} />
</label>
<select name="set" value={set} onChange={onSetChange}>
<option defaultValue="selected" hidden style={{ fontStyle: 'italic' }}>Select a Set</option>
{setsInput}
</select>
<br /><br />
<input disabled={!set} type="submit" value="Open Packs" />
</form>
<br /><br />
<div className="pack">{cards}</div>
</div>
);
}

View File

@ -1,6 +1,6 @@
import React from 'react';
import {observer, inject} from 'mobx-react';
import {Route} from 'react-router-dom';
import { observer, inject } from 'mobx-react';
import { Route } from 'react-router-dom';
import EnterTheCode from './EnterTheCode';
import PackSimulator from './PackSimulator';
@ -14,7 +14,7 @@ export default class Base extends React.Component {
}
function Routing(props) {
const match = props.match;
const { match } = props;
return (
<div className="pack">
<Route exact path={match.url} component={EnterTheCode} />

View File

@ -1,8 +1,8 @@
import React from 'react';
import {Link} from 'react-router-dom';
import {Donate} from '../Snippets';
import { Link } from 'react-router-dom';
import { Donate } from '../Snippets';
import "./home.scss";
import {observable} from 'mobx';
import { observable } from 'mobx';
const GithubLink = () => (
<a
@ -13,11 +13,11 @@ const GithubLink = () => (
</a>
);
const LoreEntry = ({block, text, sets}) => {
const LoreEntry = ({ block, text, sets }) => {
return (
<div className="lore">
<div className="block">{block}</div>
{text.map((entry, i) => <div key={i} dangerouslySetInnerHTML={{__html: entry}} />)}
{text.map((entry, i) => <div key={i} dangerouslySetInnerHTML={{ __html: entry }} />)}
{sets.map((set, i) => {
if (set.text && set.text.length > 0) {
return <div className="set" key={i}>
@ -31,7 +31,7 @@ const LoreEntry = ({block, text, sets}) => {
}
export default class Home extends React.Component {
state = {lore: []};
state = { lore: []};
componentDidMount() {
fetch("/src/json/starter_lore.json")
@ -39,11 +39,11 @@ export default class Home extends React.Component {
return response.json();
})
.then((lore) => {
this.setState({"lore": lore});
this.setState({ "lore": lore });
return;
})
.catch(() => {
this.setState({"lore": [{"block": "Unable to load lore...", "text": []}]})
this.setState({ "lore": [{ "block": "Unable to load lore...", "text": []}]})
});
}

View File

@ -32,7 +32,7 @@ const Collection = loadable(
/**
* This function is to define beta routes
*/
function BetaRoutingWrapper(props) {
function BetaRoutingWrapper() {
return (
<Switch>
<Route path="/beta/collection" component={Collection} />
@ -44,7 +44,7 @@ function BetaRoutingWrapper(props) {
);
}
function Routing(props) {
function Routing() {
return (
<Switch>
<Route exact path="/" component={Home} />
@ -67,7 +67,7 @@ function Base(props) {
const children = <BetaRoutingWrapper />;
return (
<React.Fragment>
<>
<div className="fix-pgBkgrnd-repeat-x">
<div className={"fix-img-bkgrnd fix-img-bkgrnd_"+bkgrnd}></div>
</div>
@ -179,7 +179,7 @@ function Base(props) {
</div>
</div>
</div>
</React.Fragment>
</>
);
}

View File

@ -16,7 +16,7 @@ const cases = {
Object.entries(cases).forEach(([key, value]) => {
describe(key, () => {
it('should return ' + value.output, () => {
it(`should return ${value.output}`, () => {
const tune = output(parseTune(value.input));
expect(tune).to.deep.equal(value.output);
});

View File

@ -22,7 +22,7 @@ export const output = (seq: Note[]) => {
// db notation uses duration (quarter notes) and pitch
// 2Eb => E flat for 2 quarter notes
export const parseTune = (input: string): Note[] => {
let seq: Note[] = [];
const seq: Note[] = [];
let time = 0;
console.log(input.split(" "));
input.split(" ").forEach((note) => {
@ -79,7 +79,7 @@ const parseNote = (pitch: string, seq: Note[]): {pitch: string, octave: number}
if (seq.length === 0) return 4;
const l = seq.length - 1;
const octave = seq[l].octave;
const { octave } = seq[l];
const current = pitchValue(pitch, octave);
const previous = pitchValue(seq[l]);
@ -129,7 +129,7 @@ const parseNote = (pitch: string, seq: Note[]): {pitch: string, octave: number}
if (octave > 5) octave = 5;
return {pitch, octave};
return { pitch, octave };
}
/*
@ -148,8 +148,8 @@ const parseNote = (pitch: string, seq: Note[]): {pitch: string, octave: number}
const trend = (current: number, l: number, seq: Note[]): number => {
if (l < 1) return seq[l].octave;
let prev = pitchValue(seq[l]);
let prev2 = pitchValue(seq[l-1]);
const prev = pitchValue(seq[l]);
const prev2 = pitchValue(seq[l-1]);
console.log(prev2, prev, current);
// downward trend
@ -176,7 +176,7 @@ const trend = (current: number, l: number, seq: Note[]): number => {
* Takes two pitches and returns the distance between them
*/
const compare = (one: number, two: number): number => {
let res = Math.abs(one - two);
const res = Math.abs(one - two);
if (res < 4) {
return res;
}

View File

@ -1,4 +1,4 @@
import {Time, Transport, Synth, Part, PolySynth, EnvelopeCurve} from 'tone';
import { Time, Transport, Synth, Part, PolySynth, EnvelopeCurve } from 'tone';
import { Note, parseTune } from './mugicparser';

View File

@ -1,11 +1,11 @@
import React from 'react';
import {debounced} from '../debounce';
import {MugicPlayer} from './mugicplayer';
import { debounced } from '../debounce';
import { MugicPlayer } from './mugicplayer';
const player = MugicPlayer.getInstance();
export default (props: any) => {
const play = debounced(200, () => { player.play(props.notes); });
return (
<input type="button" value="Play" onClick={() => { play() }} />
<input type="button" value="Play" onClick={() => { play() }} />
);
};

View File

@ -1,11 +1,11 @@
import React from 'react';
import Interactive from 'react-interactive';
import {Link, Route} from 'react-router-dom';
import {observable} from 'mobx';
import {observer, inject} from 'mobx-react';
import { Link, Route } from 'react-router-dom';
import { observable } from 'mobx';
import { observer, inject } from 'mobx-react';
import s from '../../styles/app.style';
import API from '../SpreadsheetData';
import {Loading} from '../Snippets';
import { Loading } from '../Snippets';
@inject((stores, props, context) => props) @observer
export default class Category extends React.Component {
@ -22,7 +22,7 @@ export default class Category extends React.Component {
render() {
if (this.loaded == false) {
API.LoadDB([{'cards': this.type}, {'portal': this.type}])
API.LoadDB([{ 'cards': this.type }, { 'portal': this.type }])
.then(() => {
this.loaded = true;
});
@ -34,13 +34,13 @@ export default class Category extends React.Component {
if (!data) return (<div key={i}></div>);
return (<div key={i} className="nav_item">
<Interactive as={Link}
to={url || `/portal/${this.props.type}/${card.gsx$name}`}
{...s.link}
<Interactive as={Link}
to={url || `/portal/${this.props.type}/${card.gsx$name}`}
{...s.link}
>
<span>{card.gsx$name.split(",")[0]}</span><br />
<img className="thumb" src={API.base_image + data.gsx$thumb}></img>
</Interactive>
<span>{card.gsx$name.split(",")[0]}</span><br />
<img className="thumb" src={API.base_image + data.gsx$thumb}></img>
</Interactive>
</div>);
};
@ -83,11 +83,11 @@ export default class Category extends React.Component {
);
bottom_nav = ((tribe) ?
API.portal[this.type].chain().find({'gsx$tribe': tribe}).simplesort('gsx$name').data()
API.portal[this.type].chain().find({ 'gsx$tribe': tribe }).simplesort('gsx$name').data()
:
API.portal[this.type].chain().simplesort('gsx$name').data()
).map((card_portal, i) => {
let card_data = API.cards[this.type].findOne({'gsx$name': card_portal.gsx$name});
let card_data = API.cards[this.type].findOne({ 'gsx$name': card_portal.gsx$name });
let url = ((tribe) ?
`/portal/${this.props.type}/${card_portal.gsx$tribe}/${encodeURIComponent(card_portal.gsx$name)}`
:
@ -107,26 +107,26 @@ export default class Category extends React.Component {
bottom_nav = API.portal[this.type].data
.sort((a, b) => (a.gsx$name > b.gsx$name) ? 1 : -1)
.map((card_portal, i) => {
let card_data = API.cards[this.type].findOne({'gsx$name': card_portal.gsx$name});
let card_data = API.cards[this.type].findOne({ 'gsx$name': card_portal.gsx$name });
return create_link(card_portal, card_data, i);
});
}
if (base_path) {
return (
<div className={`entry ${this.type} base_path`}>
<div className="cat_title">{cat_title}</div>
<div className="entry_nav">{bottom_nav}</div>
</div>
<div className={`entry ${this.type} base_path`}>
<div className="cat_title">{cat_title}</div>
<div className="entry_nav">{bottom_nav}</div>
</div>
);
}
return (
<div className={`entry ${this.type}`}>
<div className="entry_content">{top_content}</div>
<div className="cat_title">{cat_title}</div>
<div className="entry_nav">{bottom_nav}</div>
</div>
<div className={`entry ${this.type}`}>
<div className="entry_content">{top_content}</div>
<div className="cat_title">{cat_title}</div>
<div className="entry_nav">{bottom_nav}</div>
</div>
);
}
}

View File

@ -1,5 +1,5 @@
import React, {Fragment} from 'react';
import {observable} from "mobx";
import React, { Fragment } from 'react';
import { observable } from "mobx";
import API from '../SpreadsheetData';
export default class Home extends React.Component {

View File

@ -1,12 +1,12 @@
import React from 'react';
import Interactive from 'react-interactive';
import {Link} from 'react-router-dom';
import { Link } from 'react-router-dom';
import API from '../SpreadsheetData';
import {observable} from "mobx";
import {observer, inject} from 'mobx-react';
import { observable } from "mobx";
import { observer, inject } from 'mobx-react';
import loki from 'lokijs';
import s from '../../styles/app.style';
import {SearchButton} from '../Snippets';
import { SearchButton } from '../Snippets';
@inject((stores, props, context) => props) @observer
export default class SearchPortal extends React.Component {
@ -50,19 +50,20 @@ class DBSearch extends React.Component {
render() {
if (this.loaded == false) {
API.LoadDB([
{'portal': 'attacks'}, {'portal': 'battlegear'}, {'portal': 'creatures'}, {'portal': 'locations'}, {'portal': 'mugic'},
{'cards': 'attacks'}, {'cards': 'battlegear'}, {'cards': 'creatures'}, {'cards': 'locations'}, {'cards': 'mugic'}
{ 'portal': 'attacks' }, { 'portal': 'battlegear' }, { 'portal': 'creatures' }, { 'portal': 'locations' }, { 'portal': 'mugic' },
{ 'cards': 'attacks' }, { 'cards': 'battlegear' }, { 'cards': 'creatures' }, { 'cards': 'locations' }, { 'cards': 'mugic' }
]).then(() => {
this.loaded = true;
});
})
.catch(() => {})
return (<span>Loading...</span>);
}
let string = this.props.string;
let { string } = this.props;
// No search
if (string == "") {
return (<div style={{minHeight: '50px'}}></div>);
return (<div style={{ minHeight: '50px' }}></div>);
}
const makeLink = (card, i) => {
@ -90,6 +91,21 @@ class DBSearch extends React.Component {
</div>);
};
const create_link = (card, data, i, url) => {
// Prevent site from crashing due to misspelled/missing data
if (!data) return (<div key={i}></div>);
return (<div key={i} className="nav_item">
<Interactive as={Link}
to={url || `/portal/${this.props.type}/${card.gsx$name}`}
{...s.link}
>
<span>{card.gsx$name.split(",")[0]}</span><br />
<img className="thumb" src={API.base_image + data.gsx$thumb}></img>
</Interactive>
</div>);
};
let filter = this.filter.addCollection('filter');
var pview = filter.addDynamicView('filter');
pview.applySimpleSort('gsx$name');
@ -101,35 +117,35 @@ class DBSearch extends React.Component {
let mugicResults = API.portal.mugic.chain();
// Attributes Background Details
attackResults = attackResults.find({'$or': [
{'gsx$attributes': {'$regex': new RegExp(string, 'i')}},
{'gsx$background': {'$regex': new RegExp(string, 'i')}},
{'gsx$details': {'$regex': new RegExp(string, 'i')}}
attackResults = attackResults.find({ '$or': [
{ 'gsx$attributes': { '$regex': new RegExp(string, 'i') }},
{ 'gsx$background': { '$regex': new RegExp(string, 'i') }},
{ 'gsx$details': { '$regex': new RegExp(string, 'i') }}
]});
// Attributes Background Details
battlegearResults = battlegearResults.find({'$or': [
{'gsx$attributes': {'$regex': new RegExp(string, 'i')}},
{'gsx$background': {'$regex': new RegExp(string, 'i')}},
{'gsx$details': {'$regex': new RegExp(string, 'i')}}
battlegearResults = battlegearResults.find({ '$or': [
{ 'gsx$attributes': { '$regex': new RegExp(string, 'i') }},
{ 'gsx$background': { '$regex': new RegExp(string, 'i') }},
{ 'gsx$details': { '$regex': new RegExp(string, 'i') }}
]});
// Appearance Background Special Abilities Details
creatureResults = creatureResults.find({'$or': [
{'gsx$appearance': {'$regex': new RegExp(string, 'i')}},
{'gsx$background': {'$regex': new RegExp(string, 'i')}},
{'gsx$specialabilities': {'$regex': new RegExp(string, 'i')}},
{'gsx$details': {'$regex': new RegExp(string, 'i')}}
creatureResults = creatureResults.find({ '$or': [
{ 'gsx$appearance': { '$regex': new RegExp(string, 'i') }},
{ 'gsx$background': { '$regex': new RegExp(string, 'i') }},
{ 'gsx$specialabilities': { '$regex': new RegExp(string, 'i') }},
{ 'gsx$details': { '$regex': new RegExp(string, 'i') }}
]});
// Local Features Background Details
locationResults = locationResults.find({'$or': [
{'gsx$localfeatures': {'$regex': new RegExp(string, 'i')}},
{'gsx$background': {'$regex': new RegExp(string, 'i')}},
{'gsx$details': {'$regex': new RegExp(string, 'i')}}
locationResults = locationResults.find({ '$or': [
{ 'gsx$localfeatures': { '$regex': new RegExp(string, 'i') }},
{ 'gsx$background': { '$regex': new RegExp(string, 'i') }},
{ 'gsx$details': { '$regex': new RegExp(string, 'i') }}
]});
// Background Details
mugicResults = mugicResults.find({'$or': [
{'gsx$background': {'$regex': new RegExp(string, 'i')}},
{'gsx$details': {'$regex': new RegExp(string, 'i')}}
mugicResults = mugicResults.find({ '$or': [
{ 'gsx$background': { '$regex': new RegExp(string, 'i') }},
{ 'gsx$details': { '$regex': new RegExp(string, 'i') }}
]});
let temp;
@ -161,26 +177,26 @@ class DBSearch extends React.Component {
// This prioritizes names in the results
let names = [].concat(
API.portal.attacks.find({'gsx$name': {'$regex': new RegExp(string, 'i')}}),
API.portal.battlegear.find({'gsx$name': {'$regex': new RegExp(string, 'i')}}),
API.portal.creatures.find({'gsx$name': {'$regex': new RegExp(string, 'i')}}),
API.portal.locations.find({'gsx$name': {'$regex': new RegExp(string, 'i')}}),
API.portal.mugic.find({'gsx$name': {'$regex': new RegExp(string, 'i')}}),
API.portal.attacks.find({ 'gsx$name': { '$regex': new RegExp(string, 'i') }}),
API.portal.battlegear.find({ 'gsx$name': { '$regex': new RegExp(string, 'i') }}),
API.portal.creatures.find({ 'gsx$name': { '$regex': new RegExp(string, 'i') }}),
API.portal.locations.find({ 'gsx$name': { '$regex': new RegExp(string, 'i') }}),
API.portal.mugic.find({ 'gsx$name': { '$regex': new RegExp(string, 'i') }}),
API.cards.attacks.chain()
.find({'gsx$name': {'$regex': new RegExp(string, 'i')}})
.find({ 'gsx$name': { '$regex': new RegExp(string, 'i') }})
.where((obj) => {return (obj.gsx$splash != ('') )}).data(),
API.cards.battlegear.chain()
.find({'gsx$name': {'$regex': new RegExp(string, 'i')}})
.find({ 'gsx$name': { '$regex': new RegExp(string, 'i') }})
.where((obj) => {return (obj.gsx$splash != ('') )}).data(),
// TODO after rewriting Single Creature
// API.cards.creatures.chain()
// .find({'gsx$name': {'$regex': new RegExp(string, 'i')}})
// .where((obj) => {return (obj.gsx$splash != ('') )}).data(),
API.cards.locations.chain()
.find({'gsx$name': {'$regex': new RegExp(string, 'i')}})
.find({ 'gsx$name': { '$regex': new RegExp(string, 'i') }})
.where((obj) => {return (obj.gsx$splash != ('') )}).data(),
API.cards.mugic.chain()
.find({'gsx$name': {'$regex': new RegExp(string, 'i')}})
.find({ 'gsx$name': { '$regex': new RegExp(string, 'i') }})
.where((obj) => {return (obj.gsx$splash != ('') )}).data()
).sort((a, b) => {
a = a.gsx$name.toLowerCase();
@ -193,19 +209,19 @@ class DBSearch extends React.Component {
if (content.length == 0) {
let artists = [].concat(
API.cards.attacks.chain()
.find({'gsx$artist': {'$regex': new RegExp(string, 'i')}})
.find({ 'gsx$artist': { '$regex': new RegExp(string, 'i') }})
.where((obj) => {return (obj.gsx$splash != ('') )}).data(),
API.cards.battlegear.chain()
.find({'gsx$artist': {'$regex': new RegExp(string, 'i')}})
.find({ 'gsx$artist': { '$regex': new RegExp(string, 'i') }})
.where((obj) => {return (obj.gsx$splash != ('') )}).data(),
API.cards.creatures.chain()
.find({'gsx$artist': {'$regex': new RegExp(string, 'i')}})
.find({ 'gsx$artist': { '$regex': new RegExp(string, 'i') }})
.where((obj) => {return (obj.gsx$splash != ('') )}).data(),
API.cards.locations.chain()
.find({'gsx$artist': {'$regex': new RegExp(string, 'i')}})
.find({ 'gsx$artist': { '$regex': new RegExp(string, 'i') }})
.where((obj) => {return (obj.gsx$splash != ('') )}).data(),
API.cards.mugic.chain()
.find({'gsx$artist': {'$regex': new RegExp(string, 'i')}})
.find({ 'gsx$artist': { '$regex': new RegExp(string, 'i') }})
.where((obj) => {return (obj.gsx$splash != ('') )}).data()
).sort((a, b) => {
a = a.gsx$name.toLowerCase();
@ -229,11 +245,11 @@ class DBSearch extends React.Component {
return (<div className="results">
<hr />
{names.length > 0 && <React.Fragment>
{names.length > 0 && <>
<div>Entries</div>
{names}
<hr />
</React.Fragment>}
</>}
<div>{header}</div>
{content}
</div>);

View File

@ -1,8 +1,8 @@
import React from 'react';
import API from '../../SpreadsheetData';
import s from '../../../styles/app.style';
import {observer, inject} from 'mobx-react';
import {PageNotFound} from '../../Snippets';
import { observer, inject } from 'mobx-react';
import { PageNotFound } from '../../Snippets';
import Single from './_base';
@inject((stores, props, context) => props) @observer
@ -20,28 +20,28 @@ export default class SingleAttack extends React.Component {
let name = decodeURIComponent(path[3]);
const attack = API.portal.attacks.findOne({'gsx$name': name});
const card_data = API.cards.attacks.findOne({'gsx$name': name});
const attack = API.portal.attacks.findOne({ 'gsx$name': name });
const card_data = API.cards.attacks.findOne({ 'gsx$name': name });
if (attack) {
return (<Single
card={card_data}
col2={<React.Fragment>
<div>
<strong>Attributes:</strong><br />
{attack.gsx$attributes}
</div>
<hr />
<div>
<strong>Background:</strong><br />
{attack.gsx$background}
</div>
<hr />
<div>
<strong>Details:</strong><br />
{attack.gsx$details}
</div>
</React.Fragment>}
card={card_data}
col2={<>
<div>
<strong>Attributes:</strong><br />
{attack.gsx$attributes}
</div>
<hr />
<div>
<strong>Background:</strong><br />
{attack.gsx$background}
</div>
<hr />
<div>
<strong>Details:</strong><br />
{attack.gsx$details}
</div>
</>}
/>
);
}

View File

@ -1,8 +1,8 @@
import React from 'react';
import API from '../../SpreadsheetData';
import s from '../../../styles/app.style';
import {observer, inject} from 'mobx-react';
import {PageNotFound} from '../../Snippets';
import { observer, inject } from 'mobx-react';
import { PageNotFound } from '../../Snippets';
import Single from './_base';
@inject((stores, props, context) => props) @observer
@ -20,13 +20,13 @@ export default class SingleBattlegear extends React.Component {
let name = decodeURIComponent(path[3]);
const battlegear = API.portal.battlegear.findOne({'gsx$name': name});
const card_data = API.cards.battlegear.findOne({'gsx$name': name});
const battlegear = API.portal.battlegear.findOne({ 'gsx$name': name });
const card_data = API.cards.battlegear.findOne({ 'gsx$name': name });
if (battlegear) {
return (<Single
card={card_data}
col2={<React.Fragment>
col2={<>
<div>
<strong>Attributes:</strong><br />
{battlegear.gsx$attributes}
@ -41,7 +41,7 @@ export default class SingleBattlegear extends React.Component {
<strong>Details:</strong><br />
{battlegear.gsx$details}
</div>
</React.Fragment>}
</>}
/>);
}
else if (card_data) {

View File

@ -1,11 +1,11 @@
import React from 'react';
import Interactive from 'react-interactive';
import {Link} from 'react-router-dom';
import { Link } from 'react-router-dom';
import API from '../../SpreadsheetData';
import s from '../../../styles/app.style';
import {observer, inject} from 'mobx-react';
import { observer, inject } from 'mobx-react';
import Single from './_base';
import {PageNotFound, Element, Mugic, Discipline, Ability, Tribe} from '../../Snippets';
import { PageNotFound, Element, Mugic, Discipline, Ability, Tribe } from '../../Snippets';
function Artist(props) {
let artists = [];
@ -32,7 +32,7 @@ export default class SingleCreature extends React.Component {
if (path.length == 4) return decodeURIComponent(path[3]);
})();
const creature = API.portal.creatures.findOne({'gsx$name': name});
const creature = API.portal.creatures.findOne({ 'gsx$name': name });
if (!creature) {
return(<PageNotFound location={this.props.location}/>);
@ -40,7 +40,7 @@ export default class SingleCreature extends React.Component {
const tribe = creature.gsx$tribe;
const card_data = API.cards.creatures.findOne({'gsx$name': name});
const card_data = API.cards.creatures.findOne({ 'gsx$name': name });
const locations = creature.gsx$location.split(/[;]+\s*/).map((item, i) => {
return <p key={i}><Interactive as={Link} {...s.link} to={"/portal/Locations/"+item}><span>{item}</span></Interactive></p>;
@ -59,15 +59,15 @@ export default class SingleCreature extends React.Component {
return (<Single
card={card_data}
text={<React.Fragment>
text={<>
<hr />
{creature.gsx$appearance && <React.Fragment>
{creature.gsx$appearance && <>
<div>
<strong>Appearance:</strong><br />
{creature.gsx$appearance}
</div>
<hr />
</React.Fragment>}
</>}
<div>
<strong>Background:</strong><br />
{creature.gsx$background}
@ -103,13 +103,13 @@ export default class SingleCreature extends React.Component {
{creature.gsx$weight}
</div>
<hr />
{card_data.gsx$artist && <React.Fragment>
{card_data.gsx$artist && <>
<div>
<strong>Artist(s):</strong>
<Artist artist={card_data.gsx$artist} />
</div>
<hr />
</React.Fragment>}
</>}
<div>
<strong>Card ID: </strong>
{card_data.gsx$id}
@ -183,7 +183,7 @@ export default class SingleCreature extends React.Component {
<strong>Mugic Ability: </strong>
{mugic}
</div>
</React.Fragment>}
</>}
/>);
}
}

View File

@ -1,8 +1,8 @@
import React from 'react';
import API from '../../SpreadsheetData';
import {observer, inject} from 'mobx-react';
import { observer, inject } from 'mobx-react';
import Single from './_base';
import {PageNotFound, Initiative} from '../../Snippets';
import { PageNotFound, Initiative } from '../../Snippets';
@inject((stores, props, context) => props) @observer
export default class SingleLocation extends React.Component {
@ -19,19 +19,19 @@ export default class SingleLocation extends React.Component {
let name = decodeURIComponent(path[3]);
const location = API.portal.locations.findOne({'gsx$name': name});
const card_data = API.cards.locations.findOne({'gsx$name': name});
const location = API.portal.locations.findOne({ 'gsx$name': name });
const card_data = API.cards.locations.findOne({ 'gsx$name': name });
if (location) {
return (<Single
card={card_data}
col0={<React.Fragment>
col0={<>
<div>
<strong>Initiative: </strong>
<Initiative initiative={card_data.gsx$initiative} notitle="true"/>
</div>
</React.Fragment>}
col2={<React.Fragment>
</>}
col2={<>
<div>
<strong>Local Features:</strong><br />
{location.gsx$localfeatures}
@ -46,19 +46,19 @@ export default class SingleLocation extends React.Component {
<strong>Details:</strong><br />
{location.gsx$details}
</div>
</React.Fragment>}
</>}
/>);
}
else if (card_data) {
if (card_data.gsx$splash) {
return (<Single
card={card_data}
col0={<React.Fragment>
col0={<>
<div>
<strong>Initiative: </strong>
<Initiative initiative={card_data.gsx$initiative} notitle="true"/>
</div>
</React.Fragment>}
</>}
/>);
}
}

View File

@ -1,9 +1,9 @@
import React from 'react';
import API from '../../SpreadsheetData';
import s from '../../../styles/app.style';
import {observer, inject} from 'mobx-react';
import { observer, inject } from 'mobx-react';
import Single from './_base';
import {PageNotFound, Mugic, Tribe} from '../../Snippets';
import { PageNotFound, Mugic, Tribe } from '../../Snippets';
@inject((stores, props, context) => props) @observer
export default class SingleMugic extends React.Component {
@ -22,8 +22,8 @@ export default class SingleMugic extends React.Component {
if (path.length == 4) return decodeURIComponent(path[3]);
})();
const mugic = API.portal.mugic.findOne({'gsx$name': name});
const card_data = API.cards.mugic.findOne({'gsx$name': name});
const mugic = API.portal.mugic.findOne({ 'gsx$name': name });
const card_data = API.cards.mugic.findOne({ 'gsx$name': name });
const cost = () => {
let cost = [];
@ -44,7 +44,7 @@ export default class SingleMugic extends React.Component {
if (mugic) {
return (<Single
card={card_data}
col0={<React.Fragment>
col0={<>
<div>
<strong>Tribe: </strong>
<Tribe tribe={mugic.gsx$tribe} />
@ -54,8 +54,8 @@ export default class SingleMugic extends React.Component {
<strong>Cost: </strong>
{cost()}
</div>
</React.Fragment>}
col2={<React.Fragment>
</>}
col2={<>
<div>
<strong>Background:</strong><br />
{mugic.gsx$background}
@ -65,14 +65,14 @@ export default class SingleMugic extends React.Component {
<strong>Details:</strong><br />
{mugic.gsx$details}
</div>
</React.Fragment>}
</>}
/>);
}
else if (card_data) {
if (card_data.gsx$splash) {
return (<Single
card={card_data}
col0={<React.Fragment>
col0={<>
<div>
<strong>Tribe: </strong>
<Tribe tribe={card_data.gsx$tribe} />
@ -82,7 +82,7 @@ export default class SingleMugic extends React.Component {
<strong>Cost: </strong>
{cost()}
</div>
</React.Fragment>}
</>}
/>);
}
}

View File

@ -9,12 +9,12 @@ import s from '../../../styles/app.style';
// own "name" display function
function Name(props) {
let name = props.name.split(",");
return (<React.Fragment>
return (<>
<span>{name[0]}</span>
{ name.length > 1 &&
<span className="bigger"><br />{name[1].trim()}</span>
}
</React.Fragment>);
</>);
}
function Artist(props) {
@ -38,80 +38,83 @@ export default class Single extends React.Component {
}
render() {
let card = this.props.card;
return (<React.Fragment>
<div className={"modal" + (this.fullscreen?"":" hidden")}>
<span className="close" onClick={this.close.bind(this)}>&times;</span>
<img className="modal-content" src={API.base_image + card.gsx$splash} />
</div>
{card.gsx$splash && (
let { card } = this.props;
return (<>
<div className={"modal" + (this.fullscreen?"":" hidden")}>
<span className="close" onClick={this.close.bind(this)}>&times;</span>
<img className="modal-content" src={API.base_image + card.gsx$splash} />
</div>
{card.gsx$splash && (
<div className="entry_splash">
{/*<span className="arrow">&#8681;</span>*/}
{/*<span className="arrow">&#8681;</span>*/}
<img onClick={this.expand.bind(this)} src={API.base_image + card.gsx$splash} />
</div>
)}
<div className="entry_body">
<div className="title">
<Name name={card.gsx$name} />
<hr />
</div>
{this.props.text &&
<div className="nocolumn">{this.props.text}</div>
}
{!this.props.text &&
<div className="column">
{card.gsx$artist && <React.Fragment>
<div>
<strong>Artist(s):</strong>
<Artist artist={card.gsx$artist} />
</div>
<hr />
</React.Fragment>}
<div>
<strong>Set: </strong>
{`${API.sets[card.gsx$set]} (${card.gsx$set})`}
</div>
<hr />
<div>
<strong>Rarity: </strong>
<Rarity set={card.gsx$set} rarity={card.gsx$rarity} notext="true" />
&nbsp;{card.gsx$rarity}
</div>
<hr />
<div>
<strong>Card ID: </strong>
{card.gsx$id}
</div>
{this.props.col0 && <React.Fragment>
<hr />
{this.props.col0}
</React.Fragment>}
{card.gsx$ability && <React.Fragment>
<hr />
<div>
<strong>Ability:</strong>
<Ability ability={card.gsx$ability} />
</div>
</React.Fragment>}
{card.gsx$flavortext && <React.Fragment>
<hr />
<div>
<strong>Card Flavor:</strong><br />
{card.gsx$flavortext}
</div>
</React.Fragment>}
{this.props.col1 && <React.Fragment>
<hr />
this.props.col1
</React.Fragment>}
</div>
}
{!this.props.text &&
<div className="column">
{this.props.col2}
</div>
}
<div className="entry_body">
<div className="title">
<Name name={card.gsx$name} />
<hr />
</div>
</React.Fragment>);
{this.props.text &&
<div className="nocolumn">{this.props.text}</div>
}
{!this.props.text &&
<div className="column">
{card.gsx$artist && <>
<div>
<strong>Artist(s):</strong>
<Artist artist={card.gsx$artist} />
</div>
<hr />
</>}
{card.gsx$set && <>
<div>
<strong>Set: </strong>
{`${API.sets[card.gsx$set]} (${card.gsx$set})`}
</div>
<hr />
</>
}
<div>
<strong>Rarity: </strong>
<Rarity set={card.gsx$set} rarity={card.gsx$rarity} notext="true" />
{card.gsx$rarity}
</div>
<hr />
<div>
<strong>Card ID: </strong>
{card.gsx$id}
</div>
{this.props.col0 && <>
<hr />
{this.props.col0}
</>}
{card.gsx$ability && <>
<hr />
<div>
<strong>Ability:</strong>
<Ability ability={card.gsx$ability} />
</div>
</>}
{card.gsx$flavortext && <>
<hr />
<div>
<strong>Card Flavor:</strong><br />
{card.gsx$flavortext}
</div>
</>}
{this.props.col1 && <>
<hr />
this.props.col1
</>}
</div>
}
{!this.props.text &&
<div className="column">
{this.props.col2}
</div>
}
</div>
</>);
}
}

View File

@ -1,12 +1,12 @@
import React from 'react';
import Interactive from 'react-interactive';
import {Link, Route} from 'react-router-dom';
import {observable} from 'mobx';
import {observer, inject} from 'mobx-react';
import { Link, Route } from 'react-router-dom';
import { observable } from 'mobx';
import { observer, inject } from 'mobx-react';
import loki from 'lokijs';
import s from '../../styles/app.style';
import API from '../SpreadsheetData';
import {Loading} from '../Snippets';
import { Loading } from '../Snippets';
import Creature from './Single/Creature';
import Mugic from './Single/Mugic';
@ -25,10 +25,11 @@ export default class Tribes extends React.Component {
// -> /{Tribe}/Mugic || /{Tribe}/Creatures
render() {
if (this.loaded == false) {
API.LoadDB([{'cards': 'creatures'}, {'portal': 'creatures'}, {'cards': 'mugic'}, {'portal': 'mugic'}])
API.LoadDB([{ 'cards': 'creatures' }, { 'portal': 'creatures' }, { 'cards': 'mugic' }, { 'portal': 'mugic' }])
.then(() => {
this.loaded = true;
});
})
.catch(() => {});
return (<Loading />);
}
@ -43,11 +44,11 @@ export default class Tribes extends React.Component {
let temp;
temp = API.portal.creatures.find({'gsx$tribe': tribe});
temp = API.portal.creatures.find({ 'gsx$tribe': tribe });
temp.forEach((v) => { delete v.$loki });
filter.insert(temp);
temp = API.portal.mugic.find({'gsx$tribe': tribe});
temp = API.portal.mugic.find({ 'gsx$tribe': tribe });
temp.forEach((v) => { delete v.$loki });
filter.insert(temp);
@ -58,12 +59,12 @@ export default class Tribes extends React.Component {
let card_data, url;
if (card.gsx$type == "Mugic") {
card_data = API.cards.mugic.findOne({'gsx$name': card.gsx$name});
card_data = API.cards.mugic.findOne({ 'gsx$name': card.gsx$name });
url = "/portal/" + tribe + "/Mugic/" + encodeURIComponent(card.gsx$name);
}
if (card.gsx$type == "Creatures") {
card_data = API.cards.creatures.findOne({'gsx$name': card.gsx$name});
card_data = API.cards.creatures.findOne({ 'gsx$name': card.gsx$name });
url = "/portal/" + tribe + "/Creatures/" + encodeURIComponent(card.gsx$name);
}

View File

@ -1,12 +1,12 @@
import React from 'react';
import {observable} from "mobx";
import {observer, inject} from 'mobx-react';
import {Link, Route} from 'react-router-dom';
import { observable } from "mobx";
import { observer, inject } from 'mobx-react';
import { Link, Route } from 'react-router-dom';
import API from '../SpreadsheetData';
import Home from './Home';
import Search from './Search';
import {SearchButton} from '../Snippets';
import { SearchButton } from '../Snippets';
import Category from './Category';
import Tribes from './Tribes';
@ -41,10 +41,10 @@ export default class Base extends React.Component {
}
function Routing(props) {
const url = props.match.url;
const { url } = props.match;
return (
<React.Fragment>
<>
<Route exact path={url} component={Home} />
<Route path={`${url}/Attacks`} render={(props) => <Category {...props} type="Attacks" component={Attack} />} />
<Route path={`${url}/Battlegear`} render={(props) => <Category {...props} type="Battlegear" component={Battlegear} />} />
@ -52,10 +52,10 @@ function Routing(props) {
<Route path={`${url}/Locations`} render={(props) => <Category {...props} type="Locations" component={Location} />} />
<Route path={`${url}/Mugic`} render={(props) => <Category {...props} type="Mugic" component={Mugic} />} />
{API.tribes.map((tribe, i) => (
<Route key={i} path={`${url}/${tribe}`} component={Tribes} />
<Route key={i} path={`${url}/${tribe}`} component={Tribes} />
))}
<Route path={`${url}/Search`} component={Search} />
</React.Fragment>
</>
);
}

View File

@ -58,7 +58,7 @@ export default {
}}
{...props}
>
<span style={{paddingRight: '7px'}}>&ndash;</span>
<span style={{ paddingRight: '7px' }}>&ndash;</span>
{content}
</li>
),