mirror of
https://github.com/chaoticbackup/chaoticbackup.github.io.git
synced 2026-04-25 07:53:06 -05:00
fix portal type not switching
This commit is contained in:
parent
d18604ded5
commit
8a45c08e44
File diff suppressed because one or more lines are too long
|
|
@ -11,25 +11,22 @@ import { sortCardName, thumb_link } from './common';
|
||||||
export default class Category extends React.Component {
|
export default class Category extends React.Component {
|
||||||
@observable loaded = false;
|
@observable loaded = false;
|
||||||
|
|
||||||
constructor(props) {
|
|
||||||
super(props);
|
|
||||||
this.type = props.type.toLowerCase();
|
|
||||||
}
|
|
||||||
|
|
||||||
scrollLeft(amount) {
|
scrollLeft(amount) {
|
||||||
document.getElementsByClassName('bottom_nav')[0].scrollLeft = (amount);
|
document.getElementsByClassName('bottom_nav')[0].scrollLeft = (amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const type = this.props.type.toLowerCase();
|
||||||
|
|
||||||
if (this.loaded == false) {
|
if (this.loaded == false) {
|
||||||
API.LoadDB([{ 'cards': this.type }, { 'portal': this.type }])
|
API.LoadDB([{ 'cards': type }, { 'portal': type }])
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.loaded = true;
|
this.loaded = true;
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
return (<Loading />);
|
return (<Loading />);
|
||||||
}
|
}
|
||||||
|
|
||||||
let base_path = true;
|
let base_path = true;
|
||||||
let cat_title = "";
|
let cat_title = "";
|
||||||
let top_content = (<div />);
|
let top_content = (<div />);
|
||||||
|
|
@ -39,7 +36,7 @@ export default class Category extends React.Component {
|
||||||
if (path[path.length-1] == "") path.pop(); // Remove trailing backslash
|
if (path[path.length-1] == "") path.pop(); // Remove trailing backslash
|
||||||
|
|
||||||
// ** Process the tribe ** //
|
// ** Process the tribe ** //
|
||||||
if (this.type == "creatures" || this.type == "mugic") {
|
if (type == "creatures" || type == "mugic") {
|
||||||
// /portal/Creatures/
|
// /portal/Creatures/
|
||||||
// /portal/Creatures/{Tribe}
|
// /portal/Creatures/{Tribe}
|
||||||
// The first / gets counted
|
// The first / gets counted
|
||||||
|
|
@ -69,9 +66,9 @@ export default class Category extends React.Component {
|
||||||
);
|
);
|
||||||
|
|
||||||
bottom_nav = ((tribe) ?
|
bottom_nav = ((tribe) ?
|
||||||
API.portal[this.type].chain().find({ 'gsx$tribe': tribe }).data()
|
API.portal[type].chain().find({ 'gsx$tribe': tribe }).data()
|
||||||
:
|
:
|
||||||
API.portal[this.type].chain().data()
|
API.portal[type].chain().data()
|
||||||
)
|
)
|
||||||
.sort(sortCardName)
|
.sort(sortCardName)
|
||||||
.map((card_portal, i) => {
|
.map((card_portal, i) => {
|
||||||
|
|
@ -91,14 +88,14 @@ export default class Category extends React.Component {
|
||||||
|
|
||||||
cat_title = this.props.type;
|
cat_title = this.props.type;
|
||||||
|
|
||||||
bottom_nav = API.portal[this.type].data
|
bottom_nav = API.portal[type].data
|
||||||
.sort(sortCardName)
|
.sort(sortCardName)
|
||||||
.map((val, i) => thumb_link(val, i));
|
.map((val, i) => thumb_link(val, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (base_path) {
|
if (base_path) {
|
||||||
return (
|
return (
|
||||||
<div className={`entry ${this.type} base_path`}>
|
<div className={`entry ${type} base_path`}>
|
||||||
<div className="cat_title">{cat_title}</div>
|
<div className="cat_title">{cat_title}</div>
|
||||||
<div className="entry_nav">{bottom_nav}</div>
|
<div className="entry_nav">{bottom_nav}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -106,7 +103,7 @@ export default class Category extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`entry ${this.type}`}>
|
<div className={`entry ${type}`}>
|
||||||
<div className="entry_content">{top_content}</div>
|
<div className="entry_content">{top_content}</div>
|
||||||
<div className="cat_title"><Link to={`/portal/${this.props.type}`}>{cat_title}</Link></div>
|
<div className="cat_title"><Link to={`/portal/${this.props.type}`}>{cat_title}</Link></div>
|
||||||
<div className="entry_nav">{bottom_nav}</div>
|
<div className="entry_nav">{bottom_nav}</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user