From 9ef3a2f0f143967b549f25bf228b44ff32696171 Mon Sep 17 00:00:00 2001 From: Necati Ozmen Date: Wed, 24 Dec 2025 12:39:23 +0300 Subject: [PATCH 1/7] docs: refactor layout of sidebar --- website/src/components/navbar/index.tsx | 145 +++++++- .../src/components/navbar/styles.module.css | 334 ++++++++++++++++++ website/src/css/custom.css | 6 +- website/src/css/layout.css | 5 + .../src/theme/DocRoot/Layout/Main/index.tsx | 108 ------ .../DocRoot/Layout/Main/styles.module.css | 325 +---------------- .../theme/DocSidebar/Desktop/Content/index.js | 93 +---- .../Desktop/Content/styles.module.css | 176 +-------- website/src/theme/Navbar/index.js | 9 +- website/src/theme/TOC/index.js | 11 +- 10 files changed, 515 insertions(+), 697 deletions(-) diff --git a/website/src/components/navbar/index.tsx b/website/src/components/navbar/index.tsx index fc2a35a33..22acc5207 100644 --- a/website/src/components/navbar/index.tsx +++ b/website/src/components/navbar/index.tsx @@ -3,6 +3,7 @@ import { useLocation } from "@docusaurus/router"; import { AcademicCapIcon, ArrowPathIcon, + ArrowRightIcon, BookOpenIcon, BriefcaseIcon, BuildingLibraryIcon, @@ -15,7 +16,9 @@ import { ComputerDesktopIcon, CurrencyDollarIcon, DocumentTextIcon, + HomeIcon, InformationCircleIcon, + MagnifyingGlassIcon, MegaphoneIcon, PencilSquareIcon, PuzzlePieceIcon, @@ -29,7 +32,10 @@ import { } from "@heroicons/react/24/outline"; import { BoltIcon, ChevronDownIcon, StarIcon } from "@heroicons/react/24/solid"; import { useMediaQuery } from "@site/src/hooks/use-media-query"; -import React, { useState } from "react"; +import clsx from "clsx"; +import React, { useCallback, useEffect, useState } from "react"; +import { DiscordLogo } from "../../../static/img/logos/discord"; +import { GitHubLogo } from "../../../static/img/logos/github"; // Santa Claus Icon Component const SantaIcon = ({ className }: { className?: string }) => ( @@ -63,12 +69,29 @@ const SantaIcon = ({ className }: { className?: string }) => ( /> ); -import { DiscordLogo } from "../../../static/img/logos/discord"; -import { GitHubLogo } from "../../../static/img/logos/github"; import { useGitHubStars } from "../../contexts/GitHubStarsContext"; import useCasesData from "../usecases/usecases.json"; import styles from "./styles.module.css"; +// Docs page tab configuration +const docTabs = [ + { label: "VoltAgent Docs", href: "/docs/", match: "/docs/" }, + { label: "Observability", href: "/observability-docs/", match: "/observability-docs/" }, + { + label: "Actions & Triggers", + href: "/actions-triggers-docs/", + match: "/actions-triggers-docs/", + }, + { label: "Evaluation", href: "/evaluation-docs/", match: "/evaluation-docs/" }, + { + label: "Prompt Engineering", + href: "/prompt-engineering-docs/", + match: "/prompt-engineering-docs/", + }, + { label: "Deployment", href: "/deployment-docs/", match: "/deployment-docs/" }, + { label: "Recipes & Guides", href: "/recipes-and-guides/", match: "/recipes-and-guides/" }, +]; + export default function Navbar() { const [isMenuOpen, setIsMenuOpen] = useState(false); const [isProductsOpen, setIsProductsOpen] = useState(false); @@ -117,6 +140,122 @@ export default function Navbar() { } }; + // Check if current page is a docs page + const isDocsPage = + location.pathname.includes("/docs") || + location.pathname.includes("/observability-docs") || + location.pathname.includes("/evaluation-docs") || + location.pathname.includes("/prompt-engineering-docs") || + location.pathname.includes("/deployment-docs") || + location.pathname.includes("/actions-triggers-docs") || + location.pathname.startsWith("/recipes-and-guides/"); + + // Open search modal (Docusaurus search) + const openSearch = useCallback(() => { + // Trigger Docusaurus search - press Cmd+K or Ctrl+K + const event = new KeyboardEvent("keydown", { + key: "k", + code: "KeyK", + metaKey: true, + ctrlKey: false, + bubbles: true, + }); + document.dispatchEvent(event); + }, []); + + // Check if on VoltOps/Observability docs + const isVoltOpsDoc = location.pathname.includes("/observability-docs/"); + + // Render docs navbar for documentation pages + if (isDocsPage) { + return ( + + ); + } + + // Default navbar for non-docs pages return (