Skip to content

Commit

Permalink
problem: not clear that problem text is loading
Browse files Browse the repository at this point in the history
  • Loading branch information
gsovereignty committed Oct 16, 2023
1 parent ef2be8f commit fc57747
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/components/objects/Problem.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<script lang="ts">
import { consensusTipState } from "$lib/stores/state";
import type { Problem } from "$lib/types";
import { AccordionItem } from "carbon-components-svelte";
import { AccordionItem, InlineLoading } from "carbon-components-svelte";
import AddProblem from "../modals/AddProblem.svelte";
import { getDepthColor } from "$lib/helpers/ProblemDepthColor";
Expand All @@ -17,7 +17,7 @@
</script>
<AccordionItem class={focusProblem} style="margin-left:{depth}%;--depthColor:{depthColor};" bind:open={openState}>
<svelte:fragment slot="title">
<h2 class="problem-title">{problem.Title}</h2>
<h2 class="problem-title">{#if problem.Title}{problem.Title}{:else}<InlineLoading />{/if}</h2>
{#if problem.Summary}<div class="problem-summary">{problem.Summary}</div>{/if}
</svelte:fragment>
{#if problem.FullText}<p class="problem-description">{problem.FullText}</p>{/if}
Expand Down
14 changes: 11 additions & 3 deletions src/lib/consensus/mempool.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
import { kindsThatNeedConsensus } from "$lib/kinds";
import { allNostrocketEventKinds, kindsThatNeedConsensus } from "$lib/kinds";
import { rootEventID } from "$lib/settings";
import { labelledTag } from "$lib/stores/state";
import type { NDKEvent } from "@nostr-dev-kit/ndk";
import { get, writable } from "svelte/store";

export default function createEventpool() {
export default function createEventpool(notstrict:boolean|undefined) {
const raw = writable<Map<string, NDKEvent>>(new Map<string, NDKEvent>());
const { subscribe, set, update } = raw;
return {
subscribe,
push: (e: NDKEvent): void => {
if (labelledTag(e, "root", "e") == rootEventID) {
if (!notstrict) {
if (labelledTag(e, "root", "e") == rootEventID && allNostrocketEventKinds.includes(e.kind? e.kind : 0)) {
update((m) => {
m.set(e.id, e);
return m;
});
}
}
if (notstrict) {
update((m) => {
m.set(e.id, e);
return m;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/helpers/bitcoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ function synchronousRequest(url: string): string {

export function BitcoinHeightTag():string[] {
let tip = BitcoinTipHeight()
let bths:string[] = ["h", "", ""]
let bths:string[] = ["h", ""]
if (tip.hash && tip.height) {
bths = ["h", tip.height.toString(), tip.hash]
bths = ["h", tip.height.toString() + ":"+ tip.hash]
}
return bths
}
Expand Down
5 changes: 4 additions & 1 deletion src/lib/stores/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const consensusTipState = writable(r); //this is the latest nostrocket st
let changeStateMutex = new Mutex();

export const anek = $ndk.storeSubscribe<NDKEvent>(
{ "#e": [rootEventID] }, //"#e": [ignitionEvent] , authors: [ignitionPubkey] kinds: allNostrocketEventKinds, "#e": [mainnetRoot]
{ "#e": [rootEventID], kinds: allNostrocketEventKinds }, //"#e": [ignitionEvent] , authors: [ignitionPubkey] kinds: allNostrocketEventKinds, "#e": [mainnetRoot]
{ closeOnEose: false }
);

Expand Down Expand Up @@ -167,6 +167,9 @@ export let notPrecalculatedStateEvents = derived(allNostrocketEvents, ($nr) => {


export let validConsensusEvents = derived(allNostrocketEvents, ($vce) => {
$vce = $vce.filter((event:NDKEvent) => {
return (labelledTag(event, "root", "e") == rootEventID)
})
$vce = $vce.filter((event: NDKEvent) => {
return validate(event, get(consensusTipState));
});
Expand Down

0 comments on commit fc57747

Please sign in to comment.