Skip to content

Commit

Permalink
problem: can't see merit request solution text
Browse files Browse the repository at this point in the history
  • Loading branch information
gsovereignty committed Aug 14, 2024
1 parent 15ffdb1 commit da3bd4a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 4 deletions.
10 changes: 8 additions & 2 deletions src/components/MeritSummaryCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -118,9 +119,9 @@
<div class="flex flex-nowrap justify-between">
<Card.Title>
{merit.Problem().split('\n')[0]}
</Card.Title>{#if merit.Solution()}<a
</Card.Title>{#if merit.SolutionURL()}<a
class="flex flex-nowrap text-orange-500 underline decoration-orange-500"
href={merit.Solution()}>View Solution <ExternalLink size={18} class="m-1" /></a
href={merit.SolutionURL()}>View Solution <ExternalLink size={18} class="m-1" /></a
>{/if}
</div>
<div class="flex flex-nowrap">
Expand All @@ -131,7 +132,12 @@
/>
<Name ndk={$ndk} pubkey={merit.Pubkey} class="inline-block max-w-32 truncate p-2" />
</div>
{#if merit.SolutionText()}
{merit.SolutionText()?.trim()}
{/if}
<Card.Description></Card.Description>
</Card.Header>

<Card.Content class="p-6 text-sm">
<div class="grid gap-3">
<div class="font-semibold">Merit Request Details</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/VoteOnMeritRequest.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
.then((x) => {
console.log(x);
if (direction === 'ratify') {
let content = `I've voted to ratify your merit request! ${merit.Problem()} \n\n ${merit.Solution() ? merit.Solution() : ''}`;
let content = `I've voted to ratify your merit request! ${merit.Problem()} \n\n ${merit.SolutionURL() ? merit.SolutionURL() : ''}`;
prepareMeritNoteEvent({
ndk,
merit,
Expand Down
11 changes: 10 additions & 1 deletion src/lib/event_helpers/merits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class MeritRequest {
}
return _problem;
}
Solution(): URL | undefined {
SolutionURL(): URL | undefined {
let _solution: URL | undefined = undefined;
for (let solution of this.Event.getMatchingTags('solution')) {
if (solution && solution.length > 2 && solution[1] == 'url') {
Expand All @@ -34,6 +34,15 @@ export class MeritRequest {
}
return _solution;
}
SolutionText(): string | undefined {
let _solution: string | undefined = undefined;
for (let solution of this.Event.getMatchingTags('solution')) {
if (solution && solution.length > 2 && solution[1] == 'text') {
_solution = solution[2];
}
}
return _solution;
}
IncludedInRocketState(rocket: Rocket): boolean {
let included = rocket.ApprovedMeritRequests();
return Boolean(included.get(this.ID));
Expand Down

0 comments on commit da3bd4a

Please sign in to comment.