diff --git a/src/app.css b/src/app.css index 79fee31..6ca56d5 100644 --- a/src/app.css +++ b/src/app.css @@ -106,7 +106,7 @@ /* Modal */ div.modal-leather > div { - @apply bg-primary-0 dark:bg-primary-1000 border-b-[1px] border-gray-800 dark:border-gray-500; + @apply bg-primary-0 dark:bg-primary-1000 border-b-[1px] border-primary-100 dark:border-primary-600; } div.modal-leather > div > h1, diff --git a/src/lib/components/Login.svelte b/src/lib/components/Login.svelte index 61b6ffa..2d77763 100644 --- a/src/lib/components/Login.svelte +++ b/src/lib/components/Login.svelte @@ -2,8 +2,7 @@ import { type NDKUserProfile } from '@nostr-dev-kit/ndk'; import { activePubkey, loginWithExtension, logout, ndkInstance, ndkSignedIn, persistLogin } from '$lib/ndk'; import { Avatar, Button, Popover, Tooltip } from 'flowbite-svelte'; - import { ArrowRightToBracketOutline } from 'flowbite-svelte-icons'; - import CopyToClipboard from "$components/util/CopyToClipboard.svelte"; + import Profile from "$components/util/Profile.svelte"; let profile = $state(null); let pfp = $derived(profile?.image); @@ -11,8 +10,6 @@ let tag = $derived(profile?.name); let npub = $state(undefined); - const externalProfileDestination = 'https://nostree.me/' - let signInFailed = $state(false); $effect(() => { @@ -43,78 +40,31 @@ } } - async function handleSignOutClick() { - logout($ndkInstance.activeUser!); - profile = null; - } - - function shortenNpub(long: string|undefined) { - if (!long) return ''; - return long.slice(0, 8) + '…' + long.slice(-4); - } -{#if $ndkSignedIn} - - {#key username || tag} +
+ {#if $ndkSignedIn} + + {:else} + -
-
-

{username}

-

@{tag}

- - View profile -
-
- -
+
+ +
- {/key} -{:else} - - -
- - -
-
-{/if} + {/if} +
diff --git a/src/lib/components/PublicationHeader.svelte b/src/lib/components/PublicationHeader.svelte index 6986ee0..952b7aa 100644 --- a/src/lib/components/PublicationHeader.svelte +++ b/src/lib/components/PublicationHeader.svelte @@ -2,10 +2,11 @@ import { ndkInstance } from '$lib/ndk'; import { neventEncode } from '$lib/utils'; import type { NDKEvent } from '@nostr-dev-kit/ndk'; - import { naddrEncode, type AddressPointer } from 'nostr-tools/nip19'; import { standardRelays } from '../consts'; - import { Card, Button, Modal, Tooltip } from 'flowbite-svelte'; - import { ClipboardCheckOutline, ClipboardCleanOutline, CodeOutline, ShareNodesOutline } from 'flowbite-svelte-icons'; + import { Card, Img } from "flowbite-svelte"; + import CardActions from "$components/util/CardActions.svelte"; + import Profile from "$components/util/Profile.svelte"; + import InlineProfile from "$components/util/InlineProfile.svelte"; const { event } = $props<{ event: NDKEvent }>(); @@ -25,83 +26,41 @@ 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 eventIdCopied: boolean = $state(false); - let jsonModalOpen: boolean = $state(false); - let shareLinkCopied: boolean = $state(false); - - function copyEventId() { - console.debug("copyEventID"); - const relays: string[] = standardRelays; - const nevent = neventEncode(event, relays); - - navigator.clipboard.writeText(nevent); - - eventIdCopied = true; - } - - function viewJson() { - console.debug("viewJSON"); - jsonModalOpen = true; - } - - function shareNjump() { - const relays: string[] = standardRelays; - const dTag : string | undefined = event.dTag; - - if (typeof dTag === 'string') { - const opts: AddressPointer = { - identifier: dTag, - pubkey: event.pubkey, - kind: 30040, - relays - }; - const naddr = naddrEncode(opts); - console.debug(naddr); - navigator.clipboard.writeText(`https://njump.me/${naddr}`); - shareLinkCopied = true; - } - - else { - console.log('dTag is undefined'); - } - } + let image: string = $derived(event.getMatchingTags('image')[0]?.[1] ?? null); + let authorPubkey: string = $derived(event.getMatchingTags('p')[0]?.[1] ?? null); {#if title != null && href != null} - -
- -

{title}

-

by {author}

- {#if version != '1'} -

version: {version}

- {/if} -
-
- - shareLinkCopied = false}> - {#if shareLinkCopied} - - {:else} - Share via NJump - {/if} - - - eventIdCopied = false}> - {#if eventIdCopied} - - {:else} - Copy event ID + + {#if image != null} +
+ +
+ {/if} + - - {JSON.stringify(event.rawEvent())} -
{/if} diff --git a/src/lib/components/util/CardActions.svelte b/src/lib/components/util/CardActions.svelte new file mode 100644 index 0000000..7f70608 --- /dev/null +++ b/src/lib/components/util/CardActions.svelte @@ -0,0 +1,194 @@ + + +
+ + + + {#if isOpen} + + + + {/if} + + +
+ {JSON.stringify(event.rawEvent())} +
+
+ + +
+ {#if image} +
+ +
+ {/if} +
+

{title}

+

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

+

Version: {version}

+
+
+ + {#if summary} +
+

{summary}

+
+ {/if} + +
+

Index author:

+
+ +
+ {#if type !== null} +
Publication type: {type}
+ {/if} + {#if language !== null} +
Language: {language}
+ {/if} + +
+ +
+
diff --git a/src/lib/components/util/CopyToClipboard.svelte b/src/lib/components/util/CopyToClipboard.svelte index 33872d2..9e72c79 100644 --- a/src/lib/components/util/CopyToClipboard.svelte +++ b/src/lib/components/util/CopyToClipboard.svelte @@ -1,29 +1,27 @@ -
- - {displayText} - - - Copied! - -
+ + {#if copied} + Copied! + {:else} + {displayText} + {/if} + \ No newline at end of file diff --git a/src/lib/components/util/InlineProfile.svelte b/src/lib/components/util/InlineProfile.svelte index 9725194..507b3d8 100644 --- a/src/lib/components/util/InlineProfile.svelte +++ b/src/lib/components/util/InlineProfile.svelte @@ -3,9 +3,9 @@ import { type NDKUserProfile } from '@nostr-dev-kit/ndk'; import { ndkInstance } from '$lib/ndk'; - let { pubkey } = $props(); + let { pubkey, title = null } = $props(); - const externalProfileDestination = 'https://nostree.me/' + const externalProfileDestination = 'https://njump.me/' let loading = $state(true); let npub = $state(''); @@ -43,7 +43,7 @@ class='h-6 w-6 mx-1 cursor-pointer inline' src={pfp} alt={username} /> - {username} + {username} {:else} Not found {/if} \ No newline at end of file diff --git a/src/lib/components/util/Profile.svelte b/src/lib/components/util/Profile.svelte new file mode 100644 index 0000000..fd23c9f --- /dev/null +++ b/src/lib/components/util/Profile.svelte @@ -0,0 +1,101 @@ + + +
+ {#if profile} +
+ + {#key username || tag} + +
+
+ {#if username} +

{username}

+ {#if isNav}

@{tag}

{/if} + {/if} + +
+
+
+ {/key} +
+ {/if} +
diff --git a/src/styles/publications.css b/src/styles/publications.css index a48919a..b2b2847 100644 --- a/src/styles/publications.css +++ b/src/styles/publications.css @@ -90,7 +90,7 @@ .videoblock .title, .olist .title, .ulist .title { - @apply my-2; + @apply my-2 font-thin text-lg; } .note-leather li p { @@ -115,6 +115,10 @@ @apply text-sm; } + .leading-normal.first-letter\:text-7xl .quoteblock { + min-height: 108px; + } + /* admonition */ .note-leather .admonitionblock .title { @apply font-semibold; @@ -128,6 +132,10 @@ @apply flex flex-col; } + .note-leather .admonitionblock p:has(code) { + @apply my-3; + } + .note-leather .admonitionblock { @apply rounded overflow-hidden border; } @@ -212,4 +220,13 @@ .videoblock .content video { @apply w-full h-full; } + + /* audio */ + .audioblock .content { + @apply my-3; + } + + .audioblock .content audio { + @apply w-full; + } } \ No newline at end of file