Skip to content

Commit

Permalink
fix another bug with jam tracks in the shop
Browse files Browse the repository at this point in the history
  • Loading branch information
tposejank committed Jul 24, 2024
1 parent 6473d65 commit 30d864c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
2 changes: 1 addition & 1 deletion items/shop/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<div id="main">
<div class="shop-items-container" id="shop-container">
<script>
createItems()
initShop()
</script>
<div id="Section_OldShop" style="height: 100%; width: 100%;"></div>
</div>
Expand Down
25 changes: 21 additions & 4 deletions items/shop/js/item-shop.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
shopBasic = false;
jamTracks = undefined;
let registeredSections = [];
// Set the date we're counting down to
var today = new Date();
Expand Down Expand Up @@ -31,6 +32,14 @@ var x = setInterval(function() {

}, 500);

function initShop() {
let jamTrackURL = 'https://raw.githubusercontent.com/FNLookup/data/main/festival/jam_tracks.json'
fetch(jamTrackURL).then(jts => jts.json()).then(jts => {
jamTracks = jts;
createItems();
})
}

function createItems() {
let requestData = getRequestData('shop');
fetch(requestData.url, requestData.data).then(response => response.json()).then(response => {
Expand Down Expand Up @@ -152,7 +161,7 @@ function createItems() {
} else if (tileSize === "Size_1_x_2" || tileSize === "Normal") {
item['width'] = ((count == 4 || count == 2) ? 0.25 : count > 5 ? 0.2 : 0.2);
item['height'] = 1.0;
console.log(count, tileSize, item['name'])
//console.log(count, tileSize, item['name'])
} else if (tileSize === "Size_2_x_2") {
item['width'] = count === 2 ? 0.5 : count > 4 ? 0.4 : 0.5;
item['height'] = 1.0;
Expand All @@ -168,7 +177,7 @@ function createItems() {
}
}

console.log(categories_final)
//console.log(categories_final)

let shopContainer = document.getElementById('main')

Expand Down Expand Up @@ -328,7 +337,7 @@ function makeShopCard(item) {
}
}

console.log(item_props)
//console.log(item_props)

let parent = document.createElement('a');
parent.classList.add('item-card-parent');
Expand Down Expand Up @@ -392,7 +401,15 @@ function makeShopCard(item) {
type.classList.add("item-type");

let itype = item.displayType
if (item.mainId.startsWith('SID')) itype = 'Jam Track'
if (item.mainId.startsWith('SID')) {
itype = 'Jam Track'

viewTrack = jamTracks.tracks.find(track => track.item_id.toLowerCase().split(":")[1] == item.mainId.toLowerCase())
if (viewTrack != undefined) {
title.innerHTML = viewTrack.title;
itype = viewTrack.artist;
}
}

type.innerHTML = itype;
hold.appendChild(type);
Expand Down

0 comments on commit 30d864c

Please sign in to comment.