diff --git a/README.md b/README.md index 49126d6..6a7838e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,17 @@ # Hypergolic -A nostrocket client +A nostr client that implements the nostrocket [NIPS](https://github.com/nostrocket/NIPS). + +## Developing + +```bash +npm install + +npm run dev + +# or start the server and open the app in a new browser tab +npm run dev -- --open +``` ## Pull Requests @@ -12,6 +23,8 @@ Pull request should contain only ONE commit that solves exactly ONE problem. The The commit message MUST be a short summary of the problem being solved, usually this should be the same as title of the problem from the github or nostrocket issue tracker. +Do not send pull requests unless they are ready to merge, no "work in progress" pull requests. + ## Style Guide Avoid uneccessary whitespace changes. Whitespace changes make it difficult to see what code was really changed. @@ -22,25 +35,8 @@ https://www.shadcn-svelte.com/docs ## Getting Paid -If you want to get paid for working on this project, demonstrate your capability by solving some problems and adhering to the instructions in this readme. After you have 2-3 PR's merged, DM gsovereignty on nostr to have a conversation about paid work. +Once your pull request has been merged, go to nostrocket.org and submit a Merit Request. -## Developing +Upon your Merit Request being approved by the existing contributors to Nostrocket, you will be able to sell your Approved Merit Request (there are people wanting to buy these for sats). -`npm install` - -```bash -npm run dev - -# or start the server and open the app in a new browser tab -npm run dev -- --open -``` - -## Building - -To create a production version of your app: - -```bash -npm run build -``` - -You can preview the production build with `npm run preview`. +Ask in the Telegram group or on Nostr if you need help or have questions. diff --git a/src/components/AssociateBitcoinAddress.svelte b/src/components/AssociateBitcoinAddress.svelte index a71c424..0850d4c 100644 --- a/src/components/AssociateBitcoinAddress.svelte +++ b/src/components/AssociateBitcoinAddress.svelte @@ -10,10 +10,29 @@ import validate from 'bitcoin-address-validation'; import type { Rocket } from '@/event_helpers/rockets'; import { derived } from 'svelte/store'; + import { onDestroy } from 'svelte'; + import type { NDKEventStore, ExtendedBaseType } from '@nostr-dev-kit/ndk-svelte'; let bitcoinAddress: string; export let rocket: Rocket; + let associations: NDKEventStore> | undefined = undefined; + + $: { + if ($currentUser && !associations) { + associations = $ndk.storeSubscribe( + [{ authors: [$currentUser.pubkey], kinds: [1413 as number] }], + { + subId: `1413-${$currentUser.pubkey}` + } + ); + } + } + + onDestroy(() => { + associations?.unsubscribe(); + }); + let associatedAddresses = derived(currentUser, ($currentUser) => { let addresses: Set = new Set(); if ($currentUser) { @@ -40,6 +59,7 @@ let event = new NDKEvent($ndk); event.kind = 1413; event.tags.push(['onchain', address]); + event.tags.push(rocket.ATag()); //todo: let user specify a rocket console.log('todo: let user specify a rocket'); event @@ -63,13 +83,23 @@ their Merits. Merit purchases must be conducted with a Bitcoin address that is associated with your pubkey, otherwise you will not recieve the Merits upon payment. - {#if $associatedAddresses.size == 0}You do not have any registered addresses{:else} - Your registered addresses: + {#if ($associatedAddresses.size == 0 && !associations) || (associations && $associations.length == 0)}You + do not have any registered addresses{:else if associations && $associations && $associations.length > 0} +

Pending Additions

+ + {:else} +

Your registered addresses

+ {/if} - Add a new address now +

Add a new address now

