diff --git a/src/components/MeritsAndSatflow.svelte b/src/components/MeritsAndSatflow.svelte new file mode 100644 index 0000000..9453b12 --- /dev/null +++ b/src/components/MeritsAndSatflow.svelte @@ -0,0 +1,44 @@ + + + + Merits and Satflow + +
+ This graph displays the Meritization of equity in {rocket.getMatchingTags('d')[0][1]} + +
+
+ + + + Participant + + Sats Received + + + + + +
Liam Johnson
+ +
+ + 250k +
+
+
+
+
+
+ + +
\ No newline at end of file diff --git a/src/components/Pie.svelte b/src/components/Pie.svelte index 2d5f66e..ec004ab 100644 --- a/src/components/Pie.svelte +++ b/src/components/Pie.svelte @@ -3,7 +3,7 @@ const options = { series: [35.1, 23.5, 2.4, 5.4], - colors: ['#1C64F2', '#16BDCA', '#FDBA8C', '#E74694'], + colors: ['#9b1c1c', '#16BDCA', '#FDBA8C', '#E74694'], chart: { height: 320, width: '100%', @@ -84,21 +84,23 @@ } } }; + +// +//
+//
+//
+//
Merit Distribution
+ + +//
+//
+ +//
+//
- -
-
-
-
Merit Distribution
- - -
-
-
- -
\ No newline at end of file + \ No newline at end of file diff --git a/src/components/ProductCard.svelte b/src/components/ProductCard.svelte index 60e56a0..9608931 100644 --- a/src/components/ProductCard.svelte +++ b/src/components/ProductCard.svelte @@ -1,12 +1,7 @@ + + + + Products and Purchases + +
+ +
+
+ +
+
+
+ + +
\ No newline at end of file diff --git a/src/components/ProductPurchases.svelte b/src/components/ProductPurchases.svelte index c744366..1d2c346 100644 --- a/src/components/ProductPurchases.svelte +++ b/src/components/ProductPurchases.svelte @@ -1,11 +1,13 @@ @@ -31,32 +86,47 @@ }}>{z.id}
{/each} - +{#each $newZaps as [id, zapReceipt]}{/each} + + Purchases - Purchase history for {product.ID} + Purchase history for {productEvent?.getMatchingTags('name')[0][1]} Buyer - - Amount + + - - -
Liam Johnson
- -
- - $250.00 -
+ {#each $newZaps as [id, zapReceipt]} + + +
+ + +
+
+ + {unixToRelativeTime(zapReceipt.created_at*1000)} +
+ {/each}
diff --git a/src/components/ProductsForRocket.svelte b/src/components/ProductsForRocket.svelte index 4df52e4..963f710 100644 --- a/src/components/ProductsForRocket.svelte +++ b/src/components/ProductsForRocket.svelte @@ -1,12 +1,9 @@ - + + 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) + } + + +
-
-
-
- - - Your Orders - - Introducing Our Dynamic Orders Dashboard for Seamless Management and - Insightful Analysis. - - - - - - - - - This Week - $1329 - - -
+25% from last week
-
- - - -
- - - This Month - $5,329 - - -
+10% from last month
-
- - - -
-
- -
- - Week - Month - Year - -
- - - - - - Filter by - - - Fulfilled - - Declined - Refunded - - - -
-
- - - - Orders - Recent orders from your store. - - - - - - Customer - - - - Amount - - - - - -
Liam Johnson
- -
- - - - $250.00 -
- - -
Olivia Smith
- -
- - - - $150.00 -
- - -
Noah Williams
- -
- - - - $350.00 -
- - -
Emma Brown
- -
- - - - $450.00 -
- - -
Liam Johnson
- -
- - - - $250.00 -
- - -
Liam Johnson
- -
- - - - $250.00 -
- - -
Olivia Smith
- -
- - - - $150.00 -
- - -
Emma Brown
- -
- - - - $450.00 -
-
-
-
-
-
-
-
-
- - -
- - Order Oe31b70H - - - Date: November 23, 2023 -
-
- - - - - - - Edit - Export - - Trash - - -
-
- -
-
Order Details
-
    -
  • - - Glimmer Lamps x 2 - - $250.00 -
  • -
  • - - Aqua Filters x 1 - - $49.00 -
  • -
