mirror of
https://github.com/chaoticbackup/chaoticbackup.github.io.git
synced 2026-08-21 16:14:37 -05:00
added filter for all cards
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -16,8 +16,8 @@ class API {
|
||||
|
||||
// Singleton
|
||||
static getInstance() {
|
||||
if (!this.instance) { this.instance = new API(); }
|
||||
return this.instance;
|
||||
if (!this.instance) { this.instance = new API(); }
|
||||
return this.instance;
|
||||
}
|
||||
|
||||
static path(spreadsheetID) {
|
||||
|
||||
@@ -5,6 +5,9 @@ import s from '../../styles/app.style';
|
||||
import {observable} from "mobx";
|
||||
import {observer, inject} from 'mobx-react';
|
||||
|
||||
let thumb = "1JYjPzkv74IhzlHTyVh2niTDyui73HSfp";
|
||||
let card_back = "1_MgWDPsPGf-gPBArn2v6ideJcqOPsSYC";
|
||||
|
||||
@inject((stores, props, context) => props) @observer
|
||||
export default class Creature extends React.Component {
|
||||
|
||||
@@ -16,9 +19,9 @@ export default class Creature extends React.Component {
|
||||
|
||||
return(
|
||||
<div style={{textAlign: 'left', display: 'flex'}}>
|
||||
<img className="thumb" style={{float: 'left', width: '100px'}} src={API.base_image + creature.gsx$thumb}></img>
|
||||
<img className="thumb" style={{float: 'left', width: '100px', height: '98px'}} src={API.base_image + (creature.gsx$thumb||thumb)}></img>
|
||||
<div style={{verticalAlign: 'text-top', float: 'left', width: "50%"}}>
|
||||
<img className="icon" src={"/src/img/icons/tribes/"+creature.gsx$tribe.toLowerCase()+".png"}></img>
|
||||
<img height="20" className="icon" src={"/src/img/icons/tribes/"+creature.gsx$tribe.toLowerCase()+".png"}></img>
|
||||
<span>{creature.gsx$name}</span><br />
|
||||
<span>{elements}</span><br />
|
||||
<span>Energy: {creature.gsx$energy}</span><br />
|
||||
|
||||
@@ -75,17 +75,22 @@ export default class CollectionHome extends React.Component {
|
||||
}
|
||||
|
||||
searchForm() {
|
||||
let stones = {};
|
||||
let tribes = {};
|
||||
|
||||
// TODO advanced filters
|
||||
let search = (e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
let baseResultset = API.cards.creatures.chain().where((obj) => {return (!obj.gsx$thumb == '');});
|
||||
let baseResultset = API.cards.creatures.chain();
|
||||
|
||||
if (!stones.allCards.checked){
|
||||
baseResultset = baseResultset.where((obj) => {return (!obj.gsx$thumb == '');});
|
||||
}
|
||||
|
||||
// Search by name
|
||||
if (this.name.value) {
|
||||
baseResultset = baseResultset.find({'gsx$name': {'$regex': new RegExp(this.name.value, 'i')} });
|
||||
if (stones.name.value) {
|
||||
baseResultset = baseResultset.find({'gsx$name': {'$regex': new RegExp(stones.name.value, 'i')} });
|
||||
}
|
||||
|
||||
// Search by tribe
|
||||
@@ -108,7 +113,8 @@ export default class CollectionHome extends React.Component {
|
||||
|
||||
return (
|
||||
<form onSubmit={search}>
|
||||
<label>Card Name:<input type="text" ref={(input) => this.name = input} /></label><br />
|
||||
<label>Show all cards:<input type="checkbox" ref={(input) => stones.allCards = input}/></label><br />
|
||||
<label>Card Name:<input type="text" ref={(input) => stones.name = input} /></label><br />
|
||||
<input type="checkbox" ref={(input) => tribes.danian = input}/><img height="16" className="icon" src={"/src/img/icons/tribes/danian.png"} />
|
||||
<input type="checkbox" ref={(input) => tribes.mipedian = input}/><img height="16" className="icon" src={"/src/img/icons/tribes/mipedian.png"} />
|
||||
<input type="checkbox" ref={(input) => tribes.overworld = input}/><img height="16" className="icon" src={"/src/img/icons/tribes/overworld.png"} />
|
||||
|
||||
Reference in New Issue
Block a user