sort cryp names
This commit is contained in:
parent
523840a101
commit
7d70a864fd
@ -1,39 +1,45 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
extends: [
|
extends: [
|
||||||
'eslint:recommended',
|
'eslint:recommended',
|
||||||
'plugin:react/recommended',
|
'plugin:react/recommended',
|
||||||
],
|
],
|
||||||
env: {
|
env: {
|
||||||
"browser": true,
|
browser: true,
|
||||||
"node": true
|
node: true
|
||||||
},
|
},
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
"ecmaVersion": 6
|
ecmaVersion: 6
|
||||||
},
|
},
|
||||||
rules: {
|
settings: {
|
||||||
// prevents stupid complaints a la
|
react: {
|
||||||
// (req) {
|
pragma: "preact",
|
||||||
// req.something = x;
|
version: "15.0",
|
||||||
// }
|
}
|
||||||
'no-param-reassign': [2, { props: false }],
|
},
|
||||||
'no-multi-spaces': [0],
|
rules: {
|
||||||
'max-len': ['error', 120],
|
// prevents stupid complaints a la
|
||||||
'import/no-extraneous-dependencies': [0],
|
// (req) {
|
||||||
'prefer-arrow-callback': [0],
|
// req.something = x;
|
||||||
'arrow-body-style': [0],
|
// }
|
||||||
'no-return-assign': [2, 'except-parens'],
|
'no-param-reassign': [2, { props: false }],
|
||||||
'no-console': [0],
|
'no-multi-spaces': [0],
|
||||||
// i like loops
|
'max-len': ['error', 120],
|
||||||
'no-plusplus': [0],
|
'import/no-extraneous-dependencies': [0],
|
||||||
'no-await-in-loop': [0],
|
'prefer-arrow-callback': [0],
|
||||||
'indent': ['error', 4],
|
'arrow-body-style': [0],
|
||||||
|
'no-return-assign': [2, 'except-parens'],
|
||||||
// for preact
|
'no-console': [0],
|
||||||
"react/react-in-jsx-scope": [0],
|
// i like loops
|
||||||
"react/jsx-indent": [2, 4],
|
'no-plusplus': [0],
|
||||||
"react/jsx-uses-react": 1,
|
'no-await-in-loop': [0],
|
||||||
"react/jsx-uses-vars": 1,
|
'indent': ['error', 4],
|
||||||
"react/prefer-stateless-function": 1,
|
|
||||||
"react/prop-types": 0
|
// for preact
|
||||||
},
|
"react/react-in-jsx-scope": [0],
|
||||||
|
"react/jsx-indent": [2, 4],
|
||||||
|
"react/jsx-uses-react": 1,
|
||||||
|
"react/jsx-uses-vars": 1,
|
||||||
|
"react/prefer-stateless-function": 1,
|
||||||
|
"react/prop-types": 0
|
||||||
|
},
|
||||||
};
|
};
|
||||||
@ -17,6 +17,7 @@
|
|||||||
"jdenticon": "^2.1.0",
|
"jdenticon": "^2.1.0",
|
||||||
"key": "^0.1.11",
|
"key": "^0.1.11",
|
||||||
"keymaster": "^1.6.2",
|
"keymaster": "^1.6.2",
|
||||||
|
"lodash": "^4.17.11",
|
||||||
"preact": "^8.3.1",
|
"preact": "^8.3.1",
|
||||||
"preact-redux": "^2.0.3",
|
"preact-redux": "^2.0.3",
|
||||||
"redux": "^4.0.0"
|
"redux": "^4.0.0"
|
||||||
|
|||||||
@ -1,9 +1,11 @@
|
|||||||
// eslint-disable-next-line
|
|
||||||
const preact = require('preact');
|
const preact = require('preact');
|
||||||
|
|
||||||
|
const { stringSort } = require('./../utils');
|
||||||
|
const nameSort = stringSort('name');
|
||||||
|
|
||||||
function CrypList({ cryps, activeItem, sendCombatPve, sendItemUse }) {
|
function CrypList({ cryps, activeItem, sendCombatPve, sendItemUse }) {
|
||||||
if (!cryps) return <div>not ready</div>;
|
if (!cryps) return <div>not ready</div>;
|
||||||
const crypPanels = cryps.map(cryp => (
|
const crypPanels = cryps.sort(nameSort).map(cryp => (
|
||||||
|
|
||||||
<div key={cryp.id}
|
<div key={cryp.id}
|
||||||
className="tile is-vertical box"
|
className="tile is-vertical box"
|
||||||
|
|||||||
@ -1,4 +1,3 @@
|
|||||||
// eslint-disable-next-line
|
|
||||||
const preact = require('preact');
|
const preact = require('preact');
|
||||||
|
|
||||||
function renderSpawnButton({ account, sendCrypSpawn }) {
|
function renderSpawnButton({ account, sendCrypSpawn }) {
|
||||||
|
|||||||
@ -1,9 +1,6 @@
|
|||||||
const key = require('keymaster');
|
const key = require('keymaster');
|
||||||
const { connect } = require('preact-redux');
|
|
||||||
const actions = require('./actions');
|
const actions = require('./actions');
|
||||||
|
|
||||||
console.log(key);
|
|
||||||
|
|
||||||
function setupKeys(store) {
|
function setupKeys(store) {
|
||||||
store.subscribe(function mapKeys() {
|
store.subscribe(function mapKeys() {
|
||||||
const state = store.getState();
|
const state = store.getState();
|
||||||
|
|||||||
20
client/src/utils.jsx
Normal file
20
client/src/utils.jsx
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
const get = require('lodash/get');
|
||||||
|
|
||||||
|
const stringSort = (k, desc) => {
|
||||||
|
if (desc) {
|
||||||
|
return (a, b) => {
|
||||||
|
if (!get(a, k)) return 1;
|
||||||
|
if (!get(b, k)) return -1;
|
||||||
|
return get(b, k).localeCompare(get(a, k));
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return (a, b) => {
|
||||||
|
if (!get(a, k)) return 1;
|
||||||
|
if (!get(b, k)) return -1;
|
||||||
|
return get(a, k).localeCompare(get(b, k));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
stringSort,
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user