From 6d86fb8d3d38af1c8461a0207c6c6331425e3ebd Mon Sep 17 00:00:00 2001 From: zahidalidev Date: Sun, 25 May 2025 18:58:15 +0500 Subject: [PATCH 1/7] Added top banner for cody --- src/components/Layout.tsx | 10 ++++++ src/components/TopBanner.tsx | 60 ++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 src/components/TopBanner.tsx diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index b0d3ac8bd..e7b0e6dae 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -13,6 +13,7 @@ import { LogoMark } from './LogoMark'; import VersionSelector from './VersionSelector'; import { Search } from './search/Search'; import { DemoLayout } from '@/components/DemoLayout'; +import { TopBanner } from './TopBanner'; function GitHubIcon(props: React.ComponentPropsWithoutRef<'svg'>) { return ( @@ -103,11 +104,20 @@ function Header() { export function Layout({ children }: { children: React.ReactNode }) { let pathname = usePathname(); let isHomePage = pathname === '/'; + let isCody = pathname.includes('/cody'); return (
+ {isCody && } + {isHomePage && } {/* {isHomePage && } */} diff --git a/src/components/TopBanner.tsx b/src/components/TopBanner.tsx new file mode 100644 index 000000000..0190e1996 --- /dev/null +++ b/src/components/TopBanner.tsx @@ -0,0 +1,60 @@ +'use client'; + +import Link from 'next/link'; +import { useState } from 'react'; + +interface TopBannerProps { + text?: string; + link?: string; + backgroundColor?: string; + textColor?: string; + linkText?: string; +} + +export function TopBanner({ + text = "", + link = "https://sourcegraph.com/", + backgroundColor = "#F34E3F", + textColor = "white", + linkText = 'new docs', +}: TopBannerProps) { + const [isVisible, setIsVisible] = useState(true); + + if (!isVisible) return null; + + return ( +
+
+ {text} + + {linkText && {linkText}} + + + + + +
+ +
+ ); +} From 31a730c970ce8f5315dd48b69136cfeb48a142b8 Mon Sep 17 00:00:00 2001 From: zahidalidev Date: Mon, 2 Jun 2025 22:24:00 +0500 Subject: [PATCH 2/7] Added banner for Openctx doc --- src/components/Layout.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index e7b0e6dae..1797e3d49 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -104,17 +104,28 @@ function Header() { export function Layout({ children }: { children: React.ReactNode }) { let pathname = usePathname(); let isHomePage = pathname === '/'; - let isCody = pathname.includes('/cody'); + let isCodyDocs = pathname.includes('/cody'); + let isopenCtxDocs = pathname.includes('/cody/capabilities/openctx'); return (
- {isCody && } */} + + {/* Openctx docs banner */} + {isopenCtxDocs && } From 822f4fe86fcc60a5ebf53103e1b1cd3d630afd37 Mon Sep 17 00:00:00 2001 From: Maedah Batool Date: Mon, 2 Jun 2025 14:10:54 -0700 Subject: [PATCH 3/7] Update src/components/Layout.tsx --- src/components/Layout.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index 1797e3d49..d0bd080de 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -122,7 +122,7 @@ export function Layout({ children }: { children: React.ReactNode }) { {/* Openctx docs banner */} {isopenCtxDocs && Date: Mon, 2 Jun 2025 14:16:52 -0700 Subject: [PATCH 4/7] Update src/components/Layout.tsx --- src/components/Layout.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index d0bd080de..5d4bc34a6 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -122,7 +122,7 @@ export function Layout({ children }: { children: React.ReactNode }) { {/* Openctx docs banner */} {isopenCtxDocs && Date: Mon, 2 Jun 2025 14:16:58 -0700 Subject: [PATCH 5/7] Update src/components/Layout.tsx --- src/components/Layout.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index 5d4bc34a6..4020f230f 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -123,7 +123,7 @@ export function Layout({ children }: { children: React.ReactNode }) { {/* Openctx docs banner */} {isopenCtxDocs && Date: Mon, 2 Jun 2025 14:17:02 -0700 Subject: [PATCH 6/7] Update src/components/Layout.tsx --- src/components/Layout.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index 4020f230f..3635fccab 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -124,7 +124,7 @@ export function Layout({ children }: { children: React.ReactNode }) { {isopenCtxDocs && } From 8b09234b70c1283c149d3c073d9f415cfc427dd0 Mon Sep 17 00:00:00 2001 From: zahidalidev Date: Tue, 3 Jun 2025 02:28:29 +0500 Subject: [PATCH 7/7] Fixed syntax issue --- src/components/Layout.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Layout.tsx b/src/components/Layout.tsx index 3635fccab..592a2834e 100644 --- a/src/components/Layout.tsx +++ b/src/components/Layout.tsx @@ -122,7 +122,7 @@ export function Layout({ children }: { children: React.ReactNode }) { {/* Openctx docs banner */} {isopenCtxDocs &&