@@ -16,11 +16,13 @@ import { DeploymentInfoContext } from "@common/lib/deploymentContext";
1616import { useGlobalLocalStorage } from "@common/lib/useGlobalLocalStorage" ;
1717import { useCollapseSidebarState } from "@common/lib/useCollapseSidebarState" ;
1818import { PulseIcon } from "@common/elements/icons" ;
19- import { Sidebar } from "@common/elements/Sidebar" ;
19+ import { Sidebar , useCurrentPage } from "@common/elements/Sidebar" ;
2020import { FunctionRunnerWrapper } from "@common/features/functionRunner/components/FunctionRunnerWrapper" ;
2121import { FunctionsProvider } from "@common/lib/functions/FunctionsProvider" ;
2222import { useIsGlobalRunnerShown } from "@common/features/functionRunner/lib/functionRunner" ;
2323import { useIsCloudDeploymentInSelfHostedDashboard } from "@common/lib/useIsCloudDeploymentInSelfHostedDashboard" ;
24+ import { Tooltip } from "@ui/Tooltip" ;
25+ import Image from "next/image" ;
2426
2527type LayoutProps = {
2628 children : JSX . Element ;
@@ -121,6 +123,11 @@ export function DeploymentDashboardLayout({
121123 collapsed = { ! ! collapsed }
122124 setCollapsed = { setCollapsed }
123125 items = { sidebarItems }
126+ header = {
127+ process . env . NEXT_PUBLIC_HIDE_HEADER ? (
128+ < EmbeddedConvexLogo collapsed = { ! ! collapsed } />
129+ ) : undefined
130+ }
124131 />
125132 < div
126133 className = { classNames (
@@ -181,3 +188,59 @@ function PauseBanner() {
181188 </ div >
182189 ) ;
183190}
191+
192+ function EmbeddedConvexLogo ( { collapsed } : { collapsed : boolean } ) {
193+ const currentPage = useCurrentPage ( ) ;
194+ const { deploymentName } = useIsCloudDeploymentInSelfHostedDashboard ( ) ;
195+
196+ const href = deploymentName
197+ ? `https://dashboard.convex.dev/d/${ deploymentName } /${ currentPage ?? "" } `
198+ : "https://dashboard.convex.dev" ;
199+
200+ return (
201+ < >
202+ { /* Vertical layout on small screens */ }
203+ < div className = "mr-2 sm:hidden" >
204+ < Tooltip tip = "Convex" side = "bottom" wrapsButton >
205+ < a
206+ className = "flex h-full items-center"
207+ href = { href }
208+ target = "_blank"
209+ rel = "noreferrer"
210+ >
211+ < Image
212+ src = "/convex-logo-only.svg"
213+ width = "24"
214+ height = "24"
215+ alt = "Convex logo"
216+ />
217+ </ a >
218+ </ Tooltip >
219+ </ div >
220+
221+ { /* Horizontal layout on larger screens, with some text when not collapsed */ }
222+ < div className = "hidden sm:block" >
223+ < Tooltip tip = { collapsed && "Convex" } side = "bottom" wrapsButton >
224+ < a
225+ href = { href }
226+ target = "_blank"
227+ rel = "noreferrer"
228+ className = {
229+ collapsed
230+ ? "flex w-full justify-center"
231+ : "flex items-center gap-2 px-1.5 py-0.5"
232+ }
233+ >
234+ < Image
235+ src = "/convex-logo-only.svg"
236+ width = { collapsed ? 24 : 18 }
237+ height = { collapsed ? 24 : 18 }
238+ alt = "Convex logo"
239+ />
240+ { ! collapsed && < div className = "text-sm font-medium" > Convex</ div > }
241+ </ a >
242+ </ Tooltip >
243+ </ div >
244+ </ >
245+ ) ;
246+ }
0 commit comments