Skip to content

Commit

Permalink
Logged-out handling on document pages
Browse files Browse the repository at this point in the history
  • Loading branch information
allanlasser committed Dec 10, 2024
1 parent 678f802 commit dcfe1bf
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 18 deletions.
17 changes: 10 additions & 7 deletions src/lib/components/documents/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
import { _ } from "svelte-i18n";
import { ALLOWED_TAGS, ALLOWED_ATTR } from "@/config/config.js";
import { remToPx } from "@/lib/utils/layout";
import Access, { getLevel } from "../common/Access.svelte";
import Access, { getLevel } from "$lib/components/common/Access.svelte";
import { remToPx } from "$lib/utils/layout";
import SignedIn from "../common/SignedIn.svelte";
export let document: Document;
Expand All @@ -33,11 +34,13 @@
</script>

<header bind:clientWidth={width}>
{#if access}
<div class="access">
<Access level={access} />
</div>
{/if}
<SignedIn>
{#if access}
<div class="access">
<Access level={access} />
</div>
{/if}
</SignedIn>
<h1 class="title">{document.title}</h1>
{#if description}
<div class="description" class:twoColumn={BREAKPOINTS.TWO_COLUMN}>
Expand Down
21 changes: 12 additions & 9 deletions src/lib/components/layouts/DocumentLayout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ Assumes it's a child of a ViewerContext
import { getCurrentUser } from "$lib/utils/permissions";
import { isOrg } from "$lib/api/accounts";
import { getDocument, getText } from "../viewer/ViewerContext.svelte";
import SignedIn from "../common/SignedIn.svelte";
const me = getCurrentUser();
Expand All @@ -34,11 +35,13 @@ Assumes it's a child of a ViewerContext
</script>

<SidebarLayout>
<nav class="column" slot="navigation">
<Projects {projects} {document} />
<Data {document} />
<Notes {document} />
</nav>
<SignedIn>
<nav class="column" slot="navigation">
<Projects {projects} {document} />
<Data {document} />
<Notes {document} />
</nav>
</SignedIn>

<article slot="content">
<header><DocumentHeader {document} /></header>
Expand All @@ -55,10 +58,10 @@ Assumes it's a child of a ViewerContext
</Flex>
</Metadata>
{/if}
{#if $me}
<ViewerActions {document} user={$me} {action} />
{/if}
<AddOns query="+document:{document.id}" />
<ViewerActions {document} user={$me} {action} />
<SignedIn>
<AddOns query="+document:{document.id}" />
</SignedIn>
</Flex>
{#await text then text}
<DocumentMetadata {document} {text} />
Expand Down
4 changes: 2 additions & 2 deletions src/lib/components/sidebar/ViewerActions.svelte
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- Assumes its a child of ViewerContext -->

<script lang="ts">
import type { Document, Org, User } from "$lib/api/types";
import type { Document, Nullable, Org, User } from "$lib/api/types";
import { _ } from "svelte-i18n";
import {
Expand Down Expand Up @@ -33,7 +33,7 @@
import { getCurrentPage } from "../viewer/ViewerContext.svelte";
export let document: Document;
export let user: User;
export let user: Nullable<User>;
export let action: string = "";
const page = getCurrentPage();
Expand Down

0 comments on commit dcfe1bf

Please sign in to comment.