-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2ea6104
commit ca583ae
Showing
4 changed files
with
101 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,45 @@ | ||
<script lang="ts"> | ||
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'; | ||
import ProductCard from './ProductCard.svelte'; | ||
import { Product, type Rocket } from '@/event_helpers/rockets'; | ||
import * as Card from '@/components/ui/card'; | ||
export let rocket: NDKEvent; | ||
export let rocket: Rocket; | ||
let proposals = $ndk.storeSubscribe( | ||
[{ '#a': [`31108:${rocket.author.pubkey}:${rocket.dTag}`], kinds: [1908 as number] }], | ||
{ subId: rocket.dTag } | ||
[ | ||
{ | ||
'#a': [`31108:${rocket.Event.author.pubkey}:${rocket.Event.dTag}`], | ||
kinds: [1908 as number] | ||
} | ||
], | ||
{ subId: rocket.Name() } | ||
); | ||
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; | ||
$proposals = $proposals.filter((p) => { | ||
return Boolean(!rocket.Products().get(p.id)); | ||
}); | ||
let products = new Map<string, Product>(); | ||
for (let p of $proposals) { | ||
products.set(p.id, new Product(p)); | ||
} | ||
return products; | ||
}); | ||
</script> | ||
|
||
{#each $unratified as r (r.id)}<ProductCard {rocket} product={r} />{/each} | ||
{#if $unratified.size > 0} | ||
<Card.Root> | ||
<Card.Header>PROPOSED PRODUCTS</Card.Header> | ||
<Card.Content> | ||
TODO: make this look better | ||
{#each $unratified as [_, product] (product.ID())}<ProductCard {rocket} {product} />{/each} | ||
</Card.Content> | ||
</Card.Root> | ||
{/if} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters