From 42215020caa801cb7d33bbf35a31018b49b3c583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nu=C5=A1a=20Puk=C5=A1i=C4=8D?= Date: Thu, 4 Sep 2025 22:11:04 +0200 Subject: [PATCH] Moving things around again --- src/app.css | 6 +- src/app.html | 22 +- src/lib/a/cards/AProfilePreview.svelte | 112 +++------ src/lib/a/primitives/AAlert.svelte | 8 +- src/lib/a/reader/ATechBlock.svelte | 6 +- src/lib/a/reader/ATechToggle.svelte | 3 +- src/lib/components/CommentViewer.svelte | 2 +- src/lib/components/EventDetails.svelte | 234 ++++++++---------- src/lib/components/EventSearch.svelte | 15 +- src/lib/components/util/ArticleNav.svelte | 12 +- .../components/util/CopyToClipboard.svelte | 10 +- src/lib/stores/techStore.ts | 17 +- src/routes/about/+page.svelte | 2 +- src/routes/contact/+page.svelte | 2 +- src/routes/events/+page.svelte | 92 ++----- src/routes/events/compose/+page.svelte | 34 ++- src/routes/profile/+page.svelte | 7 +- src/routes/start/+page.svelte | 2 +- 18 files changed, 263 insertions(+), 323 deletions(-) diff --git a/src/app.css b/src/app.css index fa416d8..b1241e2 100644 --- a/src/app.css +++ b/src/app.css @@ -454,6 +454,10 @@ @apply fill-primary-600 dark:fill-primary-500; } } + + [data-tech="off"] .tech-detail { + @apply !hidden; + } } @layer components { @@ -750,4 +754,4 @@ vertical-align: text-bottom; font-weight: 500; } -} \ No newline at end of file +} diff --git a/src/app.html b/src/app.html index 345607e..33b6e90 100644 --- a/src/app.html +++ b/src/app.html @@ -1,10 +1,30 @@ - + + + + + + + + {#if title} +
+ {@render title()} +
+ {/if} {@render children()}
\ No newline at end of file diff --git a/src/lib/a/reader/ATechBlock.svelte b/src/lib/a/reader/ATechBlock.svelte index 5bfa3df..0aa7116 100644 --- a/src/lib/a/reader/ATechBlock.svelte +++ b/src/lib/a/reader/ATechBlock.svelte @@ -1,18 +1,16 @@ {#if hidden} -
+
{title} hidden
{:else} -
{@render content()} -
{/if} diff --git a/src/lib/a/reader/ATechToggle.svelte b/src/lib/a/reader/ATechToggle.svelte index c818536..cabf420 100644 --- a/src/lib/a/reader/ATechToggle.svelte +++ b/src/lib/a/reader/ATechToggle.svelte @@ -2,10 +2,9 @@ import { showTech } from '$lib/stores/techStore.ts'; import { Toggle, P } from "flowbite-svelte"; let label = 'Show technical details'; - $: checked = $showTech;
- $showTech = checked} aria-label={label} /> +

{label}

diff --git a/src/lib/components/CommentViewer.svelte b/src/lib/components/CommentViewer.svelte index 2c5dcde..a1b3836 100644 --- a/src/lib/components/CommentViewer.svelte +++ b/src/lib/components/CommentViewer.svelte @@ -219,7 +219,7 @@ if (!isFetching) { fetchComments(); } - }, 2000); // Wait 2 seconds before retry + }, 10000); // Wait 10 seconds before retry } }); diff --git a/src/lib/components/EventDetails.svelte b/src/lib/components/EventDetails.svelte index 320bd13..2491e5d 100644 --- a/src/lib/components/EventDetails.svelte +++ b/src/lib/components/EventDetails.svelte @@ -22,6 +22,9 @@ import { getNdkContext } from "$lib/ndk"; import type { UserProfile } from "$lib/models/user_profile"; import { basicMarkup } from "$lib/snippets/MarkupSnippets.svelte"; + import ATechBlock from "$lib/a/reader/ATechBlock.svelte"; + import { Accordion, AccordionItem, Heading } from "flowbite-svelte"; + import RelayActions from "$components/RelayActions.svelte"; const { event, @@ -302,6 +305,10 @@ return ids; } + function navigateToIdentifier(link: string) { + goto(link); + } + onMount(() => { function handleInternalLinkClick(event: MouseEvent) { const target = event.target as HTMLElement; @@ -323,38 +330,38 @@

