diff --git a/src/components/CreateNewProduct.svelte b/src/components/CreateNewProduct.svelte index fa5ceb6..020e3b4 100644 --- a/src/components/CreateNewProduct.svelte +++ b/src/components/CreateNewProduct.svelte @@ -48,7 +48,7 @@ - Create a Product + Propose a New Product 5 < 20", "description length > 20", "image url resolves and is image"]} /> {#if !currentUser} diff --git a/src/components/ProductFomo.svelte b/src/components/ProductFomo.svelte index 84b484b..732d57d 100644 --- a/src/components/ProductFomo.svelte +++ b/src/components/ProductFomo.svelte @@ -1,30 +1,40 @@ + let products: Writable = writable([]); + + $: { + //fetch products from rocket and populate a store of them + let _products: RocketProduct[] = []; + for (let p of rocket.getMatchingTags('product')) { + _products.push(new RocketProduct(p)); + } + products.set(_products); + } + - - Products and Purchases - -
- -
-
- -
-
-
- - -
\ No newline at end of file + + Products and Purchases + + {#each $products as product} +
+ +
+
+ +
+ {/each} +
+
+ + diff --git a/src/components/ProductPurchases.svelte b/src/components/ProductPurchases.svelte index 1d2c346..8247430 100644 --- a/src/components/ProductPurchases.svelte +++ b/src/components/ProductPurchases.svelte @@ -79,15 +79,6 @@ //todo: validate zaps against product, publish store of all successful payments including those already in rocket. Publish another store with successful payments that are not yet included in rocket state so we can update the state and republish. -{#each $zaps as z} { - console.log(z.rawEvent()); - }}>{z.id}
{/each} - -{#each $newZaps as [id, zapReceipt]}{/each} - Purchases @@ -106,7 +97,7 @@ {#each $newZaps as [id, zapReceipt]} - + {console.log(getZapRequest(zapReceipt)?.rawEvent())}} class=" bg-red-800">
+ import { ndk } from '@/ndk'; + import type { NDKEvent } from '@nostr-dev-kit/ndk'; + import { onDestroy } from 'svelte'; + import ProductCard from './ProductCard.svelte'; + import { derived } from 'svelte/store'; + + export let rocket: NDKEvent; + + let proposals = $ndk.storeSubscribe( + [ + { '#a': [`31108:${rocket.author.pubkey}:${rocket.dTag}`], kinds: [1908 as number] } + ], + { subId: rocket.dTag } + ); + + onDestroy(()=>{ + proposals.unsubscribe() + }) + + let unratified = derived(proposals, ($proposals)=>{ + return $proposals.filter((p)=>{ + let found = false; + for (let product of rocket.getMatchingTags("product")){ + if (product[1].split(":")[0] == p.id) { + found = true + } + } + return !found + }) + }) + + +{#each $unratified as r}{/each} diff --git a/src/components/RocketDashboard.svelte b/src/components/RocketDashboard.svelte index 1f6b84d..0100390 100644 --- a/src/components/RocketDashboard.svelte +++ b/src/components/RocketDashboard.svelte @@ -1,57 +1,60 @@ - - let products: Writable = writable([]) +
+
+ +
+
+ - $: { - //fetch products from rocket and populate a store of them - let _products:RocketProduct[] = [] - for (let p of rocket.getMatchingTags("product")) { - _products.push(new RocketProduct(p)) - } - products.set(_products) - } + - - + - -
-
- - -
-
- - - {#each $products as product} - - {/each} -
-
- - \ No newline at end of file + +
+
diff --git a/src/routes/rockets/[ignition]/+page.svelte b/src/routes/rockets/[ignition]/+page.svelte index eb4771a..d13d47f 100644 --- a/src/routes/rockets/[ignition]/+page.svelte +++ b/src/routes/rockets/[ignition]/+page.svelte @@ -92,16 +92,16 @@ {#if latestRocketEvent && $latestRocketEvent} +{:else} + + IGNITION: {rIgnitionOrActual}
+ NAME: {rName}
+ PUBKEY: {rPubkey}
{/if} {#if latestRocketEvent && $latestRocketEvent && false} - +

{$latestRocketEvent.getMatchingTags('d')[0][1].toLocaleUpperCase()} Products @@ -122,9 +122,4 @@

{#each $candidateProducts as r}{/each} -{:else} - - IGNITION: {rIgnitionOrActual}
- NAME: {rName}
- PUBKEY: {rPubkey}
{/if}