mirror of
https://github.com/chaoticbackup/chaoticbackup.github.io.git
synced 2026-04-17 06:16:06 -05:00
closes #23
This commit is contained in:
parent
00d08847c9
commit
ac28ca5f9b
File diff suppressed because one or more lines are too long
25
src/components/collection/Battlegear.js
Normal file
25
src/components/collection/Battlegear.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import React from 'react';
|
||||
import Interactive from 'react-interactive';
|
||||
import API from '../SpreadsheetData';
|
||||
import s from '../../styles/app.style';
|
||||
import {observable} from "mobx";
|
||||
import {observer, inject} from 'mobx-react';
|
||||
|
||||
@inject((stores, props, context) => props) @observer
|
||||
export default class Battlegear extends React.Component {
|
||||
|
||||
render() {
|
||||
let battlegear = this.props.battlegear;
|
||||
|
||||
return(
|
||||
<div style={{textAlign: 'left', display: 'flex'}}>
|
||||
<img className="thumb" style={{float: 'left', width: '100px', height: '98px'}} src={API.base_image + (battlegear.gsx$thumb||API.thumb_missing)}></img>
|
||||
<div style={{verticalAlign: 'text-top', float: 'left', width: "50%"}}>
|
||||
<span>{battlegear.gsx$name}</span><br />
|
||||
<span>{API.sets[battlegear.gsx$set]} | {battlegear.gsx$rarity}</span><br />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ import s from '../../styles/app.style';
|
|||
import {observable} from "mobx";
|
||||
import {observer, inject} from 'mobx-react';
|
||||
import Attack from './Attack';
|
||||
import Battlegear from './Battlegear';
|
||||
import Creature from './Creature';
|
||||
import Mugic from './Mugic';
|
||||
import SearchForm from './Search';
|
||||
|
|
@ -89,6 +90,7 @@ export default class CollectionHome extends React.Component {
|
|||
}
|
||||
return elements.map((element, i) => {
|
||||
if (element.gsx$type == "Attack") return (<Attack attack={element} key={i} />);
|
||||
if (element.gsx$type == "Battlegear") return (<Battlegear battlegear={element} key={i} />);
|
||||
if (element.gsx$type == "Creature") return (<Creature creature={element} key={i} />);
|
||||
if (element.gsx$type == "Mugic") return (<Mugic mugic={element} key={i} />);
|
||||
else return (<div key={i}>Empty</div>);
|
||||
|
|
|
|||
|
|
@ -161,20 +161,25 @@ export default class SearchForm extends React.Component {
|
|||
// TODO eventually remove
|
||||
if (!this.stones.allCards.checked){
|
||||
creatureResults = creatureResults.where((obj) => {return (!obj.gsx$thumb == '');});
|
||||
battlegearResults = battlegearResults.where((obj) => {return (!obj.gsx$thumb == '');});
|
||||
attackResults = attackResults.where((obj) => {return (!obj.gsx$thumb == '');});
|
||||
mugicResults = mugicResults.where((obj) => {return (!obj.gsx$thumb == '');});
|
||||
}
|
||||
|
||||
// Search by name
|
||||
if (this.stones.name.value) {
|
||||
creatureResults = creatureResults.find({'$or': [
|
||||
{'gsx$name': {'$regex': new RegExp(this.stones.name.value, 'i')}},
|
||||
{'gsx$tags': {'$regex': new RegExp(this.stones.name.value, 'i')}}
|
||||
]});
|
||||
attackResults = attackResults.find({'$or': [
|
||||
{'gsx$name': {'$regex': new RegExp(this.stones.name.value, 'i')}},
|
||||
{'gsx$tags': {'$regex': new RegExp(this.stones.name.value, 'i')}},
|
||||
]});
|
||||
battlegearResults = battlegearResults.find({'$or': [
|
||||
{'gsx$name': {'$regex': new RegExp(this.stones.name.value, 'i')}},
|
||||
{'gsx$tags': {'$regex': new RegExp(this.stones.name.value, 'i')}},
|
||||
]});
|
||||
creatureResults = creatureResults.find({'$or': [
|
||||
{'gsx$name': {'$regex': new RegExp(this.stones.name.value, 'i')}},
|
||||
{'gsx$tags': {'$regex': new RegExp(this.stones.name.value, 'i')}}
|
||||
]});
|
||||
mugicResults = mugicResults.find({'$or': [
|
||||
{'gsx$name': {'$regex': new RegExp(this.stones.name.value, 'i')}},
|
||||
{'gsx$tags': {'$regex': new RegExp(this.stones.name.value, 'i')}},
|
||||
|
|
@ -182,17 +187,22 @@ export default class SearchForm extends React.Component {
|
|||
}
|
||||
|
||||
if (this.stones.text.value) {
|
||||
attackResults = attackResults.find({'$or': [
|
||||
{'gsx$tags': {'$regex': new RegExp(this.stones.text.value, 'i')}},
|
||||
{'gsx$ability': {'$regex': new RegExp(this.stones.text.value, 'i')}},
|
||||
{'gsx$flavortext': {'$regex': new RegExp(this.stones.text.value, 'i')}}
|
||||
]});
|
||||
battlegearResults = battlegearResults.find({'$or': [
|
||||
{'gsx$tags': {'$regex': new RegExp(this.stones.text.value, 'i')}},
|
||||
{'gsx$ability': {'$regex': new RegExp(this.stones.text.value, 'i')}},
|
||||
{'gsx$flavortext': {'$regex': new RegExp(this.stones.text.value, 'i')}}
|
||||
]});
|
||||
creatureResults = creatureResults.find({'$or': [
|
||||
{'gsx$tags': {'$regex': new RegExp(this.stones.text.value, 'i')}},
|
||||
{'gsx$ability': {'$regex': new RegExp(this.stones.text.value, 'i')}},
|
||||
{'gsx$flavortext': {'$regex': new RegExp(this.stones.text.value, 'i')}},
|
||||
{'gsx$brainwashedability': {'$regex': new RegExp(this.stones.text.value, 'i')}}
|
||||
]});
|
||||
attackResults = attackResults.find({'$or': [
|
||||
{'gsx$tags': {'$regex': new RegExp(this.stones.text.value, 'i')}},
|
||||
{'gsx$ability': {'$regex': new RegExp(this.stones.text.value, 'i')}},
|
||||
{'gsx$flavortext': {'$regex': new RegExp(this.stones.text.value, 'i')}}
|
||||
]});
|
||||
mugicResults = mugicResults.find({'$or': [
|
||||
{'gsx$tags': {'$regex': new RegExp(this.stones.text.value, 'i')}},
|
||||
{'gsx$ability': {'$regex': new RegExp(this.stones.text.value, 'i')}},
|
||||
|
|
@ -253,8 +263,9 @@ export default class SearchForm extends React.Component {
|
|||
}
|
||||
}
|
||||
if (rarityList.length > 0) {
|
||||
creatureResults = creatureResults.find({'gsx$rarity': {'$or': rarityList} });
|
||||
attackResults = attackResults.find({'gsx$rarity': {'$or': rarityList} });
|
||||
battlegearResults = battlegearResults.find({'gsx$rarity': {'$or': rarityList} });
|
||||
creatureResults = creatureResults.find({'gsx$rarity': {'$or': rarityList} });
|
||||
mugicResults = mugicResults.find({'gsx$rarity': {'$or': rarityList} });
|
||||
}
|
||||
|
||||
|
|
@ -265,8 +276,9 @@ export default class SearchForm extends React.Component {
|
|||
}
|
||||
}
|
||||
if (setsList.length > 0) {
|
||||
creatureResults = creatureResults.find({'gsx$set': {'$or': setsList} });
|
||||
attackResults = attackResults.find({'gsx$set': {'$or': setsList} });
|
||||
battlegearResults = battlegearResults.find({'gsx$set': {'$or': setsList} });
|
||||
creatureResults = creatureResults.find({'gsx$set': {'$or': setsList} });
|
||||
mugicResults = mugicResults.find({'gsx$set': {'$or': setsList} });
|
||||
}
|
||||
|
||||
|
|
@ -331,20 +343,23 @@ export default class SearchForm extends React.Component {
|
|||
}
|
||||
|
||||
if (this.stones.unique.checked) {
|
||||
creatureResults = creatureResults.find({'gsx$unique': {'$gt': 0}});
|
||||
attackResults = attackResults.find({'gsx$unique': {'$gt': 0}});
|
||||
battlegearResults = battlegearResults.find({'gsx$unique': {'$gt': 0}});
|
||||
creatureResults = creatureResults.find({'gsx$unique': {'$gt': 0}});
|
||||
mugicResults = mugicResults.find({'gsx$unique': {'$gt': 0}});
|
||||
}
|
||||
|
||||
if (this.stones.loyal.checked) {
|
||||
creatureResults = creatureResults.find({'gsx$loyal': {'$gt': 0}});
|
||||
attackResults = attackResults.find({'gsx$loyal': {'$gt': 0}});
|
||||
battlegearResults = battlegearResults.find({'gsx$loyal': {'$gt': 0}});
|
||||
creatureResults = creatureResults.find({'gsx$loyal': {'$gt': 0}});
|
||||
mugicResults = mugicResults.find({'gsx$unique': {'$gt': 0}});
|
||||
}
|
||||
|
||||
if (this.stones.legendary.checked) {
|
||||
creatureResults = creatureResults.find({'gsx$legendary': {'$gt': 0}});
|
||||
attackResults = attackResults.find({'gsx$legendary': {'$gt': 0}});
|
||||
battlegearResults = battlegearResults.find({'gsx$legendary': {'$gt': 0}});
|
||||
creatureResults = creatureResults.find({'gsx$legendary': {'$gt': 0}});
|
||||
mugicResults = mugicResults.find({'gsx$unique': {'$gt': 0}});
|
||||
}
|
||||
|
||||
|
|
@ -354,6 +369,11 @@ export default class SearchForm extends React.Component {
|
|||
temp.forEach(function(v){ delete v.$loki });
|
||||
filter.insert(temp);
|
||||
}
|
||||
if (!this.type || this.type=="Battlegear") {
|
||||
let temp = battlegearResults.data();
|
||||
temp.forEach(function(v){ delete v.$loki });
|
||||
filter.insert(temp);
|
||||
}
|
||||
if (!this.type || this.type=="Creature") {
|
||||
let temp = creatureResults.data()
|
||||
temp.forEach(function(v){ delete v.$loki });
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user