- -
    -
  • - Subtotal - $299.00 -
  • -
  • - Shipping - $5.00 -
  • -
  • - Tax - $25.00 -
  • -
  • - Total - $329.00 -
  • -
-
- -
-
-
Shipping Information
-
- Liam Johnson - 1234 Main St. - Anytown, CA 12345 -
-
-
-
Billing Information
-
Same as shipping address
-
-
- -
-
Customer Information
-
-
-
Customer
-
Liam Johnson
-
-
-
Email
-
- liam@acme.com -
-
-
-
Phone
-
- +1 234 567 890 -
-
-
-
- -
-
Payment Information
-
-
-
- - Visa -
-
**** **** **** 4532
-
-
-
-
- -
- Updated -
- - - - - - - - - - -
-
-
+ class="grid flex-1 items-start gap-4 p-4 sm:px-6 sm:py-0 md:gap-8 lg:grid-cols-3 xl:grid-cols-3" + > + + + {#each $products as product} + + {/each}
diff --git a/src/lib/helpers.ts b/src/lib/helpers.ts index 040f649..ceeccdf 100644 --- a/src/lib/helpers.ts +++ b/src/lib/helpers.ts @@ -19,4 +19,34 @@ export function getMission(rocketEvent:NDKEvent):string { return rocketEvent.getMatchingTags('mission')[0][1] } return "" -} \ No newline at end of file +} + + +export function unixToRelativeTime(timestamp: number): string { + const currentTime = Date.now(); + const secondsAgo = Math.floor((currentTime - timestamp) / 1000); + + if (secondsAgo < 60) { + return `${secondsAgo} seconds ago`; + } else if (secondsAgo < 3600) { + const minutesAgo = Math.floor(secondsAgo / 60); + return `${minutesAgo} minute${minutesAgo === 1 ? '' : 's'} ago`; + } else if (secondsAgo < 86400) { + const hoursAgo = Math.floor(secondsAgo / 3600); + return `${hoursAgo} hour${hoursAgo === 1 ? '' : 's'} ago`; + } else if (secondsAgo < 604800) { + const daysAgo = Math.floor(secondsAgo / 86400); + return `${daysAgo} day${daysAgo === 1 ? '' : 's'} ago`; + } else { + const formattedDate = new Date(timestamp).toLocaleString('en-US', { + weekday: 'short', + year: 'numeric', + month: 'short', + day: 'numeric', + hour: '2-digit', + minute: '2-digit', + hour12: true + }); + return formattedDate; + } + } \ No newline at end of file diff --git a/src/routes/rockets/[ignition]/+page.svelte b/src/routes/rockets/[ignition]/+page.svelte index 85429d3..eb4771a 100644 --- a/src/routes/rockets/[ignition]/+page.svelte +++ b/src/routes/rockets/[ignition]/+page.svelte @@ -9,10 +9,8 @@ import Heading from '../../../components/Heading.svelte'; import ProductCard from '../../../components/ProductCard.svelte'; import ProductsForRocket from '../../../components/ProductsForRocket.svelte'; - import Subheading from '../../../components/Subheading.svelte'; - import Todo from '../../../components/Todo.svelte'; - import EmptyList from '../../../components/EmptyList.svelte'; import RocketDashboard from '../../../components/RocketDashboard.svelte'; + import Todo from '../../../components/Todo.svelte'; //flow if we only have a d-tag: fetch all 31108's with this d-tag, sort by WoT, put Nostrocket Name Service one at the top. Dedupe same rocket (same state, shadows) from multiple users, just show them all as everyone agreeing. //second pass: fetch ignition event for each, rebuild current state and validate all proofs, compute votepower and display only the states with > 50%.