fix links not working in portal

This commit is contained in:
Daniel 2020-10-26 10:17:37 -04:00
parent 6c5017a516
commit bc3cb96ee7
4 changed files with 7 additions and 6 deletions

File diff suppressed because one or more lines are too long

View File

@ -93,7 +93,7 @@ export default class Category extends React.Component {
bottom_nav = API.portal[this.type].data
.sort(sortCardName)
.map(thumb_link);
.map((val, i) => thumb_link(val, i));
}
if (base_path) {

View File

@ -31,6 +31,7 @@ export function text_link (card: Card, i: number) {
export function thumb_link (portalCard: Card, i: number, url?: string) {
let collectionCard: Card | null = null;
console.log(portalCard, i, url);
if (["Attacks", "Battlegear", "Creatures", "Locations", "Mugic"].includes(portalCard.gsx$type)) {
if (!url) url = `/portal/${portalCard.gsx$type}/${portalCard.gsx$name}`;
collectionCard = API.cards[portalCard.gsx$type.toLowerCase()].findOne({ 'gsx$name': portalCard.gsx$name });

View File

@ -128,7 +128,7 @@ class DBSearch extends React.Component {
temp.forEach(function(v){ delete v.$loki });
filter.insert(temp);
let content = pview.data().map(text_link);
let content = pview.data().map((val, i) => text_link(val, i));
this.filter.removeCollection('filter');
let header;
@ -158,8 +158,8 @@ class DBSearch extends React.Component {
.where((obj) => {return (obj.gsx$splash != ('') )}).data()
)
.sort(sortCardName)
.map(thumb_link);
.map((val, i) => thumb_link(val, i));
// Check Artists
if (content.length == 0) {
const artists = [].concat(
@ -180,7 +180,7 @@ class DBSearch extends React.Component {
.where((obj) => {return (obj.gsx$splash != ('') )}).data()
)
.sort((a, b) => (a.gsx$name > b.gsx$name) ? 1 : -1)
.map(text_link);
.map((val, i) => text_link(val, i));
if (artists.length > 0) {
header = `Art contributed by ${string}:`;