This commit is contained in:
Daniel 2017-12-28 17:47:04 -05:00
parent 74bd1a7148
commit 3909320cdc
4 changed files with 137 additions and 25 deletions

File diff suppressed because one or more lines are too long

View File

@ -40,7 +40,6 @@ export default class Attacks extends React.Component {
const output = attacks.map((attack, i) => {
const card_data = store.cards.attacks.findOne({'gsx$name': attack.gsx$name});
console.log(attack, card_data);
return (
<div key={i}>
<Interactive as={Link} {...s.link}

View File

@ -10,10 +10,48 @@ import UnderConstruction from '../../UnderConstruction';
@inject((stores, props, context) => props) @observer
export default class Battlegear extends React.Component {
render() {
if (this.props.children) {
return (<div>{this.props.children}</div>);
}
return (<UnderConstruction location={this.props.location}/>);
}
render() {
if (this.props.children) {
return (<div>{this.props.children}</div>);
}
const store = API;
let path = this.props.location.pathname.split("/");
if (path[path.length-1] == "") path.pop(); // Remove trailing backslash
if (store.urls === null ||
store.portal === null ||
store.cards === null) {
return (<span>Loading...</span>);
}
if (!store.cards.built.includes("battlegear_cards")) {
store.cards.setupBattlegear("cards");
return (<span>Loading...</span>);
}
if (!store.portal.built.includes("battlegear_portal")) {
store.portal.setupBattlegear("portal");
return (<span>Loading...</span>);
}
const battlegear = store.portal.battlegear.data;
const output = battlegear.map((single_battlegear, i) => {
const card_data = store.cards.battlegear.findOne({'gsx$name': single_battlegear.gsx$name});
return (
<div key={i}>
<Interactive as={Link} {...s.link}
to={'/portal/Battlegear/'+single_battlegear.gsx$name}
>
<span>{single_battlegear.gsx$name}</span><br />
<img className="thumb" src={store.base_image + card_data.gsx$thumb}></img>
</Interactive>
</div>
);
});
return (<div>{output}</div>);
}
}

View File

@ -10,7 +10,82 @@ import UnderConstruction from '../../UnderConstruction';
@inject((stores, props, context) => props) @observer
export default class SingleBattlegear extends React.Component {
render() {
return (<UnderConstruction location={this.props.location}/>);
}
render() {
const store = API;
let path = this.props.location.pathname.split("/");
if (path[path.length-1] == "") path.pop(); // Remove trailing backslash
// Path too long
if ( path.length !== 4 ) {
return(<PageNotFound location={this.props.location}/>);
}
let name = decodeURIComponent(path[3]);
if (store.urls === null ||
store.portal === null ||
store.cards === null) {
return (<span>Loading...</span>);
}
if (!store.cards.built.includes("battlegear_cards")) {
store.cards.setupBattlegear("cards");
return (<span>Loading...</span>);
}
if (!store.portal.built.includes("battlegear_portal")) {
store.portal.setupBattlegear("portal");
return (<span>Loading...</span>);
}
const battlegear = store.portal.battlegear.findOne({'gsx$name': name});
if (!battlegear) {
return(<PageNotFound location={this.props.location}/>);
}
const card_data = store.cards.battlegear.findOne({'gsx$name': name});
return (
<div className={"battlegear"}>
<h1>{battlegear.gsx$name}</h1>
<img className="splash" src={store.base_image + card_data.gsx$splash}></img>
<hr />
<div>
<strong>Attributes:</strong><br />
{battlegear.gsx$attributes}
</div>
<hr />
<div>
<strong>Background:</strong><br />
{battlegear.gsx$background}
</div>
<hr />
<div>
<strong>Card Flavor:</strong><br />
{card_data.gsx$flavortext}
</div>
<hr />
<div>
<strong>Details:</strong><br />
{battlegear.gsx$details}
</div>
<hr />
<div>
<strong>Card ID: </strong>
{card_data.gsx$id}
</div>
<hr />
<div>
<strong>Set: </strong>
{card_data.gsx$set}
</div>
<hr />
<div>
<strong>Rarity: </strong>
{card_data.gsx$rarity}
</div>
</div>
);
}
}