From f03db123a47f86a772ec24e6f32bf18d717f6d8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nu=C5=A1a=20Puk=C5=A1i=C4=8D?= Date: Fri, 28 Mar 2025 21:00:56 +0100 Subject: [PATCH] Extract publication details --- src/lib/components/util/CardActions.svelte | 62 +------------------- src/lib/components/util/Details.svelte | 66 ++++++++++++++++++++++ 2 files changed, 68 insertions(+), 60 deletions(-) create mode 100644 src/lib/components/util/Details.svelte diff --git a/src/lib/components/util/CardActions.svelte b/src/lib/components/util/CardActions.svelte index 41f0c1c..d298af5 100644 --- a/src/lib/components/util/CardActions.svelte +++ b/src/lib/components/util/CardActions.svelte @@ -11,7 +11,7 @@ import { standardRelays } from "$lib/consts"; import { neventEncode } from "$lib/utils"; import { type AddressPointer, naddrEncode } from "nostr-tools/nip19"; - import InlineProfile from "$components/util/InlineProfile.svelte"; + import Details from "$components/util/Details.svelte"; let { event } = $props(); @@ -19,17 +19,6 @@ let detailsModalOpen: boolean = $state(false); let eventIdCopied: boolean = $state(false); let shareLinkCopied: boolean = $state(false); - let title: string = $derived(event.getMatchingTags('title')[0]?.[1]); - let author: string = $derived(event.getMatchingTags('author')[0]?.[1] ?? 'unknown'); - let version: string = $derived(event.getMatchingTags('version')[0]?.[1] ?? '1'); - let image: string = $derived(event.getMatchingTags('image')[0]?.[1] ?? null); - let originalAuthor: string = $derived(event.getMatchingTags('p')[0]?.[1] ?? null); - let summary: string = $derived(event.getMatchingTags('summary')[0]?.[1] ?? null); - let type: string = $derived(event.getMatchingTags('type')[0]?.[1] ?? null); - let language: string = $derived(event.getMatchingTags('l')[0]?.[1] ?? null); - let source: string = $derived(event.getMatchingTags('source')[0]?.[1] ?? null); - let publisher: string = $derived(event.getMatchingTags('published_by')[0]?.[1] ?? null); - let identifier: string = $derived(event.getMatchingTags('i')[0]?.[1] ?? null); let isOpen = $state(false); @@ -154,53 +143,6 @@ -
- {#if image} -
- -
- {/if} -
-

{title}

-

by - {#if originalAuthor !== null} - - {:else} - {author} - {/if} -

-

Version: {version}

-
-
- - {#if summary} -
-

{summary}

-
- {/if} - -
-

Index author:

-
- -
- {#if source !== null} -
Source: {source}
- {/if} - {#if type !== null} -
Publication type: {type}
- {/if} - {#if language !== null} -
Language: {language}
- {/if} - {#if publisher !== null} -
Published by: {publisher}
- {/if} - {#if identifier !== null} -
{identifier}
- {/if} - -
- +
diff --git a/src/lib/components/util/Details.svelte b/src/lib/components/util/Details.svelte new file mode 100644 index 0000000..879b138 --- /dev/null +++ b/src/lib/components/util/Details.svelte @@ -0,0 +1,66 @@ + + +
+ {#if image} +
+ +
+ {/if} +
+

{title}

+

by + {#if originalAuthor !== null} + + {:else} + {author} + {/if} +

+

Version: {version}

+
+
+ +{#if summary} +
+

{summary}

+
+{/if} + +
+

Index author:

+
+ +
+ {#if source !== null} +
Source: {source}
+ {/if} + {#if type !== null} +
Publication type: {type}
+ {/if} + {#if language !== null} +
Language: {language}
+ {/if} + {#if publisher !== null} +
Published by: {publisher}
+ {/if} + {#if identifier !== null} +
{identifier}
+ {/if} + +
\ No newline at end of file