diff --git a/src/components/ProductCard.svelte b/src/components/ProductCard.svelte
index 5a5240b..7c7550f 100644
--- a/src/components/ProductCard.svelte
+++ b/src/components/ProductCard.svelte
@@ -40,6 +40,12 @@
{:else}
{/if}
+ {
+ console.log(product);
+ }}>print to console
{/if}
diff --git a/src/components/ProductPurchases.svelte b/src/components/ProductPurchases.svelte
index 87b0fa7..b4ee3f0 100644
--- a/src/components/ProductPurchases.svelte
+++ b/src/components/ProductPurchases.svelte
@@ -11,12 +11,12 @@
//export let products: Product[];
export let rocket: Rocket;
- export let unratifiedZaps:Map; //todo upstream bind this and pass outstanding zaps to merits and satflow component.
+ export let unratifiedZaps: Map;
let zaps = $ndk.storeSubscribe(
[{ '#a': [`31108:${rocket.Event.author.pubkey}:${rocket.Event.dTag}`], kinds: [9735] }],
{
- subId: rocket.Name() + "_zaps"
+ subId: rocket.Name() + '_zaps'
}
);
@@ -24,22 +24,14 @@
zaps?.unsubscribe();
});
- // let productEvent: NDKEvent | undefined;
-
- // onMount(() => {
- // $ndk.fetchEvent(product.ID).then((e) => {
- // if (e) {
- // productEvent = e;
- // }
- // });
- // });
-
- function productsInclude(id:string) {
- let included = false
+ function productsInclude(id: string) {
+ let included = false;
for (let p of products) {
- if (p.ID() == id) {included = true}
+ if (p.ID() == id) {
+ included = true;
+ }
}
- return included
+ return included;
}
let validZaps = derived(zaps, ($zaps) => {
@@ -63,82 +55,85 @@
return zapMap;
});
- let validPubkeys = writable(new Set())
+ let validPubkeys = writable(new Set());
zapsNotInRocket.subscribe((z) => {
z.forEach((z) => {
ValidateZapPublisher(rocket.Event, z.ZapReceipt).then((result) => {
if (result) {
- validPubkeys.update(existing=>{
+ validPubkeys.update((existing) => {
existing.add(z.ZapReceipt.pubkey);
- return existing
- })
+ return existing;
+ });
}
});
});
});
- let validatedZapsNotInRocket = derived([zapsNotInRocket, validPubkeys], ([$zapsNotInRocket, $validPubkeys]) => {
- let zapMap = new Map();
- for (let [id, zap] of $zapsNotInRocket) {
- if ($validPubkeys.has(zap.ZapReceipt.pubkey)) {
- zapMap.set(id, zap);
+ let validatedZapsNotInRocket = derived(
+ [zapsNotInRocket, validPubkeys],
+ ([$zapsNotInRocket, $validPubkeys]) => {
+ let zapMap = new Map();
+ for (let [id, zap] of $zapsNotInRocket) {
+ if ($validPubkeys.has(zap.ZapReceipt.pubkey)) {
+ zapMap.set(id, zap);
+ }
}
+ return zapMap;
}
- return zapMap;
- });
+ );
- validatedZapsNotInRocket.subscribe(zaps=>{
+ validatedZapsNotInRocket.subscribe((zaps) => {
for (let [_, z] of zaps) {
- unratifiedZaps.set(z.ZapReceipt.id, z.Amount)
+ unratifiedZaps.set(z.ZapReceipt.id, z.Amount);
}
- unratifiedZaps = unratifiedZaps
- })
+ unratifiedZaps = unratifiedZaps;
+ });
//todo: get existing purchases from rocket and render them
//todo: update rocket event with confirmed zaps if we have votepower
-
- Purchases
-
-
- Buyer
- Sats Paid
-
-
-
-
- {#each $validatedZapsNotInRocket as [id, purchase], _ (id)}
- {
- console.log(purchase.ZapReceipt.rawEvent());
- }}
- class="bg-accent"
+
+ Purchases
+
+
+ Buyer
+ Sats Paid
+
+
+
+
+ {#each $validatedZapsNotInRocket as [id, purchase], _ (id)}
+ {
+ console.log(purchase.ZapReceipt.rawEvent());
+ }}
+ class="bg-accent"
+ >
+
+
+
+ {purchase.Amount / 1000}
+ {unixToRelativeTime(purchase.ZapReceipt.created_at * 1000)}
-
-
-
- {purchase.Amount / 1000}
- {unixToRelativeTime(purchase.ZapReceipt.created_at * 1000)}
-
- {/each}
-
-
+
+ {/each}
+
+
diff --git a/src/components/ProposedProducts.svelte b/src/components/ProposedProducts.svelte
index 839dc24..d60c4b0 100644
--- a/src/components/ProposedProducts.svelte
+++ b/src/components/ProposedProducts.svelte
@@ -1,15 +1,21 @@
-{#each $unratified as r (r.id)}{/each}
+{#if $unratified.size > 0}
+
+ PROPOSED PRODUCTS
+
+ TODO: make this look better
+ {#each $unratified as [_, product] (product.ID())}{/each}
+
+
+{/if}
diff --git a/src/components/RocketDashboard.svelte b/src/components/RocketDashboard.svelte
index 115cfef..08b897d 100644
--- a/src/components/RocketDashboard.svelte
+++ b/src/components/RocketDashboard.svelte
@@ -36,7 +36,7 @@
-
+