mirror of
https://github.com/aljazceru/hypergolic.git
synced 2026-02-19 12:24:19 +01:00
problem: product fetching logic more complicated than it needs to be
This commit is contained in:
@@ -1,24 +1,13 @@
|
||||
<script lang="ts">
|
||||
import * as Card from '$lib/components/ui/card/index.js';
|
||||
import { RocketProduct } from '@/event_helpers/rockets';
|
||||
import { Rocket } from '@/event_helpers/rockets';
|
||||
import type { NDKEvent } from '@nostr-dev-kit/ndk';
|
||||
import ProductCardFromId from './ProductCardFromID.svelte';
|
||||
import ProductPurchases from './ProductPurchases.svelte';
|
||||
import { writable, type Writable } from 'svelte/store';
|
||||
|
||||
//export let product:RocketProduct;
|
||||
export let rocket: NDKEvent;
|
||||
let products = new Rocket(rocket).Products()
|
||||
|
||||
let products: Writable<RocketProduct[]> = 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);
|
||||
}
|
||||
</script>
|
||||
|
||||
<Card.Root class="sm:col-span-3">
|
||||
@@ -27,7 +16,7 @@
|
||||
<Card.Description></Card.Description>
|
||||
</Card.Header>
|
||||
<Card.Content class="grid grid-cols-1 gap-2">
|
||||
{#each $products as product (product.ID)}
|
||||
{#each products as product (product.ID)}
|
||||
<div>
|
||||
<ProductCardFromId {rocket} productID={product.ID}>
|
||||
<ProductPurchases {rocket} {product} />
|
||||
|
||||
@@ -11,7 +11,6 @@ export class Rocket {
|
||||
for (let p of this.Event.getMatchingTags('product')) {
|
||||
_products.push(new RocketProduct(p));
|
||||
}
|
||||
console.log(_products)
|
||||
return _products
|
||||
}
|
||||
VotePowerForPubkey(pubkey: string): number {
|
||||
|
||||
Reference in New Issue
Block a user