Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
| 1 | import type { ReactNode } from 'react'; |
| 2 | import Link from 'next/link'; |
| 3 | import { BookOpen, Wrench } from 'lucide-react'; |
| 4 | import { PRODUCT_AREAS } from '@/lib/knowledge/taxonomy'; |
| 5 | |
| 6 | const browseAreas = PRODUCT_AREAS.filter((area) => area.defaultBrowse); |
| 7 | |
| 8 | export function KbGuideVerification({ lastVerifiedAt }: { lastVerifiedAt: string }) { |
| 9 | const verifiedDate = new Date(`${lastVerifiedAt}T12:00:00Z`); |
| 10 | const label = new Intl.DateTimeFormat('en-US', { |
| 11 | dateStyle: 'medium', |
| 12 | timeZone: 'UTC', |
| 13 | }).format(verifiedDate); |
| 14 | |
| 15 | return ( |
| 16 | <p className="text-sm text-fd-muted-foreground"> |
| 17 | Last verified <time dateTime={lastVerifiedAt}>{label}</time> |
| 18 | </p> |
| 19 | ); |
| 20 | } |
| 21 | |
| 22 | function ArticleNavigation() { |
| 23 | return ( |
| 24 | <nav aria-label="Knowledge Base article navigation"> |
| 25 | <p className="text-xs font-semibold uppercase tracking-wider text-fd-muted-foreground"> |
| 26 | Support topics |
| 27 | </p> |
| 28 | <ul className="mt-3 space-y-1"> |
| 29 | {browseAreas.map((area) => ( |
| 30 | <li key={area.slug}> |
| 31 | <Link |
| 32 | href={`/kb/topic/${area.slug}`} |
| 33 | className="flex gap-2.5 px-2 py-2 text-sm leading-5 text-fd-muted-foreground hover:bg-fd-accent/50 hover:text-fd-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-fd-ring" |
| 34 | > |
| 35 | <BookOpen className="mt-0.5 size-4 shrink-0" aria-hidden="true" /> |
| 36 | {area.title} |
| 37 | </Link> |
| 38 | </li> |
| 39 | ))} |
| 40 | </ul> |
| 41 | <Link |
| 42 | href="/kb/toolkits" |
| 43 | className="mt-5 flex items-center gap-2 border-t border-fd-border pt-5 text-sm font-medium hover:text-fd-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fd-ring" |
| 44 | > |
| 45 | <Wrench className="size-4" aria-hidden="true" /> |
| 46 | Browse all toolkits |
| 47 | </Link> |
| 48 | </nav> |
| 49 | ); |
| 50 | } |
| 51 | |
| 52 | export function KbArticleShell({ children }: { children: ReactNode }) { |
| 53 | return ( |
| 54 | <> |
| 55 | <aside className="sticky top-(--fd-docs-row-1) hidden h-[calc(var(--fd-docs-height)-var(--fd-docs-row-1))] border-r border-fd-border [grid-area:sidebar] md:block md:layout:[--fd-sidebar-width:268px]"> |
| 56 | <div className="ms-auto w-(--fd-sidebar-width) px-6 py-10"> |
| 57 | <ArticleNavigation /> |
| 58 | </div> |
| 59 | </aside> |
| 60 | {children} |
| 61 | </> |
| 62 | ); |
| 63 | } |
| 64 | |
| 65 | export function KbMobileArticleNavigation() { |
| 66 | return ( |
| 67 | <details className="not-prose -mx-4 -mt-6 mb-3 border-b border-fd-border px-4 py-4 md:hidden"> |
| 68 | <summary className="cursor-pointer text-sm font-medium">Browse Knowledge Base</summary> |
| 69 | <div className="pt-5"> |
| 70 | <ArticleNavigation /> |
| 71 | </div> |
| 72 | </details> |
| 73 | ); |
| 74 | } |