mirror of
https://github.com/aljazceru/hypergolic.git
synced 2025-12-18 22:14:21 +01:00
problem: can't include text in merit request solution
This commit is contained in:
@@ -12,11 +12,12 @@
|
||||
import type NDKSvelte from '@nostr-dev-kit/ndk-svelte';
|
||||
import { Terminal } from 'lucide-svelte';
|
||||
import Todo from './Todo.svelte';
|
||||
import { isValidUrl } from '@/event_helpers/rockets';
|
||||
import { isValidUrl, Rocket } from '@/event_helpers/rockets';
|
||||
import CalculateSats from './CalculateSats.svelte';
|
||||
import { isGitHubUrl, parseProblem } from '@/helpers';
|
||||
import Login from './Login.svelte';
|
||||
|
||||
export let rocketEvent: NDKEvent;
|
||||
export let rocket: Rocket;
|
||||
|
||||
let problem: string = '';
|
||||
let solution: string = '';
|
||||
@@ -78,17 +79,29 @@
|
||||
e.created_at = Math.floor(new Date().getTime() / 1000);
|
||||
e.tags.push(['problem', 'text', problem]);
|
||||
if (solution.length > 0) {
|
||||
e.tags.push(['solution', 'url', solution]);
|
||||
try {
|
||||
let url = new URL(solution);
|
||||
e.tags.push(['solution', 'url', url.toString()]);
|
||||
} catch {
|
||||
e.tags.push(['solution', 'text', solution]);
|
||||
}
|
||||
}
|
||||
e.tags.push(['a', `31108:${rocketEvent.pubkey}:${rocketEvent.dTag}`]);
|
||||
e.tags.push(['a', `31108:${rocket.Event.pubkey}:${rocket.Event.dTag}`]);
|
||||
e.tags.push(['merits', merits.toString(10)]);
|
||||
e.tags.push(['sats', sats]);
|
||||
console.log(e.rawEvent());
|
||||
e.publish().then((x) => {
|
||||
console.log(x);
|
||||
open = false;
|
||||
//goto(`${base}/rockets/${getRocketURL(e)}`);
|
||||
});
|
||||
e.publish()
|
||||
.then((x) => {
|
||||
console.log(x);
|
||||
console.log('todo: publish a kind 1 and tag the rocket and author');
|
||||
open = false;
|
||||
//goto(`${base}/rockets/${getRocketURL(e)}`);
|
||||
})
|
||||
.catch(() => {
|
||||
alert(
|
||||
"something went wrong, copy/paste your data and refresh then try again if you don't see your merit request in the rocket dashboard (we r so early, there will be blugs)"
|
||||
);
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -140,7 +153,7 @@
|
||||
<CalculateSats on:result={(event) => (sats = event.detail)} />
|
||||
</div>
|
||||
|
||||
<div class="flex items-center space-x-2">
|
||||
<!-- <div class="flex items-center space-x-2">
|
||||
<Checkbox id="sell" bind:checked={wts} aria-labelledby="terms-label" />
|
||||
<Label
|
||||
id="terms-label"
|
||||
@@ -149,9 +162,9 @@
|
||||
>
|
||||
I want Sats not Merits
|
||||
</Label>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
{#if wts}
|
||||
<!-- {#if wts}
|
||||
Your Merits will be auctioned to potential sponsors as soon as it is approved, enabling you
|
||||
to be paid in Sats for your work. Tip: you don't have to decide right now, you can do this
|
||||
at any time.
|
||||
@@ -160,15 +173,19 @@
|
||||
<Label for="sats" class="col-span-2 text-right">Auction Reserve Price (Sats)</Label>
|
||||
<Input bind:value={minimum} id="price" placeholder="Reserve Price" class="col-span-1" />
|
||||
</div>
|
||||
{/if}
|
||||
{/if} -->
|
||||
</div>
|
||||
<Dialog.Footer>
|
||||
<Button
|
||||
on:click={() => {
|
||||
publish($ndk);
|
||||
}}
|
||||
type="submit">Publish</Button
|
||||
>
|
||||
{#if $currentUser}
|
||||
<Button
|
||||
on:click={() => {
|
||||
publish($ndk);
|
||||
}}
|
||||
type="submit">Publish</Button
|
||||
>
|
||||
{:else}
|
||||
<Login />
|
||||
{/if}
|
||||
</Dialog.Footer>
|
||||
<Todo
|
||||
text={['remove white border on focus so that the validation indication color can be seen']}
|
||||
|
||||
@@ -12,6 +12,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);
|
||||
@@ -33,7 +34,7 @@
|
||||
_votes?.unsubscribe();
|
||||
});
|
||||
|
||||
let truncate = writable(true)
|
||||
let truncate = writable(true);
|
||||
|
||||
let merits = derived(_merits, ($merits) => {
|
||||
let map = new Map<string, MeritRequest>();
|
||||
@@ -96,6 +97,7 @@
|
||||
<Card.Description>Merit Requests</Card.Description>
|
||||
</Card.Header>
|
||||
<Card.Content>
|
||||
<CreateMeritRequest {rocket} />
|
||||
<Table.Root>
|
||||
<Table.Header>
|
||||
<Table.Row>
|
||||
@@ -138,13 +140,12 @@
|
||||
<Table.Cell class="hidden text-right md:table-cell"
|
||||
>{unixToRelativeTime(merit.TimeStamp * 1000)}</Table.Cell
|
||||
>
|
||||
|
||||
</Table.Row>
|
||||
{/each}
|
||||
{#if $merits.size > $meritsTruncated.length}
|
||||
<span
|
||||
on:click={() => {
|
||||
truncate.set(false)
|
||||
truncate.set(false);
|
||||
}}
|
||||
class="m-2 flex w-48 flex-nowrap text-lg"
|
||||
><Badge href="#">View {$merits.size - $meritsTruncated.length} more</Badge></span
|
||||
|
||||
@@ -26,7 +26,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 +52,7 @@
|
||||
}
|
||||
|
||||
$: referenceTime = cuckPrice
|
||||
? formatReferenceTime(((merit.Sats / 100000000) * cuckPrice) / 70)
|
||||
? formatReferenceTime(((merit.Sats / 100000000) * cuckPrice) / 50)
|
||||
: '...';
|
||||
|
||||
let votes = derived(_votes, ($_votes) => {
|
||||
@@ -158,8 +158,14 @@
|
||||
<div class="grid gap-3">
|
||||
<div class="font-semibold">Analysis</div>
|
||||
<span class="grid gap-0.5 not-italic text-muted-foreground">
|
||||
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.
|
||||
<p class="m-1 text-justify">
|
||||
To make it easier to compare the value of each contribution we normalize the hourly
|
||||
rate to $50 CuckLoserBucks an hour.
|
||||
</p>
|
||||
<p class="m-1 text-justify">
|
||||
At this rate, the contributor is claiming to have worked for {referenceTime} solving
|
||||
this problem.
|
||||
</p>
|
||||
</span>
|
||||
</div>
|
||||
<div class="grid auto-rows-max gap-3">
|
||||
@@ -170,8 +176,8 @@
|
||||
<Separator class="my-4" />
|
||||
<div class="font-semibold">Votes</div>
|
||||
{#if $votes.size == 0}<Alert
|
||||
><Info />Waiting for existing <span class="italic">{parsedRocket.Name()}</span> Merit
|
||||
holders to vote</Alert
|
||||
><Info />Waiting for existing <span class="italic">{parsedRocket.Name()}</span> Merit holders
|
||||
to vote</Alert
|
||||
>
|
||||
{/if}
|
||||
<Table.Root>
|
||||
@@ -221,6 +227,9 @@
|
||||
{:else if !result}
|
||||
<VoteOnMeritRequest {merit} rocket={parsedRocket} />
|
||||
{/if}
|
||||
<a href="#" class="text-xs" on:click={() => console.log(merit.Event.rawEvent())}
|
||||
>print to console</a
|
||||
>
|
||||
</Card.Footer>
|
||||
</Card.Root>
|
||||
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
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 BitcoinAssociations from './AssociatedBitcoinAddresses.svelte';
|
||||
import CreateNewProduct from './CreateNewProduct.svelte';
|
||||
import MeritRequests from './MeritRequests.svelte';
|
||||
import MeritsAndSatflow from './MeritsAndSatflow.svelte';
|
||||
@@ -11,8 +12,6 @@
|
||||
import ProposedProducts from './ProposedProducts.svelte';
|
||||
import Todo from './Todo.svelte';
|
||||
import UpdateMission from './UpdateMission.svelte';
|
||||
import { Rocket } from '@/event_helpers/rockets';
|
||||
import BitcoinAssociations from './AssociatedBitcoinAddresses.svelte';
|
||||
|
||||
export let rocket: NDKEvent;
|
||||
|
||||
@@ -50,7 +49,6 @@
|
||||
<Card.Description class="flex space-x-4">
|
||||
<UpdateMission rocketEvent={rocket} />
|
||||
<CreateNewProduct rocketEvent={rocket} />
|
||||
<CreateMeritRequest rocketEvent={rocket} />
|
||||
<Button
|
||||
on:click={() => {
|
||||
console.log(rocket.rawEvent());
|
||||
|
||||
Reference in New Issue
Block a user