From 1a8cfd2a8bb6ea045b4e1b298b2c343341bea37a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samy=20Pess=C3=A9?= Date: Thu, 23 Jan 2025 21:58:02 +0100 Subject: [PATCH] Hide toolbar when previewing (#2773) --- .../src/components/AdminToolbar/AdminToolbar.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/gitbook/src/components/AdminToolbar/AdminToolbar.tsx b/packages/gitbook/src/components/AdminToolbar/AdminToolbar.tsx index 3ab628e24..5d51cc84b 100644 --- a/packages/gitbook/src/components/AdminToolbar/AdminToolbar.tsx +++ b/packages/gitbook/src/components/AdminToolbar/AdminToolbar.tsx @@ -1,5 +1,6 @@ import { Space } from '@gitbook/api'; import { Icon } from '@gitbook/icons'; +import { headers } from 'next/headers'; import React from 'react'; import { getChangeRequest, getRevision, SiteContentPointer } from '@/lib/api'; @@ -43,8 +44,15 @@ function ToolbarLayout(props: { children: React.ReactNode }) { /** * Toolbar with information for the content admin when previewing a revision or change-request. */ -export function AdminToolbar(props: AdminToolbarProps) { +export async function AdminToolbar(props: AdminToolbarProps) { const { content } = props; + const mode = await headers().get('x-gitbook-mode'); + + if (mode === 'multi-id') { + // We don't show the admin toolbar in multi-id mode, as it's used for previewing in the dashboard. + return null; + } + if (content.changeRequestId) { return (