+
-
+ - {#if wts} +
- + {#if $currentUser} + + {:else} + + {/if} +{#if $currentUser} + + + Inbox + 1 + + +{/if} Rockets - - - Problem Tracker - 6 - Products - + + + Problem Tracker + + + + + + + + Source + + + + Telegram Group + + + + Help diff --git a/src/components/MeritRequests.svelte b/src/components/MeritRequests.svelte index 41211d7..bcf9fd3 100644 --- a/src/components/MeritRequests.svelte +++ b/src/components/MeritRequests.svelte @@ -13,6 +13,7 @@ import { Avatar, Name } from '@nostr-dev-kit/ndk-svelte-components'; import { onDestroy } from 'svelte'; import { derived, writable } from 'svelte/store'; + import CreateMeritRequest from './CreateMeritRequest.svelte'; //export let rocket: NDKEvent; export let rocket: Rocket; // = new Rocket(rocket); @@ -92,11 +93,12 @@ - + Merit Requests Merit Requests + diff --git a/src/components/MeritSummaryCard.svelte b/src/components/MeritSummaryCard.svelte index 296d1ca..e26d574 100644 --- a/src/components/MeritSummaryCard.svelte +++ b/src/components/MeritSummaryCard.svelte @@ -19,6 +19,7 @@ import { Alert } from '@/components/ui/alert'; import { currentUser } from '@/stores/session'; import MeritComment from './MeritComment.svelte'; + import { Description } from 'formsnap'; export let merit: MeritRequest; //export let rocket: NDKEvent; @@ -26,7 +27,7 @@ let result: VoteDirection | undefined; - export let parsedRocket:Rocket; + export let parsedRocket: Rocket; let _votes = $ndk.storeSubscribe( { '#a': [RocketATagFilter(parsedRocket.Event)], '#e': [merit.ID], kinds: [1410 as NDKKind] }, @@ -52,7 +53,7 @@ } $: referenceTime = cuckPrice - ? formatReferenceTime(((merit.Sats / 100000000) * cuckPrice) / 70) + ? formatReferenceTime(((merit.Sats / 100000000) * cuckPrice) / 50) : '...'; let votes = derived(_votes, ($_votes) => { @@ -118,9 +119,9 @@
@@ -131,87 +132,101 @@ />
- -
-
Merit Request Details
-
    -
  • - Number of Merits being requested - {merit.Merits.toLocaleString()} -
  • -
  • - - Value in Sats at the time the request was made - - {merit.Sats.toLocaleString()} -
  • -
  • - - Approximate value of {merit.Sats.toLocaleString()} sats in CuckLoserBucks - - ${cuckPrice ? ((merit.Sats / 100000000) * cuckPrice).toFixed(2) : 'Loading'} -
  • -
- -
-
-
Analysis
- - A competent freelance developer earns $70 CuckLoserBucks an hour (on average). Using - this rate, the contributor is claiming to have spent about {referenceTime} working on this. - -
-
-
Reference Time
-
{referenceTime}
-
-
- -
Votes
- {#if $votes.size == 0}Waiting for existing {parsedRocket.Name()} Merit - holders to vote - {/if} - - - {#each $votes as [id, vote], _ (id)} - { - console.log(vote.Event.rawEvent()); - }} - class="cursor-pointer {vote.VoteDirection == 'ratify' - ? 'bg-lime-600' - : 'bg-red-700'} {vote.VoteDirection == 'ratify' - ? 'hover:bg-lime-700' - : 'hover:bg-red-800'}" - > - -
- - -
-
- - {unixToRelativeTime(vote.TimeStamp * 1000)} -
- {/each} -
-
-
+ {#if merit.SolutionText()} + {merit.SolutionText()?.trim()} + {/if} + + + +
+
Merit Request Details
+
    +
  • + Number of Merits being requested + {merit.Merits.toLocaleString()} +
  • +
  • + + Value in Sats at the time the request was made + + {merit.Sats.toLocaleString()} +
  • +
  • + + Approximate value of {merit.Sats.toLocaleString()} sats in CuckLoserBucks + + ${cuckPrice ? ((merit.Sats / 100000000) * cuckPrice).toFixed(2) : 'Loading'} +
  • +
+ +
+
+
Analysis
+ +

+ To make it easier to compare the value of each contribution we normalize the hourly + rate to $50 CuckLoserBucks an hour. +

+

+ At this rate, the contributor is claiming to have worked for {referenceTime} solving this + problem. +

+
+
+
+
Reference Time
+
{referenceTime}
+
+
+ +
Votes
+ {#if $votes.size == 0}Waiting for existing {parsedRocket.Name()} Merit holders + to vote + {/if} + + + {#each $votes as [id, vote], _ (id)} + { + console.log(vote.Event.rawEvent()); + }} + class="cursor-pointer {vote.VoteDirection == 'ratify' + ? 'bg-lime-600' + : 'bg-red-700'} {vote.VoteDirection == 'ratify' + ? 'hover:bg-lime-700' + : 'hover:bg-red-800'}" + > + +
+ + +
+
+ + {unixToRelativeTime(vote.TimeStamp * 1000)} +
+ {/each} +
+
+
+ console.log(merit.Event.rawEvent())} + >print to console
+ {#if merit.IncludedInRocketState(parsedRocket)} APPROVED diff --git a/src/components/NotifyMe.svelte b/src/components/NotifyMe.svelte index 9243b79..86104bc 100644 --- a/src/components/NotifyMe.svelte +++ b/src/components/NotifyMe.svelte @@ -10,20 +10,19 @@ import { currentUser } from '@/stores/session'; import Login from './Login.svelte'; import { NDKPrivateKeySigner, NDKUser } from '@nostr-dev-kit/ndk'; + import { TelegramBrand } from 'svelte-awesome-icons'; - let email: string; + let email: string = ''; + let fax: string = ''; $: emailInValid = true; - $: emailError = ''; + $: emailError = 'Email is invalid'; const emailRegex = /^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$/; - $: if (email) { - if (!emailRegex.test(email)) { - emailInValid = true; - emailError = 'Email is invalid'; - } else { - emailInValid = false; - emailError = ''; - } + $: { + emailError = emailRegex.test(email) ? '' : 'Email is invalid'; + } + $: { + emailInValid = emailRegex.test(email) ? false : true; } async function Subscribe() { @@ -84,14 +83,15 @@ variant="nostr" class="flex h-8 shrink-0 items-center justify-center rounded-sm" > - Nostrocket is totally not ready yet but whatever + u r so early Subscribe for Updates - Subscribe now and we'll ping you when there are new releases/features + Nostrocket is under active development, many things are broken. Subscribe now and we'll ping + you when there are new releases and new features.
{#if $currentUser} @@ -101,19 +101,32 @@ {/if} If you don't use nostr, you can subscribe to updates with an email address insteadIf you don't use nostr, that's SAD! Whatever, I guess we can fax you or email you or + something
- {#if emailError} + +
+ + +
+ {#if fax.length > 0} + {/if}
{emailError ? emailError : "I'm lame, please email me with updates"} + + + Join the Telegram Group +
diff --git a/src/components/ProductFomo.svelte b/src/components/ProductFomo.svelte index 35e0fbf..5e4818d 100644 --- a/src/components/ProductFomo.svelte +++ b/src/components/ProductFomo.svelte @@ -5,6 +5,8 @@ import { ndk } from '@/ndk'; import { derived, writable } from 'svelte/store'; import ProductGroup from './ProductGroup.svelte'; + import CreateNewProduct from './CreateNewProduct.svelte'; + import CreateMeritRequest from './CreateMeritRequest.svelte'; export let rocket: Rocket; export let unratifiedZaps: Map; @@ -51,10 +53,11 @@ Products and Purchases + {#each $groups as [identifier, products] (identifier)} {/each} - + diff --git a/src/components/RocketDashboard.svelte b/src/components/RocketDashboard.svelte index 822ff33..115cfef 100644 --- a/src/components/RocketDashboard.svelte +++ b/src/components/RocketDashboard.svelte @@ -2,17 +2,15 @@ import * as Breadcrumb from '$lib/components/ui/breadcrumb/index.js'; import Button from '@/components/ui/button/button.svelte'; import * as Card from '@/components/ui/card'; + import { Rocket } from '@/event_helpers/rockets'; import type { NDKEvent } from '@nostr-dev-kit/ndk'; - import CreateMeritRequest from './CreateMeritRequest.svelte'; - import CreateNewProduct from './CreateNewProduct.svelte'; + import BitcoinAssociations from './AssociatedBitcoinAddresses.svelte'; import MeritRequests from './MeritRequests.svelte'; import MeritsAndSatflow from './MeritsAndSatflow.svelte'; import ProductFomo from './ProductFomo.svelte'; import ProposedProducts from './ProposedProducts.svelte'; import Todo from './Todo.svelte'; import UpdateMission from './UpdateMission.svelte'; - import { Rocket } from '@/event_helpers/rockets'; - import BitcoinAssociations from './BitcoinAssociations.svelte'; export let rocket: NDKEvent; @@ -47,8 +45,6 @@ Actions - -