locations in portal close #8

This commit is contained in:
Daniel
2017-12-23 19:36:36 -05:00
parent a072b1d9a8
commit a23ba02a30
6 changed files with 110 additions and 22 deletions

File diff suppressed because one or more lines are too long

View File

@@ -11,6 +11,9 @@ import UnderConstruction from '../../UnderConstruction';
export default class Attacks extends React.Component {
render() {
if (this.props.children) {
return (<div>{this.props.children}</div>);
}
return (<UnderConstruction location={this.props.location}/>);
}
}

View File

@@ -11,6 +11,9 @@ import UnderConstruction from '../../UnderConstruction';
export default class Battlegear extends React.Component {
render() {
if (this.props.children) {
return (<div>{this.props.children}</div>);
}
return (<UnderConstruction location={this.props.location}/>);
}
}

View File

@@ -11,6 +11,9 @@ import UnderConstruction from '../../UnderConstruction';
export default class Locations extends React.Component {
render() {
if (this.props.children) {
return (<div>{this.props.children}</div>);
}
return (<UnderConstruction location={this.props.location}/>);
}
}

View File

@@ -5,12 +5,91 @@ import API from '../../SpreadsheetData';
import s from '../../../styles/app.style';
import {observer, inject} from 'mobx-react';
import PageNotFound from '../../PageNotFound';
import UnderConstruction from '../../UnderConstruction';
@inject((stores, props, context) => props) @observer
export default class SingleLocation 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("locations_cards")) {
store.cards.setupLocations("cards");
return (<span>Loading...</span>);
}
if (!store.portal.built.includes("locations_portal")) {
store.portal.setupLocations("portal");
return (<span>Loading...</span>);
}
const location = store.portal.locations.findOne({'gsx$name': name});
if (!location) {
return(<PageNotFound location={this.props.location}/>);
}
const card_data = store.cards.locations.findOne({'gsx$name': name});
return (
<div className={"location"}>
<h1>{location.gsx$name}</h1>
<img className="splash" src={store.base_image + card_data.gsx$splash}></img>
<hr />
<div>
<strong>Local Features:</strong><br />
{location.gsx$appearance}
</div>
<hr />
<div>
<strong>Background:</strong><br />
{location.gsx$background}
</div>
<hr />
<div>
<strong>Card Flavor:</strong><br />
{card_data.gsx$flavortext}
</div>
<hr />
<div>
<strong>Details:</strong><br />
{location.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>
<hr />
<div>
<strong>Location Initiative: </strong>
{card_data.gsx$initiative}
</div>
</div>
);
}
}

View File

@@ -23,13 +23,13 @@ import CollectionHome from './components/collection/Home';
import PortalBase from './components/portal/Base';
import PortalHome from './components/portal/Home';
import Attacks from './components/portal/Category/Attacks';
import SingleAttack from './components/portal/Category/Attacks';
import SingleAttack from './components/portal/Single/Attack';
import Battlegear from './components/portal/Category/Battlegear';
import SingleBattlegear from './components/portal/Category/Battlegear';
import SingleBattlegear from './components/portal/Single/Battlegear';
import Creatures from './components/portal/Category/Creatures';
import SingleCreature from './components/portal/Single/Creature';
import Locations from './components/portal/Category/Locations';
import SingleLocation from './components/portal/Category/Locations';
import SingleLocation from './components/portal/Single/Location';
import Mugic from './components/portal/Category/Mugic';
import SingleMugic from './components/portal/Single/Mugic';
import Tribes from './components/portal/Category/Tribes';