Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
add: badge parameter to docs index + badge component in search result
Ben Fornefeld6290cb242dfa
diff --git a/apps/web/src/components/Search.tsx b/apps/web/src/components/Search.tsxindex 8ef416862..858499033 100644--- a/apps/web/src/components/Search.tsx+++ b/apps/web/src/components/Search.tsx@@ -253,6 +253,13 @@ function SearchResult({<HighlightQuery text={contextPreview} query={query} /></div>)}+ {result.badge === 'Legacy' && (+ <div className="absolute top-3 right-4">+ <span className="inline-flex items-center justify-center whitespace-nowrap rounded-md text-xs font-medium bg-primary text-primary-foreground hover:bg-primary/90 px-2 py-1">+ {result.badge}+ </span>+ </div>+ )}</li>)}diff --git a/apps/web/src/mdx/search.mjs b/apps/web/src/mdx/search.mjsindex d327b32fd..613239794 100644--- a/apps/web/src/mdx/search.mjs+++ b/apps/web/src/mdx/search.mjs@@ -96,7 +96,7 @@ export default function (nextConfig = {}) {document: {id: 'url',index: 'content',- store: ['title', 'pageTitle', 'preview'],+ store: ['title', 'pageTitle', 'preview', 'badge'],},context: {resolution: 9,@@ -114,6 +114,8 @@ export default function (nextConfig = {}) {continue}+ const isLegacy = url.includes('docs/legacy')+for (let [title, hash, content] of sections) {sectionIndex.add({url: url + (hash ? ('#' + hash) : ''),@@ -121,6 +123,7 @@ export default function (nextConfig = {}) {content: [title, ...content].join('\\n'),pageTitle: hash ? sections[0][0] : undefined,preview: content.join('\\n'),+ badge: isLegacy ? 'Legacy' : undefined,})}}@@ -138,6 +141,7 @@ export default function (nextConfig = {}) {title: item.doc.title,pageTitle: item.doc.pageTitle,preview: item.doc.preview,+ badge: item.doc.badge,}))}`diff --git a/apps/web/types.d.ts b/apps/web/types.d.tsindex c08e065f1..662560c7a 100644--- a/apps/web/types.d.ts+++ b/apps/web/types.d.ts@@ -6,6 +6,7 @@ declare module '@/mdx/search.mjs' {title: stringpageTitle?: stringpreview?: string+ badge?: 'Legacy'}export function search(query: string, options?: SearchOptions): Array<Result>