{@render basicMarkup(getEventTitle(event), ndk)}

- {/if} -
- {#if toNpub(event.pubkey)} +
+ {#if toNpub(event.pubkey)} Author: {@render userBadge( - toNpub(event.pubkey) || '', - profile?.display_name || undefined, - ndk, - )}Author: {@render userBadge( + toNpub(event.pubkey) || '', + profile?.display_name || undefined, + ndk, + )} - {:else} + {:else} Author: {profile?.display_name || event.pubkey}Author: {profile?.display_name || event.pubkey} - {/if} -
+ {/if} +
-
- Kind: - {event.kind} - + Kind: + {event.kind} + ({getEventTypeDisplay(event)}) -
+ > +
-
- Summary: -
- {@render basicMarkup(getEventSummary(event), ndk)} +
+ Summary: +
+ {@render basicMarkup(getEventSummary(event), ndk)} +
-
+ {/if} @@ -424,119 +431,80 @@ {/if} - -
- - Show details - - - -
-

Identifiers:

-
- {#each getIdentifiers(event, profile) as identifier} -
- {identifier.label}: -
- {#if identifier.link} - - {identifier.value.slice(0, 20)}...{identifier.value.slice(-8)} - - {:else} - - {identifier.value.slice(0, 20)}...{identifier.value.slice(-8)} - - {/if} + + {#snippet content()} + + Technical details + + + + + {#snippet header()}Identifiers{/snippet} + {#if event} +
+ {#each getIdentifiers(event, profile) as identifier} +
+ {identifier.label}: +
+ {#if identifier.link} + + {:else} + {identifier.value} + {/if} +
+
+ +
+
+ {/each} +
+ {/if} +
+ + {#if event.tags && event.tags.length} + + {#snippet header()} + Tags + {/snippet} +
+ {#each event.tags as tag} + {@const tagInfo = getTagButtonInfo(tag)} + {#if tagInfo.text && tagInfo.gotoValue} + + {/if} + {/each} +
+
+ {/if} + + + {#snippet header()}Event JSON{/snippet} +
-
- {/each} -
-
- - - {#if event.tags && event.tags.length} -
-

Event Tags:

-
- {#each event.tags as tag} - {@const tagInfo = getTagButtonInfo(tag)} - {#if tagInfo.text && tagInfo.gotoValue} - - {/if} - {/each} -
-
- {/if} + {#if event} +
+              {JSON.stringify(event.rawEvent(), null, 2)}
+            
+ {/if} + - -
-

Raw Event JSON:

-
-
- -
-
-{JSON.stringify(event.rawEvent(), null, 2)}
-        
-
-
-
+ + {#snippet header()}Relay Info{/snippet} + + + + {/snippet} +
diff --git a/src/lib/components/EventSearch.svelte b/src/lib/components/EventSearch.svelte index 85f4bdc..0552214 100644 --- a/src/lib/components/EventSearch.svelte +++ b/src/lib/components/EventSearch.svelte @@ -18,6 +18,7 @@ import { getMatchingTags, toNpub } from "$lib/utils/nostrUtils"; import { isEventId } from "$lib/utils/nostr_identifiers"; import type { SearchType } from "$lib/models/search_type"; + import { AAlert } from "$lib/a"; // Props definition let { @@ -903,21 +904,15 @@ {#if showError} - + {/if} {#if showSuccess} - + {/if} diff --git a/src/lib/components/util/ArticleNav.svelte b/src/lib/components/util/ArticleNav.svelte index c00dd8c..a4c4975 100644 --- a/src/lib/components/util/ArticleNav.svelte +++ b/src/lib/components/util/ArticleNav.svelte @@ -6,7 +6,7 @@ GlobeOutline, ChartOutline, } from "flowbite-svelte-icons"; - import { Button } from "flowbite-svelte"; + import { Button, P } from "flowbite-svelte"; import { publicationColumnVisibility } from "$lib/stores"; import { userBadge } from "$lib/snippets/UserSnippets.svelte"; import type { NDKEvent } from "@nostr-dev-kit/ndk"; @@ -152,7 +152,7 @@