Browse Source

Hide discussion and center publication

master
Nuša Pukšič 6 months ago committed by buttercat1791
parent
commit
5a6c2bb171
  1. 37
      src/lib/components/publications/Publication.svelte
  2. 2
      src/lib/stores.ts
  3. 9
      src/routes/publication/[type]/[identifier]/+page.svelte

37
src/lib/components/publications/Publication.svelte

@ -265,9 +265,7 @@
<!-- Table of contents --> <!-- Table of contents -->
{#if publicationType !== "blog" && !isLeaf} {#if publicationType !== "blog" && !isLeaf}
<Sidebar <Sidebar
class="z-10 ml-4 bg-transparent sticky top-[162px] h-[calc(100vh-165px)] overflow-y-auto class="z-10 ml-4 bg-transparent sticky top-[162px] h-[calc(100vh-165px)] overflow-y-auto"
border border-s-4 rounded border-primary-200 dark:border-primary-800
dark:bg-primary-1000"
activeUrl={`#${activeAddress ?? ""}`} activeUrl={`#${activeAddress ?? ""}`}
classes={{ classes={{
div: 'bg-transparent', div: 'bg-transparent',
@ -276,17 +274,19 @@
}} }}
> >
<SidebarWrapper> <SidebarWrapper>
<TableOfContents {#if $publicationColumnVisibility.toc}
{rootAddress} <TableOfContents
{toc} {rootAddress}
depth={2} {toc}
onSectionFocused={(address: string) => publicationTree.setBookmark(address)} depth={2}
onLoadMore={() => { onSectionFocused={(address: string) => publicationTree.setBookmark(address)}
if (!isLoading && !isDone && publicationTree) { onLoadMore={() => {
loadMore(4); if (!isLoading && !isDone && publicationTree) {
} loadMore(4);
}} }
/> }}
/>
{/if}
</SidebarWrapper> </SidebarWrapper>
</Sidebar> </Sidebar>
{/if} {/if}
@ -295,7 +295,7 @@
<!-- Default publications --> <!-- Default publications -->
{#if $publicationColumnVisibility.main} {#if $publicationColumnVisibility.main}
<!-- Remove overflow-auto so page scroll drives it --> <!-- Remove overflow-auto so page scroll drives it -->
<div class="flex flex-col p-4 space-y-4 max-w-2xl flex-grow-2"> <div class="flex flex-col p-4 space-y-4 max-w-3xl flex-grow-2 mx-auto">
<div <div
class="card-leather bg-highlight dark:bg-primary-800 p-4 mb-4 rounded-lg border" class="card-leather bg-highlight dark:bg-primary-800 p-4 mb-4 rounded-lg border"
> >
@ -371,9 +371,10 @@
{#if $publicationColumnVisibility.discussion} {#if $publicationColumnVisibility.discussion}
<Sidebar <Sidebar
class="z-10 ml-4 bg-transparent sticky top-[162px] h-[calc(100vh-165px)] overflow-y-auto class="z-10 ml-4 sticky top-[162px] h-[calc(100vh-165px)] overflow-y-auto"
border border-s-4 rounded border-primary-200 dark:border-primary-800 classes={{
dark:bg-primary-1000" div: 'bg-transparent'
}}
> >
<SidebarWrapper> <SidebarWrapper>
<SidebarGroup> <SidebarGroup>

2
src/lib/stores.ts

@ -21,7 +21,7 @@ const defaultVisibility: PublicationLayoutVisibility = {
blog: true, blog: true,
main: true, main: true,
inner: false, inner: false,
discussion: true, discussion: false,
editing: false, editing: false,
}; };

9
src/routes/publication/[type]/[identifier]/+page.svelte

@ -3,7 +3,6 @@
import type { PageProps } from "./$types"; import type { PageProps } from "./$types";
import { onDestroy, onMount, setContext } from "svelte"; import { onDestroy, onMount, setContext } from "svelte";
import Processor from "asciidoctor"; import Processor from "asciidoctor";
import ArticleNav from "$components/util/ArticleNav.svelte";
import { SveltePublicationTree } from "$lib/components/publications/svelte_publication_tree.svelte"; import { SveltePublicationTree } from "$lib/components/publications/svelte_publication_tree.svelte";
import { TableOfContents } from "$lib/components/publications/table_of_contents.svelte"; import { TableOfContents } from "$lib/components/publications/table_of_contents.svelte";
import { page } from "$app/state"; import { page } from "$app/state";
@ -180,12 +179,6 @@
{#if indexEvent && publicationTree && toc} {#if indexEvent && publicationTree && toc}
{@const debugInfo = `indexEvent: ${!!indexEvent}, publicationTree: ${!!publicationTree}, toc: ${!!toc}`} {@const debugInfo = `indexEvent: ${!!indexEvent}, publicationTree: ${!!publicationTree}, toc: ${!!toc}`}
{@const debugElement = console.debug('[Publication] Rendering publication with:', debugInfo)} {@const debugElement = console.debug('[Publication] Rendering publication with:', debugInfo)}
<ArticleNav
publicationType={data.publicationType}
rootId={indexEvent.id}
indexEvent={indexEvent}
/>
<Publication <Publication
rootAddress={indexEvent.tagAddress()} rootAddress={indexEvent.tagAddress()}
publicationType={data.publicationType} publicationType={data.publicationType}
@ -222,4 +215,4 @@
<p class="text-gray-600 dark:text-gray-400">Loading publication...</p> <p class="text-gray-600 dark:text-gray-400">Loading publication...</p>
</div> </div>
</main> </main>
{/if} {/if}

Loading…
Cancel
Save