diff --git a/src/lib/components/cards/BlogHeader.svelte b/src/lib/components/cards/BlogHeader.svelte index 80de2e7..a7f23e6 100644 --- a/src/lib/components/cards/BlogHeader.svelte +++ b/src/lib/components/cards/BlogHeader.svelte @@ -87,60 +87,103 @@ {#if title != null} - -
-
-
- {@render userBadge(authorPubkey, author, ndk)} - {publishedAt()} + {#if active} + +
{ + // Don't trigger if clicking on CardActions or its children + const target = e.target as HTMLElement; + if (target.closest('.card-actions') || target.closest('button[type="button"]')) { + return; + } + showBlog(); + }} + onkeydown={(e: KeyboardEvent) => { + if (e.key === 'Enter' || e.key === ' ') { + const target = e.target as HTMLElement; + if (!target.closest('.card-actions') && !target.closest('button[type="button"]')) { + showBlog(); + } + } + }} + > + +
+
+
+ {@render userBadge(authorPubkey, author, ndk)} + {publishedAt()} +
-
-
- {#if image} - - {:else} -
-
- {/if} -
- -
- - {#if hashtags} -
- {#each hashtags as tag} - #{tag} - {/each} -
- {/if} -
- - {#if active} + {#if hashtags} +
+ {#each hashtags as tag} + #{tag} + {/each} +
+ {/if} +
+ - {/if} - - -
- + + +
e.stopPropagation()} + onkeydown={(e) => e.stopPropagation()} + > + +
+
+ +
+ {:else} + +
showBlog()} + onkeydown={(e) => { + if (e.key === 'Enter' || e.key === ' ') { + showBlog(); + } + }} + > +

{title}

+
+

{publishedAt()}

+ +

{author}

- + {/if} {/if} diff --git a/src/lib/components/publications/Publication.svelte b/src/lib/components/publications/Publication.svelte index 0f0257f..22068d0 100644 --- a/src/lib/components/publications/Publication.svelte +++ b/src/lib/components/publications/Publication.svelte @@ -240,11 +240,12 @@ } function loadBlog(rootId: string) { - // depending on the size of the screen, also toggle blog list & discussion visibility + // depending on the size of the screen, also toggle discussion visibility publicationColumnVisibility.update((current) => { const updated = current; if (window.innerWidth < 1024) { - updated.blog = false; + // Don't set blog = false on mobile - we need it to show the article + // The blog list is already hidden via CSS (hidden md:flex) updated.discussion = false; } updated.inner = true; @@ -659,38 +660,58 @@
{/if} - + {#if $publicationColumnVisibility.blog} - -
+
+
-
+
+
+
+ + {#each leaves as leaf, i} + {#if leaf} + + {/if} + {/each}
- - {#each leaves as leaf, i} - {#if leaf} - - {/if} - {/each} -
- {/if} - {#if isInnerActive()} - {#key currentBlog} - -
- -
- {/key} + + {#if isInnerActive()} + {#key currentBlog} +
+ {#if currentBlogEvent && currentBlog} + {@const address = currentBlog} + onPublicationSectionMounted(el, address)} + /> + {:else} +
+

Loading article...

+
+ {/if} +
+ {/key} + {/if} +
{/if}
diff --git a/src/lib/components/util/ArticleNav.svelte b/src/lib/components/util/ArticleNav.svelte index 795f3cc..2d8183e 100644 --- a/src/lib/components/util/ArticleNav.svelte +++ b/src/lib/components/util/ArticleNav.svelte @@ -93,6 +93,16 @@ }); } + function handleBlogTocClick() { + if ($publicationColumnVisibility.inner) { + // Viewing article: go back to TOC + backToBlog(); + } else if ($publicationColumnVisibility.blog) { + // Showing TOC: toggle it (though it should stay visible) + toggleColumn("blog"); + } + } + function handleScroll() { if (window.innerWidth < 768) { const currentScrollY = window.scrollY; @@ -160,11 +170,13 @@
{#if isIndexEvent} {#if publicationType === "blog"} +