Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
Mirrored from https://github.com/Camo67/composio.git
Synced Nov 21, 13:30 UTC
fix(docs): enforce product themes
Brendan O'Leary committed
Sep 2, 2026 at 13:47 UTC
d974b20716ea2b62581a93ad0bbdba5121224987
4 files changed
+21
-3
docs/components/docs-product-context.tsx
+9
-1
@@ -12,8 +12,10 @@ import {
12
} from 'react';
13
import { flushSync } from 'react-dom';
14
import { usePathname, useRouter } from 'next/navigation';
15
+import { useTheme } from 'fumadocs-ui/provider/base';
16
import {
17
classifyDocsProduct,
18
+ DOCS_PRODUCTS,
19
serializeDocsProductCookie,
20
shouldAnimateDocsProductSwitch,
21
type DocsProduct,
@@ -54,6 +56,7 @@ export function DocsProductProvider({
56
}) {
57
const pathname = usePathname();
58
const router = useRouter();
59
+ const { setTheme } = useTheme();
60
const [persistedProduct, setPersistedProduct] = useState(initialProduct);
61
const [pendingProduct, setPendingProduct] = useState<DocsProduct | null>(null);
62
const pendingNavigation = useRef<{
@@ -64,6 +67,10 @@ export function DocsProductProvider({
67
const inferredProduct = classifyDocsProduct(pathname);
68
const product = pendingProduct ?? inferredProduct ?? persistedProduct;
69
70
+ useEffect(() => {
71
+ setTheme(DOCS_PRODUCTS[product].theme);
72
+ }, [product, setTheme]);
73
+
74
const persistProduct = useCallback((nextProduct: DocsProduct) => {
75
writeProductCookie(nextProduct);
76
setPersistedProduct(nextProduct);
@@ -101,6 +108,7 @@ export function DocsProductProvider({
108
flushSync(() => {
109
setPersistedProduct(nextProduct);
110
setPendingProduct(nextProduct);
111
+ setTheme(DOCS_PRODUCTS[nextProduct].theme);
112
});
113
if (href !== pathname) router.push(href);
114
};
@@ -165,7 +173,7 @@ export function DocsProductProvider({
173
commitNavigation();
174
}
175
},
168
- [pathname, router],
176
+ [pathname, router, setTheme],
177
);
178
179
const value = useMemo(
docs/lib/home-navigation.ts
+3
@@ -29,6 +29,7 @@ interface DocsProductConfig {
29
product: HomeIntent['product'];
30
switcherDescription: string;
31
landingRoute: string;
32
+ theme: 'light' | 'dark';
33
routePrefixes: readonly string[];
34
sidebar: readonly ProductSidebarGroup[];
35
home: Omit<HomeIntent, 'productId' | 'product'>;
@@ -59,6 +60,7 @@ export const DOCS_PRODUCTS = {
60
product: 'For You',
61
switcherDescription: 'Connect your apps to AI clients.',
62
landingRoute: '/docs/agent-plugins',
63
+ theme: 'light',
64
routePrefixes: [
65
'/docs/agent-plugins',
66
'/docs/claude-code-plugin',
@@ -104,6 +106,7 @@ export const DOCS_PRODUCTS = {
106
product: 'Platform',
107
switcherDescription: 'Build agents with the Composio SDK.',
108
landingRoute: '/docs/quickstart',
109
+ theme: 'dark',
110
routePrefixes: [
111
'/docs/quickstart',
112
'/docs/providers',
docs/lib/layout.shared.tsx
+1
-1
@@ -11,7 +11,7 @@ export function baseOptions(): BaseLayoutProps {
11
transparentMode: 'top',
12
},
13
slots: { navTitle: ProductNavTitle },
14
- themeSwitch: { enabled: true, mode: 'light-dark-system' },
14
+ themeSwitch: { enabled: false },
15
searchToggle: {
16
components: {
17
lg: <SearchAndAskAI />,
docs/tests/static/product-navigation.test.ts
+8
-1
@@ -14,17 +14,19 @@ import { buildProductPageTree, pageTreeUrls } from '../../lib/product-page-tree'
14
import { source } from '../../lib/source';
15
16
describe('Docs product navigation', () => {
17
- test('defines the product labels, descriptions, and landings once', () => {
17
+ test('defines the product labels, descriptions, landings, and themes once', () => {
18
expect(DEFAULT_DOCS_PRODUCT).toBe('platform');
19
expect(DOCS_PRODUCTS['for-you']).toMatchObject({
20
product: 'For You',
21
switcherDescription: 'Connect your apps to AI clients.',
22
landingRoute: '/docs/agent-plugins',
23
+ theme: 'light',
24
});
25
expect(DOCS_PRODUCTS.platform).toMatchObject({
26
product: 'Platform',
27
switcherDescription: 'Build agents with the Composio SDK.',
28
landingRoute: '/docs/quickstart',
29
+ theme: 'dark',
30
});
31
});
32
@@ -142,6 +144,9 @@ describe('Docs product navigation', () => {
144
const sharedLayoutSource = await Bun.file(
145
new URL('../../lib/layout.shared.tsx', import.meta.url),
146
).text();
147
+ const contextSource = await Bun.file(
148
+ new URL('../../components/docs-product-context.tsx', import.meta.url),
149
+ ).text();
150
151
expect(switcherSource).toContain('aria-label={`Switch Composio product. Current product:');
152
expect(switcherSource).toContain('ProductSelectionLink');
@@ -153,5 +158,7 @@ describe('Docs product navigation', () => {
158
expect(switcherSource).toContain('aria-label="Composio home"');
159
expect(switcherSource).toContain('href="/"');
160
expect(sharedLayoutSource).toContain('slots: { navTitle: ProductNavTitle }');
161
+ expect(sharedLayoutSource).toContain('themeSwitch: { enabled: false }');
162
+ expect(contextSource).toContain('setTheme(DOCS_PRODUCTS[product].theme)');
163
});
164
});