From e922f112cfbc203ea5d3369ae3b16982d288c8b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nu=C5=A1a=20Puk=C5=A1i=C4=8D?= Date: Thu, 1 May 2025 18:19:52 +0200 Subject: [PATCH] Merge ate some code... now it's back --- src/lib/components/Publication.svelte | 78 +-------------------------- 1 file changed, 1 insertion(+), 77 deletions(-) diff --git a/src/lib/components/Publication.svelte b/src/lib/components/Publication.svelte index a9ec1ee..369bec3 100644 --- a/src/lib/components/Publication.svelte +++ b/src/lib/components/Publication.svelte @@ -10,8 +10,6 @@ Tooltip, } from "flowbite-svelte"; import { getContext, onMount } from "svelte"; - import { BookOutline } from "flowbite-svelte-icons"; - import { page } from "$app/state"; import type { NDKEvent } from "@nostr-dev-kit/ndk"; import PublicationSection from "./PublicationSection.svelte"; import type { PublicationTree } from "$lib/data_structures/publication_tree"; @@ -107,41 +105,9 @@ } } - /** - * Hides the table of contents sidebar when the window shrinks below a certain size. This - * prevents the sidebar from occluding the article content. - */ - function setTocVisibilityOnResize() { - showToc = window.innerWidth >= tocBreakpoint; - showTocButton = window.innerWidth < tocBreakpoint; - } - - /** - * Hides the table of contents sidebar when the user clicks outside of it. - */ - function hideTocOnClick(ev: MouseEvent) { - const target = ev.target as HTMLElement; - - if (target.closest(".sidebar-leather") || target.closest(".btn-leather")) { - return; - } - - if (showToc) { - showToc = false; - } - } - // #endregion onMount(() => { - // Always check whether the TOC sidebar should be visible. - setTocVisibilityOnResize(); - window.addEventListener("hashchange", scrollToElementWithOffset); - // Also handle the case where the user lands on the page with a hash in the URL - scrollToElementWithOffset(); - window.addEventListener("resize", setTocVisibilityOnResize); - window.addEventListener("click", hideTocOnClick); - // Set up the intersection observer. observer = new IntersectionObserver((entries) => { entries.forEach((entry) => { @@ -153,13 +119,10 @@ loadMore(8); return () => { - window.removeEventListener("hashchange", scrollToElementWithOffset); - window.removeEventListener("resize", setTocVisibilityOnResize); - window.removeEventListener("click", hideTocOnClick); - observer.disconnect(); }; }); + {#if $publicationColumnVisibility.details} @@ -170,37 +133,6 @@ {/if} - -{#if showTocButton && !showToc} - -{/if} - - - {#if isDefaultVisible()}
-
{#each leaves as leaf, i} {/each}
- {/if} {#if currentBlog !== null && $publicationColumnVisibility.inner } @@ -235,9 +165,3 @@ {/if} - -