feat: TOC position for publicly shared docs (#7057)

* feat: TOC position for publicly shared docs

* remove preferences object

* comment

* fix: Allow sidebar position preference without public branding switch

---------

Co-authored-by: Tom Moor <tom.moor@gmail.com>
This commit is contained in:
Hemachandar
2024-06-17 02:56:29 +05:30
committed by GitHub
parent 1290aecbc9
commit 3edaf4f8ea
5 changed files with 42 additions and 15 deletions

View File

@@ -7,7 +7,7 @@ import { RouteComponentProps, useLocation } from "react-router-dom";
import styled, { ThemeProvider } from "styled-components";
import { setCookie } from "tiny-cookie";
import { s } from "@shared/styles";
import { NavigationNode, PublicTeam } from "@shared/types";
import { NavigationNode, PublicTeam, TOCPosition } from "@shared/types";
import type { Theme } from "~/stores/UiStore";
import DocumentModel from "~/models/Document";
import Error404 from "~/scenes/Error404";
@@ -102,6 +102,7 @@ function SharedDocumentScene(props: Props) {
? (searchParams.get("theme") as Theme)
: undefined;
const theme = useBuildTheme(response?.team?.customTheme, themeOverride);
const tocPosition = response?.team?.tocPosition ?? TOCPosition.Left;
React.useEffect(() => {
if (!user) {
@@ -188,6 +189,7 @@ function SharedDocumentScene(props: Props) {
document={response.document}
sharedTree={response.sharedTree}
shareId={shareId}
tocPosition={tocPosition}
readOnly
/>
</Layout>