Skip to content

Commit

Permalink
update donate page
Browse files Browse the repository at this point in the history
  • Loading branch information
toddwords committed Nov 19, 2024
1 parent 82e5b39 commit 32d2118
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 31 deletions.
61 changes: 31 additions & 30 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -859,44 +859,45 @@ app.get("/fundraiser/winter-23/:slug", async (req, res) => {

app.get("/donate", async (req, res) => {

const responseTest = await getDatabaseEntries("16ea90c83765437c86f87bd13a205ca6", [{property:"Date", direction:"descending"}])
const testimonialData = responseTest.map((testimonial) => {
console.log(testimonial)
return parseTestimonials(testimonial)
})
console.log(testimonialData)
// const responseTest = await getDatabaseEntries("16ea90c83765437c86f87bd13a205ca6", [{property:"Date", direction:"descending"}])
// const testimonialData = responseTest.map((testimonial) => {
// console.log(testimonial)
// return parseTestimonials(testimonial)
// })
// console.log(testimonialData)

const response = await getDatabaseEntries(NOTION_STORE_DATABASE_ID, [
{ property: "Name", direction: "descending" },
]);
console.log(response);
// const response = await getDatabaseEntries(NOTION_STORE_DATABASE_ID, [
// { property: "Name", direction: "descending" },
// ]);
// console.log(response);

const productsData = response.map((product) => {
return parseProductData(product);
});
// const productsData = response.map((product) => {
// return parseProductData(product);
// });

const shopifyData = await getShopifyProducts();
// const shopifyData = await getShopifyProducts();

for (const product of productsData) {
const shopifyId = product["Shopify ID"];
// for (const product of productsData) {
// const shopifyId = product["Shopify ID"];

if (!shopifyId) {
continue;
}
// if (!shopifyId) {
// continue;
// }

const node = shopifyData[`gid://shopify/Product/${shopifyId}`];
// const node = shopifyData[`gid://shopify/Product/${shopifyId}`];

if (node) {
product.availableForSale = node.availableForSale;
product.totalInventory = node.totalInventory;
product.availableInventory = node.variants.edges.reduce((accum, val) => {
return accum + val.node.quantityAvailable;
}, 0);
}
}
// if (node) {
// product.availableForSale = node.availableForSale;
// product.totalInventory = node.totalInventory;
// product.availableInventory = node.variants.edges.reduce((accum, val) => {
// return accum + val.node.quantityAvailable;
// }, 0);
// }
// }

console.log(productsData);
res.render("donate/storefront", { products: productsData, testimonials: testimonialData });
// console.log(productsData);
// res.render("donate/storefront", { products: productsData, testimonials: testimonialData });
res.render("donate/storefront");
});


Expand Down
Binary file added public/images/donate/donate.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion public/templates/donate/storefront.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@
<!-- <h4 class="type"><a href="#"></a></h4> -->
<h1>Support School for Poetic Computation!</h1>
<div class="break-noline-small hide-desk"></div>
<img style="margin:1vw; max-height:450px; " src="/images/community/IOTBGU_Project.jpg" />
<img style="margin:1vw; max-height:450px; " src="/images/donate/donate.jpg" />



Expand Down

0 comments on commit 32d2118

Please sign in to comment.