Browse Source

refactor: import kinds from consts

master
limina1 8 months ago
parent
commit
e118c53de5
  1. 8
      src/lib/consts.ts
  2. 18
      src/lib/navigator/EventNetwork/NodeTooltip.svelte

8
src/lib/consts.ts

@ -2,7 +2,7 @@
export const wikiKind = 30818; export const wikiKind = 30818;
export const indexKind = 30040; export const indexKind = 30040;
export const zettelKinds = [30041, 30818]; export const zettelKinds = [30041, 30818, 30023];
export const communityRelays = [ export const communityRelays = [
"wss://theforest.nostr1.com", "wss://theforest.nostr1.com",
@ -29,18 +29,18 @@ export const secondaryRelays = [
export const anonymousRelays = [ export const anonymousRelays = [
"wss://freelay.sovbit.host", "wss://freelay.sovbit.host",
"wss://thecitadel.nostr1.com" "wss://thecitadel.nostr1.com",
]; ];
export const lowbandwidthRelays = [ export const lowbandwidthRelays = [
"wss://theforest.nostr1.com", "wss://theforest.nostr1.com",
"wss://thecitadel.nostr1.com", "wss://thecitadel.nostr1.com",
"wss://aggr.nostr.land" "wss://aggr.nostr.land",
]; ];
export const localRelays: string[] = [ export const localRelays: string[] = [
"wss://localhost:8080", "wss://localhost:8080",
"wss://localhost:4869" "wss://localhost:4869",
]; ];
export enum FeedType { export enum FeedType {

18
src/lib/navigator/EventNetwork/NodeTooltip.svelte

@ -9,7 +9,11 @@
import { onMount } from "svelte"; import { onMount } from "svelte";
import { getMatchingTags } from "$lib/utils/nostrUtils"; import { getMatchingTags } from "$lib/utils/nostrUtils";
import { getEventKindName } from "$lib/utils/eventColors"; import { getEventKindName } from "$lib/utils/eventColors";
import { getDisplayNameSync, replacePubkeysWithDisplayNames } from "$lib/utils/profileCache"; import {
getDisplayNameSync,
replacePubkeysWithDisplayNames,
} from "$lib/utils/profileCache";
import {indexKind, zettelKinds } from "$lib/consts";
// Component props // Component props
let { let {
@ -37,7 +41,7 @@
const MAX_CONTENT_LENGTH = 200; const MAX_CONTENT_LENGTH = 200;
// Publication event kinds (text/article based) // Publication event kinds (text/article based)
const PUBLICATION_KINDS = [30040, 30041, 30818, 30023]; // Added 30023 (long-form content) const PUBLICATION_KINDS = [wikiKind, indexKind, ...zettelKinds];
/** /**
* Gets the author name from the event tags * Gets the author name from the event tags
@ -238,7 +242,9 @@
{#if node.event?.content} {#if node.event?.content}
<div class="tooltip-content-preview"> <div class="tooltip-content-preview">
<span class="font-semibold">Content:</span> <span class="font-semibold">Content:</span>
<pre class="whitespace-pre-wrap">{truncateContent(node.event.content)}</pre> <pre class="whitespace-pre-wrap">{truncateContent(
node.event.content,
)}</pre>
</div> </div>
{/if} {/if}
@ -248,7 +254,11 @@
Tags: {node.event.tags.length} Tags: {node.event.tags.length}
{#if node.event.tags.length <= 3} {#if node.event.tags.length <= 3}
{#each node.event.tags as tag} {#each node.event.tags as tag}
<span class="text-xs">· {tag[0]}{tag[1] ? `: ${tag[0] === 'p' ? getDisplayNameSync(tag[1]) : tag[1].substring(0, 20)}${tag[1].length > 20 && tag[0] !== 'p' ? '...' : ''}` : ''}</span> <span class="text-xs"
{tag[0]}{tag[1]
? `: ${tag[0] === "p" ? getDisplayNameSync(tag[1]) : tag[1].substring(0, 20)}${tag[1].length > 20 && tag[0] !== "p" ? "..." : ""}`
: ""}</span
>
{/each} {/each}
{/if} {/if}
</div> </div>

Loading…
Cancel
Save