Shorten printful/webflow naming convention

This commit is contained in:
Dominic Ferrando
2026-07-04 15:28:59 -04:00
parent afdc8de77c
commit a7b8dd0bea
7 changed files with 231 additions and 231 deletions
@@ -9,7 +9,7 @@
const synchronizer = $state({
status: "none" as SyncStatus,
syncingPrintfulProductIds: [] as number[],
syncingPProductIds: [] as number[],
get isInProgress() {
return this.status === "active" || this.status === "queued";
},
@@ -17,11 +17,11 @@
const res = await api.products.sync.get();
if (res.error) {
synchronizer.status = "none";
synchronizer.syncingPrintfulProductIds = [];
synchronizer.syncingPProductIds = [];
} else {
synchronizer.status = res.data.status;
synchronizer.syncingPrintfulProductIds =
res.data.syncingPrintfulProductIds;
synchronizer.syncingPProductIds =
res.data.syncingPProductIds;
}
},
startPolling: () => {
@@ -34,9 +34,9 @@
synchronizer.startPolling();
await api.products.sync.post();
},
sync: async (printfulProductId: number) => {
sync: async (pProductId: number) => {
synchronizer.startPolling();
await api.products.sync({ printfulProductId }).post();
await api.products.sync({ pProductId }).post();
},
});
@@ -48,18 +48,18 @@
});
const isProductSynced = async (
printfulProduct: Printful.Products.SyncProduct,
pProduct: Printful.Products.SyncProduct,
) => {
const webflowProducts = await data.products.webflow;
return webflowProducts.some(
(p) => p.product.id === printfulProduct.external_id.split("-")[0],
const wProducts = await data.products.webflow;
return wProducts.some(
(p) => p.product.id === pProduct.external_id.split("-")[0],
);
};
</script>
{#await data.products.printful}
<p>Loading...</p>
{:then printfulProducts}
{:then pProducts}
<button
disabled={synchronizer.isInProgress}
onclick={() => synchronizer.syncAll()}
@@ -81,27 +81,27 @@
</tr>
</thead>
<tbody>
{#each printfulProducts as printfulProduct}
{#each pProducts as pProduct}
<tr class="hover:bg-base-300">
<td
><button
onclick={async () => {
const res = await api
.products({
printfulProductId:
printfulProduct.id,
pProductId:
pProduct.id,
})
.get();
console.log(res.data);
}}
class="cursor-pointer underline"
>
{printfulProduct.name}
{pProduct.name}
</button></td
>
<td>
{#await isProductSynced(printfulProduct) then isSynced}
{#if synchronizer.syncingPrintfulProductIds.includes(printfulProduct.id)}
{#await isProductSynced(pProduct) then isSynced}
{#if synchronizer.syncingPProductIds.includes(pProduct.id)}
<div class="badge badge-warning">
Syncing...
</div>
@@ -120,7 +120,7 @@
<button
disabled={synchronizer.status === "active"}
onclick={() =>
synchronizer.sync(printfulProduct.id)}
synchronizer.sync(pProduct.id)}
class="btn"
>
Sync