mirror of
https://github.com/chaoticbackup/chaoticbackup.github.io.git
synced 2026-08-21 16:14:37 -05:00
improve non-loyal; improve portal search
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -63,6 +63,7 @@ export default class SearchForm extends React.Component {
|
||||
|
||||
const card_tribes = (
|
||||
<div>
|
||||
<div>Tribes</div>
|
||||
<input type="checkbox" ref={(input) => this.tribes.danian = input}/><img className="icon16" src={"/src/img/icons/tribes/danian.png"} />
|
||||
<input type="checkbox" ref={(input) => this.tribes.mipedian = input}/><img className="icon16" src={"/src/img/icons/tribes/mipedian.png"} />
|
||||
<input type="checkbox" ref={(input) => this.tribes.overworld = input}/><img className="icon16" src={"/src/img/icons/tribes/overworld.png"} />
|
||||
@@ -74,6 +75,7 @@ export default class SearchForm extends React.Component {
|
||||
|
||||
const card_elements = (
|
||||
<div>
|
||||
<div>Elements</div>
|
||||
<input type="checkbox" ref={(input) => this.elements.fire = input} /><img className="icon16" src={"/src/img/icons/elements/fire.png"} />
|
||||
<input type="checkbox" ref={(input) => this.elements.air = input}/><img className="icon16" src={"/src/img/icons/elements/air.png"} />
|
||||
<input type="checkbox" ref={(input) => this.elements.earth = input}/><img className="icon16" src={"/src/img/icons/elements/earth.png"} />
|
||||
@@ -87,6 +89,7 @@ export default class SearchForm extends React.Component {
|
||||
|
||||
const card_disciplines = (
|
||||
<div className="disciplines">
|
||||
<div>Disciplines</div>
|
||||
<input type="text" ref={(input) => this.stones.courage = input} /><img className="icon20" style={{verticalAlign: 'bottom'}} src={"/src/img/icons/disciplines/courage.png"} />
|
||||
<input type="text" ref={(input) => this.stones.power = input} /><img className="icon20" style={{verticalAlign: 'bottom'}} src={"/src/img/icons/disciplines/power.png"} />
|
||||
<input type="text" ref={(input) => this.stones.wisdom = input} /><img className="icon20" style={{verticalAlign: 'bottom'}} src={"/src/img/icons/disciplines/wisdom.png"} />
|
||||
@@ -98,21 +101,19 @@ export default class SearchForm extends React.Component {
|
||||
<div className="SearchForm">
|
||||
<form onSubmit={this.search}>
|
||||
<br />
|
||||
<label>Name: <input type="text" ref={(input) => this.stones.name = input} /></label>
|
||||
<label>Name <input type="text" ref={(input) => this.stones.name = input} /></label>
|
||||
<br />
|
||||
<label>Text: <input type="text" ref={(input) => this.stones.text = input} /></label>
|
||||
<label>Text <input type="text" ref={(input) => this.stones.text = input} /></label>
|
||||
<br />
|
||||
<div>
|
||||
<label>Subtypes | Initiative:<br />
|
||||
<label>Subtypes | Initiative<br />
|
||||
<input type="text" ref={(input) => this.stones.subtypes = input} />
|
||||
</label><br />
|
||||
<label><input type="checkbox" ref={(input) => this.stones.past = input}/>Past</label>
|
||||
<label><input type="checkbox" ref={(input) => this.stones.mirage = input}/>Mirage</label>
|
||||
</div>
|
||||
<br />
|
||||
<label>Types:</label>
|
||||
{card_types}
|
||||
<br />
|
||||
<Collapsible trigger="Types">{card_types}</Collapsible>
|
||||
{card_tribes}
|
||||
<br />
|
||||
{card_elements}
|
||||
@@ -126,7 +127,8 @@ export default class SearchForm extends React.Component {
|
||||
</div>
|
||||
<br />
|
||||
<div>
|
||||
<span>Mugic Counters/Cost | Build Points</span><br />
|
||||
<span>Mugic Counters/Cost
|
||||
<br />Build Points</span><br />
|
||||
<label>Min: <input type="text" style={{width: '30px'}} ref={(input) => this.mc.min = input} /></label>
|
||||
<label>Max: <input type="text" style={{width: '30px'}} ref={(input) => this.mc.max = input} /></label>
|
||||
</div>
|
||||
@@ -134,8 +136,9 @@ export default class SearchForm extends React.Component {
|
||||
<div>
|
||||
<label><input type="checkbox" ref={(input) => this.stones.unique = input}/>Unique</label>
|
||||
<label><input type="checkbox" ref={(input) => this.stones.loyal = input}/>Loyal</label>
|
||||
<label><input type="checkbox" ref={(input) => this.stones.mixed = input}/>Mixed</label>
|
||||
<label><input type="checkbox" ref={(input) => this.stones.legendary = input}/>Legendary</label>
|
||||
<br />
|
||||
<label><input type="checkbox" ref={(input) => this.stones.mixed = input}/>Non-Loyal</label>
|
||||
</div>
|
||||
<br />
|
||||
<Collapsible trigger="Rarity">{card_rarity}</Collapsible>
|
||||
@@ -375,14 +378,19 @@ export default class SearchForm extends React.Component {
|
||||
}
|
||||
|
||||
if (this.stones.loyal.checked) {
|
||||
attackResults = attackResults.find({'gsx$loyal': {'$gt': 0}});
|
||||
attackResults = attackResults.limit(0);
|
||||
battlegearResults = battlegearResults.find({'gsx$loyal': {'$gt': 0}});
|
||||
creatureResults = creatureResults.find({'gsx$loyal': {'$gt': 0}});
|
||||
mugicResults = mugicResults.find({'gsx$loyal': {'$gt': 0}});
|
||||
mugicResults = mugicResults.limit(0);
|
||||
locationResults = locationResults.limit(0);
|
||||
}
|
||||
|
||||
if (this.stones.mixed.checked) {
|
||||
attackResults = attackResults.limit(0);
|
||||
creatureResults = creatureResults.find({'gsx$loyal': {'$lte': 0}});
|
||||
battlegearResults = battlegearResults.find({'gsx$loyal': {'$lte': 0}});
|
||||
mugicResults = mugicResults.limit(0);
|
||||
locationResults = locationResults.limit(0);
|
||||
}
|
||||
|
||||
if (this.stones.legendary.checked) {
|
||||
|
||||
@@ -66,7 +66,7 @@ class DBSearch extends React.Component {
|
||||
|
||||
// No search
|
||||
if (string == "") {
|
||||
return (<div></div>);
|
||||
return (<div style={{minHeight: '50px'}}></div>);
|
||||
}
|
||||
|
||||
let filter = this.filter.addCollection('filter');
|
||||
@@ -81,7 +81,6 @@ class DBSearch extends React.Component {
|
||||
|
||||
// Attributes Background Details
|
||||
attackResults = attackResults.find({'$or': [
|
||||
{'gsx$name': {'$regex': new RegExp(string, 'i')}},
|
||||
{'gsx$attributes': {'$regex': new RegExp(string, 'i')}},
|
||||
{'gsx$background': {'$regex': new RegExp(string, 'i')}},
|
||||
{'gsx$details': {'$regex': new RegExp(string, 'i')}}
|
||||
@@ -89,14 +88,12 @@ class DBSearch extends React.Component {
|
||||
|
||||
// Attributes Background Details
|
||||
battlegearResults = battlegearResults.find({'$or': [
|
||||
{'gsx$name': {'$regex': new RegExp(string, 'i')}},
|
||||
{'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$name': {'$regex': new RegExp(string, 'i')}},
|
||||
{'gsx$appearance': {'$regex': new RegExp(string, 'i')}},
|
||||
{'gsx$background': {'$regex': new RegExp(string, 'i')}},
|
||||
{'gsx$specialabilities': {'$regex': new RegExp(string, 'i')}},
|
||||
@@ -104,14 +101,12 @@ class DBSearch extends React.Component {
|
||||
]});
|
||||
// Local Features Background Details
|
||||
locationResults = locationResults.find({'$or': [
|
||||
{'gsx$name': {'$regex': new RegExp(string, 'i')}},
|
||||
{'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$name': {'$regex': new RegExp(string, 'i')}},
|
||||
{'gsx$background': {'$regex': new RegExp(string, 'i')}},
|
||||
{'gsx$details': {'$regex': new RegExp(string, 'i')}}
|
||||
]});
|
||||
@@ -141,7 +136,7 @@ class DBSearch extends React.Component {
|
||||
let results = pview.data();
|
||||
this.filter.removeCollection('filter');
|
||||
|
||||
let content = results.map((card, i) => {
|
||||
let makeLink = (card, i) => {
|
||||
let link = "/portal";
|
||||
|
||||
switch (card.gsx$type) {
|
||||
@@ -165,14 +160,28 @@ class DBSearch extends React.Component {
|
||||
return (<div key={i}><Interactive as={Link} {...s.link} to={link}>
|
||||
{card.gsx$name}
|
||||
</Interactive><br /></div>);
|
||||
});
|
||||
};
|
||||
|
||||
let content = results.map(makeLink);
|
||||
|
||||
// This prioritizes names in the results
|
||||
attackResults = API.portal.attacks.find({'gsx$name': {'$regex': new RegExp(string, 'i')}});
|
||||
battlegearResults = API.portal.battlegear.find({'gsx$name': {'$regex': new RegExp(string, 'i')}});
|
||||
creatureResults = API.portal.creatures.find({'gsx$name': {'$regex': new RegExp(string, 'i')}});
|
||||
locationResults = API.portal.locations.find({'gsx$name': {'$regex': new RegExp(string, 'i')}});
|
||||
mugicResults = API.portal.mugic.find({'gsx$name': {'$regex': new RegExp(string, 'i')}});
|
||||
|
||||
let names = [].concat(attackResults, battlegearResults, creatureResults, locationResults, mugicResults).map(makeLink);
|
||||
|
||||
if (results.length == 0) {
|
||||
content = (<div>No Results Found</div>);
|
||||
}
|
||||
|
||||
return (<div className="results">
|
||||
<div>Results containing {string}:</div><br />
|
||||
<br />
|
||||
{names}
|
||||
<hr />
|
||||
<div>Results containing {string}:</div>
|
||||
{content}
|
||||
</div>);
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@
|
||||
}
|
||||
|
||||
.search .results div {
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.search .results a {
|
||||
|
||||
Reference in New Issue
Block a user