feat: Optional branding on shared documents (#4450)

* feat: Optional branding on shared documents

* Refactor
Remove unneccessarily exposed team id
Remove top-level collapsible document on publicly shared urls

* fix: Branding disappears when revising document
fix: Clicking title should go back to main app when logged in
This commit is contained in:
Tom Moor
2022-11-21 16:20:50 -08:00
committed by GitHub
parent 088ef81133
commit e605961e23
13 changed files with 91 additions and 40 deletions

View File

@@ -7,6 +7,7 @@ import { RouteComponentProps, useLocation, Redirect } from "react-router-dom";
import styled, { useTheme } from "styled-components";
import { setCookie } from "tiny-cookie";
import DocumentModel from "~/models/Document";
import Team from "~/models/Team";
import Error404 from "~/scenes/Error404";
import ErrorOffline from "~/scenes/ErrorOffline";
import Layout from "~/components/Layout";
@@ -26,6 +27,7 @@ const EMPTY_OBJECT = {};
type Response = {
document: DocumentModel;
team?: Team;
sharedTree?: NavigationNode | undefined;
};
@@ -157,8 +159,12 @@ function SharedDocumentScene(props: Props) {
return <Redirect to={response.document.url} />;
}
const sidebar = response.sharedTree ? (
<Sidebar rootNode={response.sharedTree} shareId={shareId} />
const sidebar = response.sharedTree?.children.length ? (
<Sidebar
rootNode={response.sharedTree}
team={response.team}
shareId={shareId}
/>
) : undefined;
return (