This commit is contained in:
Dominic Ferrando
2025-09-21 21:01:38 -04:00
parent b3253425e3
commit 4f395e9a7c
9 changed files with 530 additions and 377 deletions
+3 -3
View File
@@ -19,9 +19,9 @@
<input id="sidebar" type="checkbox" class="drawer-toggle" />
<div class="drawer-content p-10 flex flex-col items-center">
{@render children?.()}
<label for="sidebar" class="btn btn-primary drawer-button lg:hidden">
Open drawer
</label>
<!-- <label for="sidebar" class="btn btn-primary drawer-button lg:hidden"> -->
<!-- Open drawer -->
<!-- </label> -->
</div>
<div class="drawer-side">
<label for="sidebar" aria-label="close sidebar" class="drawer-overlay"
+2 -21
View File
@@ -2,30 +2,11 @@ import { Printful } from '$lib/services/commerce/printful';
import { Webflow } from '$lib/services/commerce/webflow';
import type { PageServerLoad } from './$types';
const productsStore = {
cache: {
printful: undefined as Printful.Products.SyncProduct["sync_product"][] | undefined,
webflow: undefined as Webflow.Products.Product[] | undefined,
},
getPrintfulProducts: async () => {
if (!productsStore.cache.printful) {
productsStore.cache.printful = await Printful.Products.getAll()
}
return productsStore.cache.printful;
},
getWebflowProducts: async () => {
if (!productsStore.cache.webflow) {
productsStore.cache.webflow = await Webflow.Products.getAll()
}
return productsStore.cache.webflow;
}
};
export const load = async ({ }: Parameters<PageServerLoad>[0]) => {
return {
products: {
printful: productsStore.getPrintfulProducts(),
webflow: productsStore.getWebflowProducts(),
printful: Printful.Products.getAll(),
webflow: Webflow.Products.getAll(),
}
};
};
+3 -3
View File
@@ -1,16 +1,16 @@
<script lang="ts">
import { Printful } from "$lib/services/commerce/printful.js";
import { Printful } from "$lib/services/commerce/printful";
const { data } = $props();
let isSyncing = $state(false);
const isPrintfulProductSynced = async (
printfulProduct: Printful.Products.SyncProduct["sync_product"],
printfulProduct: Printful.Products.SyncProduct,
) => {
const webflowProducts = await data.products.webflow;
return webflowProducts.some(
(p) => p.id === printfulProduct.external_id,
(p) => p.product.id === printfulProduct.external_id,
);
};