1- import DefaultTheme from "vitepress/theme" ;
21import type { Theme } from "vitepress" ;
2+ import type { ThemeContext } from "@voidzero-dev/vitepress-theme" ;
3+ import VoidZeroTheme from "@voidzero-dev/vitepress-theme" ;
4+ import { themeContextKey } from "@voidzero-dev/vitepress-theme" ;
35import { onMounted , watch , nextTick } from "vue" ;
46import { useRoute } from "vitepress" ;
57import { enhanceAppWithTabs } from "vitepress-plugin-tabs/client" ;
68import mediumZoom from "medium-zoom" ;
79import Card from "./components/Card.vue" ;
810import CardGroup from "./components/CardGroup.vue" ;
911import Tags from "./components/Tags.vue" ;
12+ import Layout from "./Layout.vue" ;
1013import "./style.css" ;
1114
15+ /**
16+ * OSSHeader (used on doc pages) injects this context for the bar logo — *not* `themeConfig.logo`.
17+ * The `viteplus` entry in the package overwrites it with "Vite+" assets; we use the base
18+ * `VoidZeroTheme` and provide Plane branding here.
19+ */
20+ const planeThemeContext : ThemeContext = {
21+ /* OSSHeader renders logoDark in light mode and logoLight in dark mode. */
22+ logoDark : "https://media.docs.plane.so/logo/new-logo-white.png" ,
23+ logoLight : "https://media.docs.plane.so/logo/new-logo-dark.png" ,
24+ logoAlt : "Plane" ,
25+ footerBg : "https://media.docs.plane.so/logo/og-docs.webp" ,
26+ monoIcon : "https://media.docs.plane.so/logo/favicon-32x32.png" ,
27+ } ;
28+
1229/**
1330 * Handles tab activation based on URL hash
1431 */
@@ -73,13 +90,52 @@ function updateHashOnTabClick(event: Event) {
7390 }
7491}
7592
93+ /**
94+ * Move "Sign in" CTA to the right utility area (between search and theme toggle).
95+ * The upstream OSSHeader renders nav links on the left; we remap only this CTA.
96+ */
97+ function moveSignInToUtilityArea ( ) {
98+ if ( typeof document === "undefined" ) return ;
99+
100+ const signInLink = document . querySelector (
101+ '.docs-layout header .VPNavBarMenu a.VPLink[href*="sign-in"]' ,
102+ ) as HTMLAnchorElement | null ;
103+ if ( ! signInLink ) return ;
104+
105+ const appearanceToggle = document . querySelector (
106+ ".docs-layout header .VPNavBarAppearance" ,
107+ ) as HTMLElement | null ;
108+
109+ // Desktop (xl+): insert before theme toggle inside the utilities row.
110+ if (
111+ appearanceToggle ?. parentElement &&
112+ signInLink . parentElement !== appearanceToggle . parentElement
113+ ) {
114+ signInLink . classList . add ( "sign-in-relocated" ) ;
115+ appearanceToggle . parentElement . insertBefore ( signInLink , appearanceToggle ) ;
116+ return ;
117+ }
118+
119+ // Tablet fallback (lg-xl): keep it in right controls row before the extra menu.
120+ const extraMenu = document . querySelector (
121+ ".docs-layout header .VPNavBarExtra" ,
122+ ) as HTMLElement | null ;
123+ if ( extraMenu ?. parentElement && signInLink . parentElement !== extraMenu . parentElement ) {
124+ signInLink . classList . add ( "sign-in-relocated" ) ;
125+ extraMenu . parentElement . insertBefore ( signInLink , extraMenu ) ;
126+ }
127+ }
128+
76129export default {
77- extends : DefaultTheme ,
78- enhanceApp ( { app } ) {
79- enhanceAppWithTabs ( app ) ;
80- app . component ( "Card" , Card ) ;
81- app . component ( "CardGroup" , CardGroup ) ;
82- app . component ( "Tags" , Tags ) ;
130+ extends : VoidZeroTheme ,
131+ Layout,
132+ enhanceApp ( ctx ) {
133+ ctx . app . provide ( themeContextKey , planeThemeContext ) ;
134+ VoidZeroTheme . enhanceApp ( ctx ) ;
135+ enhanceAppWithTabs ( ctx . app ) ;
136+ ctx . app . component ( "Card" , Card ) ;
137+ ctx . app . component ( "CardGroup" , CardGroup ) ;
138+ ctx . app . component ( "Tags" , Tags ) ;
83139 } ,
84140 setup ( ) {
85141 if ( typeof window === "undefined" ) return ;
@@ -95,6 +151,7 @@ export default {
95151 setTimeout ( ( ) => {
96152 handleTabHash ( ) ;
97153 setupTabHashUpdates ( ) ;
154+ moveSignInToUtilityArea ( ) ;
98155 } , 100 ) ;
99156
100157 // Listen for hash changes
@@ -112,6 +169,7 @@ export default {
112169 zoom . attach ( ":not(a) > img:not(.VPImage)" ) ;
113170 handleTabHash ( ) ;
114171 setupTabHashUpdates ( ) ;
172+ moveSignInToUtilityArea ( ) ;
115173 } ) ;
116174 } ,
117175 ) ;
0 commit comments