@devries-cameron20 / composio Mirror · read-only
Fork 0

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, 03:37 UTC

next
tsx 42 lines 1.49 KB
Raw
1 import { preloadFile } from '@pierre/diffs/ssr';
2 import { RepoBrowserClient, type RepoFile } from './repo-browser-client';
3 import { EXAMPLE_SOURCES } from '@/lib/example-sources';
4
5 /**
6 * RepoBrowser — a real slice of an example project as a browsable tree + code
7 * viewer. The Composio touch-points are highlighted; each file's code is
8 * prerendered on the server with @pierre/diffs.
9 *
10 * `source` selects which example's snapshot to show (default: the slack-bot /
11 * Pi example, so existing pages are unaffected). Pass `caption={null}` to hide
12 * the little caption above the tree.
13 */
14 export async function RepoBrowser({
15 source = 'slack-bot',
16 caption = 'a slice of the real project, the Composio files do the work',
17 heightClass,
18 }: {
19 source?: keyof typeof EXAMPLE_SOURCES;
20 caption?: string | null;
21 heightClass?: string;
22 }) {
23 const data = EXAMPLE_SOURCES[source];
24
25 const files: RepoFile[] = [];
26 for (const f of data) {
27 const { prerenderedHTML } = await preloadFile({ file: { name: f.path, contents: f.contents } });
28 files.push({ ...f, prerenderedHTML });
29 }
30
31 return (
32 <div className="not-prose my-6">
33 {caption ? (
34 <div className="mb-2 flex items-center gap-1.5 font-mono text-[10px] uppercase tracking-[0.06em] text-fd-foreground/45">
35 <span className="size-1.5 rounded-full bg-[var(--composio-brand)]" aria-hidden="true" />
36 {caption}
37 </div>
38 ) : null}
39 <RepoBrowserClient files={files} heightClass={heightClass} />
40 </div>
41 );
42 }