1
0
Fork 0

add support for product variant from Packstack. Add 2024 bikepacking gearlist

This commit is contained in:
Gustav Lindqvist 2024-01-31 07:52:33 +01:00
parent 9c3d280028
commit 6b34e01065
3 changed files with 7 additions and 7 deletions

View File

@ -24,7 +24,7 @@ module.exports = {
metaString = ` <span class="pack__list-item__bottom-right secondary">Förbrukningsvara</span>`;
}
if (typeof item.item.brand !== 'undefined' && item.item.brand !== null) {
packList += `<li class="pack__list-item"><span class="pack__list-item__left secondary">${quantity}st</span> <span class="pack__list-item__bottom secondary">${item.item.name}<span class="sr-only">.</span></span> <span class="pack__list-item__middle"><span class="light">${(typeof item.item.brand !== 'undefined' && item.item.brand !== null) ? item.item.brand.name : ''}</span> <span class="bold">${(typeof item.item.product !== 'undefined' && item.item.product !== null) ? item.item.product.name : ''}</span><span class="sr-only">.</span></span> <span class="pack__list-item__right">${prettyDigits(item.item.weight * quantity)}g</span>${metaString}</li>`;
packList += `<li class="pack__list-item"><span class="pack__list-item__left secondary">${quantity}st</span> <span class="pack__list-item__bottom secondary">${item.item.name}<span class="sr-only">.</span></span> <span class="pack__list-item__middle"><span class="light">${(typeof item.item.brand !== 'undefined' && item.item.brand !== null) ? item.item.brand.name : ''}</span> <span class="bold">${(typeof item.item.product !== 'undefined' && item.item.product !== null) ? item.item.product.name : ''}${(typeof item.item.product_variant !== 'undefined' && item.item.product_variant !== null) ? ' '+item.item.product_variant.name : ''}</span><span class="sr-only">.</span></span> <span class="pack__list-item__right">${prettyDigits(item.item.weight * quantity)}g</span>${metaString}</li>`;
} else {
packList += `<li class="pack__list-item"><span class="pack__list-item__left secondary">${quantity}st</span> <span class="pack__list-item__middle bold">${item.item.name}<span class="sr-only">.</span></span> <span class="pack__list-item__bottom secondary">${(item.item.notes) ? item.item.notes : ''}<span class="sr-only">.</span></span> <span class="pack__list-item__right">${prettyDigits(item.item.weight * quantity)}g</span>${metaString}</li>`;
}
@ -83,7 +83,7 @@ module.exports = {
metaString = ` <span class="pack__list-item__bottom-right secondary">Förbrukningsvara</span>`;
}
if (typeof item.item.brand !== 'undefined' && item.item.brand !== null) {
packList += `<li class="pack__list-item"><span class="pack__list-item__left secondary">${quantity}st</span> <span class="pack__list-item__bottom secondary">${item.item.name}<span class="sr-only">.</span></span> <span class="pack__list-item__middle"><span class="light">${(typeof item.item.brand !== 'undefined' && item.item.brand !== null) ? item.item.brand.name : ''}</span> <span class="bold">${(typeof item.item.product !== 'undefined' && item.item.product !== null) ? item.item.product.name : ''}</span><span class="sr-only">.</span></span> <span class="pack__list-item__right">${prettyDigits(item.item.weight * quantity)}g</span>${metaString}</li>`;
packList += `<li class="pack__list-item"><span class="pack__list-item__left secondary">${quantity}st</span> <span class="pack__list-item__bottom secondary">${item.item.name}<span class="sr-only">.</span></span> <span class="pack__list-item__middle"><span class="light">${(typeof item.item.brand !== 'undefined' && item.item.brand !== null) ? item.item.brand.name : ''}</span> <span class="bold">${(typeof item.item.product !== 'undefined' && item.item.product !== null) ? item.item.product.name : ''}${(typeof item.item.product_variant !== 'undefined' && item.item.product_variant !== null) ? ' '+item.item.product_variant.name : ''}</span><span class="sr-only">.</span></span> <span class="pack__list-item__right">${prettyDigits(item.item.weight * quantity)}g</span>${metaString}</li>`;
} else {
packList += `<li class="pack__list-item"><span class="pack__list-item__left secondary">${quantity}st</span> <span class="pack__list-item__middle bold">${item.item.name}<span class="sr-only">.</span></span> <span class="pack__list-item__bottom secondary">${(item.item.notes) ? item.item.notes : ''}<span class="sr-only">.</span></span> <span class="pack__list-item__right">${prettyDigits(item.item.weight * quantity)}g</span>${metaString}</li>`;
}

View File

@ -58,7 +58,7 @@ module.exports = async () => {
const getPack = async (packId, shareId) => {
let pack = {};
const packUrl = `https://api.packstack.io/pack/trip/${packId}`
const packUrl = `https://api.packstack.io/pack/trip/${packId}`;
try {
const rawPackData = await fetch(packUrl, {
duration: "1s",
@ -66,7 +66,7 @@ module.exports = async () => {
directory: ".cache",
});
const packData = rawPackData[0]
const packData = rawPackData[0];
const categories = [];
@ -141,7 +141,7 @@ module.exports = async () => {
pack.name = packData.title;
pack.id = packData.id;
pack.contents = categories;
pack.shareLink = `https://packstack.io/pack/${shareId}`
pack.shareLink = `https://packstack.io/pack/${shareId}`;
console.log('[' + '\x1b[34m%s\x1b[0m', 'Packstack' + '\x1b[0m' + ']:', 'Grabbed pack:', packData.title, '(' + packUrl + ')');
@ -157,6 +157,7 @@ module.exports = async () => {
packstack.summer_2022 = await getPack('369', 'dc516757-bc41-4304-a29e-5dadc9dcf50e');
packstack.summer_2023 = await getPack('367', '5f4edc0b-ddca-4a64-a97f-ee313f66e6bd');
packstack.bikepacking_2023 = await getPack('370', '10c47671-c9f4-414e-b07d-2d796eb1c3e0');
packstack.bikepacking_2024 = await getPack('657', 'a087099c-4873-4249-8cd6-df985831de2a');
packstack.big_camera_kit = await getPack('372', '12baa3b2-8104-4c26-9532-acb721f05240');
packstack.small_camera_kit = await getPack('371', 'c8848465-155d-4b9e-ac99-ddf43d8cbdbb');

View File

@ -19,5 +19,4 @@ Min bikepacking-utrustning för sommaren 2023 med en basvikt på {{ packstack.bi
Kitet kommer göras om i grunden på grund av byte av cykel med flera nya väskor m.m.
- [ ] Ortlieb Quick Rack Pakethållare bak som klarar 20kg
- [ ] Sea to Summit Dry River 20L Nya huvudväskan, ersätter både sadelväskan och styrväskan. Är tänkt att surras ovanpå pakethållaren bak.
{% pack packstack.bikepacking_2024 %}