@vertesia/tools-admin-ui 1.0.0-dev.20260227.112605Z → 1.0.0-dev.20260305.083323Z
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/AdminApp.d.ts +3 -1
- package/lib/AdminApp.d.ts.map +1 -1
- package/lib/components/AdminTopBar.d.ts +6 -0
- package/lib/components/AdminTopBar.d.ts.map +1 -0
- package/lib/components/CollectionCard.d.ts.map +1 -1
- package/lib/components/DetailPage.d.ts.map +1 -1
- package/lib/components/EndpointPanel.d.ts.map +1 -1
- package/lib/components/HeroSection.d.ts.map +1 -1
- package/lib/components/ResourceCard.d.ts.map +1 -1
- package/lib/components/ResourceSection.d.ts.map +1 -1
- package/lib/components/SearchBar.d.ts.map +1 -1
- package/lib/components/SummaryBadge.d.ts.map +1 -1
- package/lib/components/index.d.ts +6 -5
- package/lib/components/index.d.ts.map +1 -1
- package/lib/components/typeVariants.d.ts +5 -0
- package/lib/components/typeVariants.d.ts.map +1 -0
- package/lib/hooks.d.ts +1 -1
- package/lib/hooks.d.ts.map +1 -1
- package/lib/pages/HomePage.d.ts.map +1 -1
- package/lib/pages/InteractionCollection.d.ts.map +1 -1
- package/lib/pages/InteractionDetail.d.ts.map +1 -1
- package/lib/pages/SkillCollection.d.ts.map +1 -1
- package/lib/pages/SkillDetail.d.ts.map +1 -1
- package/lib/pages/TemplateCollection.d.ts.map +1 -1
- package/lib/pages/TemplateDetail.d.ts.map +1 -1
- package/lib/pages/ToolCollection.d.ts.map +1 -1
- package/lib/pages/TypeCollection.d.ts.map +1 -1
- package/lib/pages/TypeDetail.d.ts.map +1 -1
- package/lib/tools-admin-ui.js +410 -377
- package/lib/tools-admin-ui.js.map +1 -1
- package/package.json +8 -4
- package/src/AdminApp.tsx +21 -17
- package/src/components/AdminTopBar.tsx +39 -0
- package/src/components/CollectionCard.tsx +18 -13
- package/src/components/DetailPage.tsx +20 -11
- package/src/components/EndpointPanel.tsx +16 -7
- package/src/components/HeroSection.tsx +51 -45
- package/src/components/ResourceCard.tsx +23 -18
- package/src/components/ResourceSection.tsx +7 -5
- package/src/components/SearchBar.tsx +8 -6
- package/src/components/SummaryBadge.tsx +4 -3
- package/src/components/index.ts +6 -5
- package/src/components/typeVariants.ts +18 -0
- package/src/dev/index.css +13 -0
- package/src/dev/main.tsx +5 -2
- package/src/hooks.ts +2 -1
- package/src/pages/HomePage.tsx +18 -15
- package/src/pages/InteractionCollection.tsx +25 -27
- package/src/pages/InteractionDetail.tsx +35 -34
- package/src/pages/SkillCollection.tsx +29 -32
- package/src/pages/SkillDetail.tsx +31 -41
- package/src/pages/TemplateCollection.tsx +25 -21
- package/src/pages/TemplateDetail.tsx +18 -17
- package/src/pages/ToolCollection.tsx +22 -16
- package/src/pages/TypeCollection.tsx +32 -24
- package/src/pages/TypeDetail.tsx +16 -18
- package/src/theme.css +12 -0
- package/src/admin.css +0 -650
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Avatar, Button, ModeToggle } from '@vertesia/ui/core';
|
|
2
|
+
import { useUserSession } from '@vertesia/ui/session';
|
|
3
|
+
import { LogOut } from 'lucide-react';
|
|
4
|
+
|
|
5
|
+
interface AdminTopBarProps {
|
|
6
|
+
title: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function AdminTopBar({ title }: AdminTopBarProps) {
|
|
10
|
+
const { user, logout } = useUserSession();
|
|
11
|
+
|
|
12
|
+
return (
|
|
13
|
+
<header className="sticky top-0 z-40 flex h-14 items-center justify-between border-b border-border bg-background px-6">
|
|
14
|
+
<div className="flex items-center gap-3">
|
|
15
|
+
<div className="flex size-8 items-center justify-center rounded-lg bg-primary text-xs font-semibold uppercase tracking-wider text-primary-foreground">
|
|
16
|
+
{title.split(/\s+/).map(w => w[0]).filter(Boolean).slice(0, 2).join('')}
|
|
17
|
+
</div>
|
|
18
|
+
<span className="text-sm font-semibold text-foreground">{title}</span>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<div className="flex items-center gap-3">
|
|
22
|
+
<ModeToggle label={false} />
|
|
23
|
+
{user && (
|
|
24
|
+
<>
|
|
25
|
+
<Avatar size="sm" name={user.name} color="bg-primary" />
|
|
26
|
+
<Button
|
|
27
|
+
variant="outline"
|
|
28
|
+
size="sm"
|
|
29
|
+
onClick={() => logout()}
|
|
30
|
+
alt="Sign out"
|
|
31
|
+
>
|
|
32
|
+
<LogOut className="size-4" />
|
|
33
|
+
</Button>
|
|
34
|
+
</>
|
|
35
|
+
)}
|
|
36
|
+
</div>
|
|
37
|
+
</header>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
@@ -1,23 +1,28 @@
|
|
|
1
|
+
import { Card, CardContent } from '@vertesia/ui/core';
|
|
1
2
|
import { NavLink } from '@vertesia/ui/router';
|
|
3
|
+
|
|
2
4
|
import type { CollectionInfo } from '../types.js';
|
|
5
|
+
import { TYPE_VARIANTS } from './typeVariants.js';
|
|
3
6
|
|
|
4
7
|
export function CollectionCard({ collection }: { collection: CollectionInfo }) {
|
|
5
8
|
const href = `/${collection.type}s/${collection.name}`;
|
|
6
9
|
|
|
7
10
|
return (
|
|
8
|
-
<NavLink href={href} className="
|
|
9
|
-
<
|
|
10
|
-
<
|
|
11
|
-
{collection.type}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
11
|
+
<NavLink href={href} className="block no-underline">
|
|
12
|
+
<Card className="cursor-pointer transition-all hover:-translate-y-0.5 hover:shadow-md">
|
|
13
|
+
<CardContent className="p-5">
|
|
14
|
+
<span className={`mb-2 inline-block rounded-full px-2 py-0.5 text-[0.7rem] font-semibold uppercase tracking-wide ${TYPE_VARIANTS[collection.type] ?? ''}`}>
|
|
15
|
+
{collection.type}
|
|
16
|
+
</span>
|
|
17
|
+
<div className="font-semibold text-card-foreground">{collection.title}</div>
|
|
18
|
+
<div className="mt-1 text-sm text-muted-foreground">
|
|
19
|
+
{collection.description || 'No description'}
|
|
20
|
+
</div>
|
|
21
|
+
<div className="mt-2 font-mono text-xs text-muted-foreground">
|
|
22
|
+
{collection.count} {collection.count === 1 ? 'item' : 'items'}
|
|
23
|
+
</div>
|
|
24
|
+
</CardContent>
|
|
25
|
+
</Card>
|
|
21
26
|
</NavLink>
|
|
22
27
|
);
|
|
23
28
|
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { Badge } from '@vertesia/ui/core';
|
|
2
|
+
import { NavLink } from '@vertesia/ui/router';
|
|
3
|
+
import { ArrowLeft } from 'lucide-react';
|
|
1
4
|
import type { ReactNode } from 'react';
|
|
5
|
+
|
|
2
6
|
import type { ResourceType } from '../types.js';
|
|
3
|
-
import {
|
|
7
|
+
import { TYPE_VARIANTS } from './typeVariants.js';
|
|
4
8
|
|
|
5
9
|
interface DetailPageProps {
|
|
6
10
|
type: ResourceType;
|
|
@@ -13,22 +17,27 @@ interface DetailPageProps {
|
|
|
13
17
|
|
|
14
18
|
export function DetailPage({ type, title, description, tags, backHref = '/', children }: DetailPageProps) {
|
|
15
19
|
return (
|
|
16
|
-
<div className="
|
|
17
|
-
<nav className="
|
|
20
|
+
<div className="mx-auto max-w-5xl px-7 py-10">
|
|
21
|
+
<nav className="mb-5 flex items-center gap-4">
|
|
18
22
|
{backHref !== '/' && (
|
|
19
|
-
<NavLink href="/" className="
|
|
23
|
+
<NavLink href="/" className="text-sm text-primary hover:opacity-75">Home</NavLink>
|
|
20
24
|
)}
|
|
21
|
-
<NavLink href={backHref} className="
|
|
25
|
+
<NavLink href={backHref} className="flex items-center gap-1 text-sm text-primary hover:opacity-75">
|
|
26
|
+
<ArrowLeft className="size-3.5" />
|
|
27
|
+
Back
|
|
28
|
+
</NavLink>
|
|
22
29
|
</nav>
|
|
23
30
|
|
|
24
|
-
<div className="
|
|
25
|
-
<span className={`
|
|
26
|
-
|
|
27
|
-
|
|
31
|
+
<div className="mb-8">
|
|
32
|
+
<span className={`mb-2 inline-block rounded-full px-2 py-0.5 text-[0.7rem] font-semibold uppercase tracking-wide ${TYPE_VARIANTS[type] ?? ''}`}>
|
|
33
|
+
{type}
|
|
34
|
+
</span>
|
|
35
|
+
<h1 className="-tracking-wide text-3xl font-bold text-foreground">{title}</h1>
|
|
36
|
+
{description && <p className="mt-1 text-sm leading-relaxed text-muted-foreground">{description}</p>}
|
|
28
37
|
{tags && tags.length > 0 && (
|
|
29
|
-
<div className="
|
|
38
|
+
<div className="mt-3 flex flex-wrap gap-1.5">
|
|
30
39
|
{tags.map(tag => (
|
|
31
|
-
<
|
|
40
|
+
<Badge key={tag} variant="default">{tag}</Badge>
|
|
32
41
|
))}
|
|
33
42
|
</div>
|
|
34
43
|
)}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Button } from '@vertesia/ui/core';
|
|
2
|
+
import { Check, Copy } from 'lucide-react';
|
|
1
3
|
import { useState } from 'react';
|
|
2
4
|
|
|
3
5
|
export function EndpointPanel({ label, path }: { label: string; path: string }) {
|
|
@@ -11,13 +13,20 @@ export function EndpointPanel({ label, path }: { label: string; path: string })
|
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
return (
|
|
14
|
-
<div className="
|
|
15
|
-
<div className="
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
<div className="mb-3">
|
|
17
|
+
<div className="mb-1 text-[0.7rem] font-medium uppercase tracking-widest text-primary">
|
|
18
|
+
{label}
|
|
19
|
+
</div>
|
|
20
|
+
<div className="flex items-center gap-2 rounded-lg border border-border bg-muted-background px-3 py-2">
|
|
21
|
+
<code className="flex-1 font-mono text-sm text-foreground">{path}</code>
|
|
22
|
+
<Button
|
|
23
|
+
variant="ghost"
|
|
24
|
+
size="xs"
|
|
25
|
+
onClick={handleCopy}
|
|
26
|
+
aria-label="Copy full URL"
|
|
27
|
+
>
|
|
28
|
+
{copied ? <Check className="size-3.5" /> : <Copy className="size-3.5" />}
|
|
29
|
+
</Button>
|
|
21
30
|
</div>
|
|
22
31
|
</div>
|
|
23
32
|
);
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { Card } from '@vertesia/ui/core';
|
|
2
|
+
import { Download, LayoutDashboard } from 'lucide-react';
|
|
3
|
+
|
|
1
4
|
import type { ResourceItem, ResourceType } from '../types.js';
|
|
2
5
|
import { EndpointPanel } from './EndpointPanel.js';
|
|
3
6
|
import { SummaryBadge } from './SummaryBadge.js';
|
|
@@ -33,56 +36,59 @@ export function HeroSection({ title, version, resources }: HeroSectionProps) {
|
|
|
33
36
|
const counts = countByType(resources);
|
|
34
37
|
|
|
35
38
|
return (
|
|
36
|
-
<
|
|
37
|
-
<div className="
|
|
38
|
-
<div className="
|
|
39
|
-
<div className="
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
<
|
|
44
|
-
|
|
39
|
+
<Card className="mb-10 overflow-hidden border bg-linear-to-br from-card to-muted-background">
|
|
40
|
+
<div className="flex flex-col gap-6 p-6 md:flex-row md:items-start md:justify-between">
|
|
41
|
+
<div className="flex flex-1 flex-col gap-3">
|
|
42
|
+
<div className="flex items-center gap-4">
|
|
43
|
+
<div className="flex size-14 items-center justify-center rounded-xl bg-linear-to-br from-sky-400 to-indigo-500 text-sm font-semibold uppercase tracking-wider text-white shadow-lg">
|
|
44
|
+
{getInitials(title)}
|
|
45
|
+
</div>
|
|
46
|
+
<div>
|
|
47
|
+
<p className="text-xs font-medium uppercase tracking-widest text-muted-foreground">Tools Server</p>
|
|
48
|
+
<h1 className="-tracking-wide text-2xl font-bold text-foreground">{title}</h1>
|
|
49
|
+
</div>
|
|
45
50
|
</div>
|
|
46
|
-
</div>
|
|
47
51
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
<p className="text-sm text-muted-foreground">
|
|
53
|
+
Discover the tools, skills, interactions, and content types exposed by this server.
|
|
54
|
+
</p>
|
|
51
55
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
<div className="flex flex-wrap gap-2">
|
|
57
|
+
{badgeLabels.map(({ type, label }) => (
|
|
58
|
+
<SummaryBadge key={type} count={counts[type] || 0} label={label} />
|
|
59
|
+
))}
|
|
60
|
+
</div>
|
|
57
61
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
62
|
+
<div className="flex flex-wrap gap-3 pt-1">
|
|
63
|
+
<a
|
|
64
|
+
href="/app/"
|
|
65
|
+
target="_blank"
|
|
66
|
+
rel="noopener noreferrer"
|
|
67
|
+
className="inline-flex h-8 items-center gap-2 rounded bg-primary px-3 text-xs font-medium text-white shadow-xs hover:bg-primary/90"
|
|
68
|
+
>
|
|
69
|
+
<LayoutDashboard className="size-4" />
|
|
70
|
+
UI Plugin Dev
|
|
71
|
+
</a>
|
|
72
|
+
<a
|
|
73
|
+
href="/lib/plugin.js"
|
|
74
|
+
className="inline-flex h-8 items-center gap-2 rounded bg-primary/5 px-3 text-xs font-medium text-primary shadow-xs hover:bg-primary/10 dark:bg-primary/10 dark:hover:bg-primary/20"
|
|
75
|
+
>
|
|
76
|
+
<Download className="size-4" />
|
|
77
|
+
Plugin Bundle
|
|
78
|
+
</a>
|
|
79
|
+
</div>
|
|
74
80
|
</div>
|
|
75
|
-
</div>
|
|
76
81
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
<aside className="min-w-55 max-w-65 shrink-0">
|
|
83
|
+
<EndpointPanel label="Base endpoint" path="/api" />
|
|
84
|
+
<EndpointPanel label="Package endpoint" path="/api/package" />
|
|
85
|
+
<p className="mt-2 text-xs leading-relaxed text-muted-foreground">
|
|
86
|
+
Use <strong className="text-foreground">POST /api/tools/<collection></strong> or{' '}
|
|
87
|
+
<strong className="text-foreground">POST /api/skills/<collection></strong> to call these from your apps or agents.
|
|
88
|
+
</p>
|
|
89
|
+
<p className="mt-1 text-xs text-muted-foreground">v{version}</p>
|
|
90
|
+
</aside>
|
|
91
|
+
</div>
|
|
92
|
+
</Card>
|
|
87
93
|
);
|
|
88
94
|
}
|
|
@@ -1,25 +1,30 @@
|
|
|
1
|
+
import { Badge, Card, CardContent } from '@vertesia/ui/core';
|
|
2
|
+
|
|
1
3
|
import type { ResourceItem } from '../types.js';
|
|
4
|
+
import { TYPE_VARIANTS } from './typeVariants.js';
|
|
2
5
|
|
|
3
6
|
export function ResourceCard({ resource }: { resource: ResourceItem }) {
|
|
4
7
|
return (
|
|
5
|
-
<
|
|
6
|
-
<
|
|
7
|
-
{resource.type}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
{resource.tags && resource.tags.length > 0 && (
|
|
14
|
-
<div className="vta-card-tags">
|
|
15
|
-
{resource.tags.map(tag => (
|
|
16
|
-
<span key={tag} className="vta-tag">{tag}</span>
|
|
17
|
-
))}
|
|
8
|
+
<Card className="transition-all hover:-translate-y-0.5 hover:shadow-md">
|
|
9
|
+
<CardContent className="p-5">
|
|
10
|
+
<span className={`mb-2 inline-block rounded-full px-2 py-0.5 text-[0.7rem] font-semibold uppercase tracking-wide ${TYPE_VARIANTS[resource.type] ?? ''}`}>
|
|
11
|
+
{resource.type}
|
|
12
|
+
</span>
|
|
13
|
+
<div className="font-semibold text-card-foreground">{resource.title}</div>
|
|
14
|
+
<div className="mt-1 text-sm text-muted-foreground">
|
|
15
|
+
{resource.description || 'No description'}
|
|
18
16
|
</div>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
{resource.tags && resource.tags.length > 0 && (
|
|
18
|
+
<div className="mt-2 flex flex-wrap gap-1">
|
|
19
|
+
{resource.tags.map(tag => (
|
|
20
|
+
<Badge key={tag} variant="default">{tag}</Badge>
|
|
21
|
+
))}
|
|
22
|
+
</div>
|
|
23
|
+
)}
|
|
24
|
+
{resource.url && (
|
|
25
|
+
<div className="mt-2 truncate font-mono text-xs text-muted-foreground">{resource.url}</div>
|
|
26
|
+
)}
|
|
27
|
+
</CardContent>
|
|
28
|
+
</Card>
|
|
24
29
|
);
|
|
25
30
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Separator } from '@vertesia/ui/core';
|
|
2
|
+
|
|
1
3
|
import type { ResourceItem } from '../types.js';
|
|
2
4
|
import { ResourceCard } from './ResourceCard.js';
|
|
3
5
|
|
|
@@ -13,15 +15,15 @@ export function ResourceSection({ title, subtitle, resources, showDivider }: Res
|
|
|
13
15
|
|
|
14
16
|
return (
|
|
15
17
|
<section>
|
|
16
|
-
{showDivider && <
|
|
18
|
+
{showDivider && <Separator className="my-8" />}
|
|
17
19
|
<div>
|
|
18
|
-
<h2 className="
|
|
20
|
+
<h2 className="text-xl font-semibold text-foreground">
|
|
19
21
|
{title}
|
|
20
|
-
<span className="
|
|
22
|
+
<span className="ml-2 text-sm font-normal text-muted-foreground">({resources.length})</span>
|
|
21
23
|
</h2>
|
|
22
|
-
<p className="
|
|
24
|
+
<p className="mb-4 text-sm text-muted-foreground">{subtitle}</p>
|
|
23
25
|
</div>
|
|
24
|
-
<div className="
|
|
26
|
+
<div className="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">
|
|
25
27
|
{resources.map(r => (
|
|
26
28
|
<ResourceCard key={`${r.type}:${r.name}`} resource={r} />
|
|
27
29
|
))}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Input } from '@vertesia/ui/core';
|
|
2
|
+
|
|
1
3
|
interface SearchBarProps {
|
|
2
4
|
value: string;
|
|
3
5
|
onChange: (value: string) => void;
|
|
@@ -11,22 +13,22 @@ export function SearchBar({ value, onChange, placeholder, resultCount, totalCoun
|
|
|
11
13
|
const noResults = hasQuery && resultCount === 0;
|
|
12
14
|
|
|
13
15
|
return (
|
|
14
|
-
<div className="
|
|
15
|
-
<
|
|
16
|
+
<div className="mb-7">
|
|
17
|
+
<Input
|
|
16
18
|
type="search"
|
|
17
19
|
value={value}
|
|
18
|
-
onChange={
|
|
20
|
+
onChange={onChange}
|
|
19
21
|
placeholder={placeholder || 'Search collections...'}
|
|
20
|
-
className="
|
|
22
|
+
className="max-w-sm rounded-full"
|
|
21
23
|
autoComplete="off"
|
|
22
24
|
/>
|
|
23
25
|
{hasQuery && !noResults && (
|
|
24
|
-
<p className="
|
|
26
|
+
<p className="mt-1.5 text-xs text-muted-foreground">
|
|
25
27
|
Showing {resultCount} of {totalCount} resources
|
|
26
28
|
</p>
|
|
27
29
|
)}
|
|
28
30
|
{noResults && (
|
|
29
|
-
<p className="
|
|
31
|
+
<p className="mt-2 text-sm text-destructive">
|
|
30
32
|
No resources match this search.
|
|
31
33
|
</p>
|
|
32
34
|
)}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
+
import { DotBadge } from '@vertesia/ui/core';
|
|
2
|
+
|
|
1
3
|
export function SummaryBadge({ count, label }: { count: number; label: string }) {
|
|
2
4
|
if (count === 0) return null;
|
|
3
5
|
return (
|
|
4
|
-
<
|
|
5
|
-
<span className="vta-badge-dot" />
|
|
6
|
+
<DotBadge variant="success">
|
|
6
7
|
{count} {label}{count !== 1 ? 's' : ''}
|
|
7
|
-
</
|
|
8
|
+
</DotBadge>
|
|
8
9
|
);
|
|
9
10
|
}
|
package/src/components/index.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { SearchBar } from './SearchBar.js';
|
|
3
|
-
export { ResourceSection } from './ResourceSection.js';
|
|
4
|
-
export { ResourceCard } from './ResourceCard.js';
|
|
1
|
+
export { AdminTopBar } from './AdminTopBar.js';
|
|
5
2
|
export { CollectionCard } from './CollectionCard.js';
|
|
3
|
+
export { DetailPage } from './DetailPage.js';
|
|
6
4
|
export { EndpointPanel } from './EndpointPanel.js';
|
|
5
|
+
export { HeroSection } from './HeroSection.js';
|
|
6
|
+
export { ResourceCard } from './ResourceCard.js';
|
|
7
|
+
export { ResourceSection } from './ResourceSection.js';
|
|
8
|
+
export { SearchBar } from './SearchBar.js';
|
|
7
9
|
export { SummaryBadge } from './SummaryBadge.js';
|
|
8
|
-
export { DetailPage } from './DetailPage.js';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** Tailwind class mappings for resource type badges. */
|
|
2
|
+
export const TYPE_VARIANTS: Record<string, string> = {
|
|
3
|
+
tool: 'bg-blue-100 text-blue-800 dark:bg-blue-500/15 dark:text-blue-300',
|
|
4
|
+
skill: 'bg-emerald-100 text-emerald-800 dark:bg-emerald-500/15 dark:text-emerald-300',
|
|
5
|
+
interaction: 'bg-amber-100 text-amber-800 dark:bg-amber-500/15 dark:text-amber-300',
|
|
6
|
+
type: 'bg-gray-100 text-gray-700 dark:bg-gray-500/20 dark:text-gray-300',
|
|
7
|
+
template: 'bg-violet-100 text-violet-800 dark:bg-violet-500/15 dark:text-violet-300',
|
|
8
|
+
mcp: 'bg-pink-100 text-pink-800 dark:bg-pink-500/15 dark:text-pink-300',
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/** Tailwind class mappings for prompt role badges. */
|
|
12
|
+
export const ROLE_VARIANTS: Record<string, string> = {
|
|
13
|
+
system: 'bg-blue-100 text-blue-800 dark:bg-blue-500/15 dark:text-blue-300',
|
|
14
|
+
user: 'bg-emerald-100 text-emerald-800 dark:bg-emerald-500/15 dark:text-emerald-300',
|
|
15
|
+
assistant: 'bg-violet-100 text-violet-800 dark:bg-violet-500/15 dark:text-violet-300',
|
|
16
|
+
safety: 'bg-pink-100 text-pink-800 dark:bg-pink-500/15 dark:text-pink-300',
|
|
17
|
+
tool: 'bg-amber-100 text-amber-800 dark:bg-amber-500/15 dark:text-amber-300',
|
|
18
|
+
};
|
package/src/dev/main.tsx
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
/// <reference types="vite/client" />
|
|
2
|
+
import './index.css';
|
|
2
3
|
import "./env.js"
|
|
4
|
+
|
|
5
|
+
import { VertesiaShell } from '@vertesia/ui/shell';
|
|
6
|
+
import { RouterProvider } from '@vertesia/ui/router';
|
|
3
7
|
import { StrictMode } from 'react';
|
|
4
8
|
import { createRoot } from 'react-dom/client';
|
|
5
|
-
|
|
9
|
+
|
|
6
10
|
import { AdminApp } from '../AdminApp.js';
|
|
7
|
-
import { VertesiaShell } from '@vertesia/ui/shell';
|
|
8
11
|
|
|
9
12
|
const baseUrl = import.meta.env.VITE_API_BASE_URL;
|
|
10
13
|
|
package/src/hooks.ts
CHANGED
package/src/pages/HomePage.tsx
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { Separator } from '@vertesia/ui/core';
|
|
1
2
|
import { useMemo, useState } from 'react';
|
|
3
|
+
|
|
4
|
+
import { useAdminContext } from '../AdminContext.js';
|
|
5
|
+
import { CollectionCard, HeroSection, ResourceSection, SearchBar } from '../components/index.js';
|
|
6
|
+
import { TYPE_VARIANTS } from '../components/typeVariants.js';
|
|
2
7
|
import type { ResourceType } from '../types.js';
|
|
3
8
|
import { filterResources } from '../types.js';
|
|
4
|
-
import { HeroSection, SearchBar, ResourceSection, CollectionCard } from '../components/index.js';
|
|
5
|
-
import { useAdminContext } from '../AdminContext.js';
|
|
6
9
|
|
|
7
10
|
const sections: { type: ResourceType; title: string; subtitle: string }[] = [
|
|
8
11
|
{ type: 'tool', title: 'Tools', subtitle: 'Remote tools available to agents via Vertesia.' },
|
|
@@ -25,7 +28,7 @@ export function HomePage() {
|
|
|
25
28
|
const isSearching = search.trim().length > 0;
|
|
26
29
|
|
|
27
30
|
return (
|
|
28
|
-
<div className="
|
|
31
|
+
<div className="mx-auto max-w-5xl px-7 py-10">
|
|
29
32
|
<HeroSection
|
|
30
33
|
title={serverInfo.message.replace('Vertesia Tools API', 'Tools Server')}
|
|
31
34
|
version={serverInfo.version}
|
|
@@ -41,7 +44,6 @@ export function HomePage() {
|
|
|
41
44
|
/>
|
|
42
45
|
|
|
43
46
|
{isSearching ? (
|
|
44
|
-
/* Search mode: show individual resource cards */
|
|
45
47
|
sections.map((section, i) => {
|
|
46
48
|
const sectionItems = filtered.filter(r => r.type === section.type);
|
|
47
49
|
return (
|
|
@@ -55,7 +57,6 @@ export function HomePage() {
|
|
|
55
57
|
);
|
|
56
58
|
})
|
|
57
59
|
) : (
|
|
58
|
-
/* Browse mode: show collection cards grouped by type */
|
|
59
60
|
sections.map((section, i) => {
|
|
60
61
|
const sectionCollections = collections.filter(c => c.type === section.type);
|
|
61
62
|
const mcpResources = section.type === 'mcp'
|
|
@@ -66,27 +67,29 @@ export function HomePage() {
|
|
|
66
67
|
|
|
67
68
|
return (
|
|
68
69
|
<section key={section.type}>
|
|
69
|
-
{i > 0 && <
|
|
70
|
+
{i > 0 && <Separator className="my-8" />}
|
|
70
71
|
<div>
|
|
71
|
-
<h2 className="
|
|
72
|
+
<h2 className="text-xl font-semibold text-foreground">
|
|
72
73
|
{section.title}
|
|
73
|
-
<span className="
|
|
74
|
+
<span className="ml-2 text-sm font-normal text-muted-foreground">
|
|
74
75
|
({sectionCollections.length}{sectionCollections.length === 1
|
|
75
76
|
? ' collection' : ' collections'})
|
|
76
77
|
</span>
|
|
77
78
|
</h2>
|
|
78
|
-
<p className="
|
|
79
|
+
<p className="mb-4 text-sm text-muted-foreground">{section.subtitle}</p>
|
|
79
80
|
</div>
|
|
80
|
-
<div className="
|
|
81
|
+
<div className="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">
|
|
81
82
|
{sectionCollections.map(col => (
|
|
82
83
|
<CollectionCard key={`${col.type}:${col.name}`} collection={col} />
|
|
83
84
|
))}
|
|
84
85
|
{mcpResources.map(r => (
|
|
85
|
-
<div key={r.name} className="
|
|
86
|
-
<span className=
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
<div key={r.name} className="rounded-xl border border-border bg-card p-5 shadow-sm">
|
|
87
|
+
<span className={`mb-2 inline-block rounded-full px-2 py-0.5 text-[0.7rem] font-semibold uppercase tracking-wide ${TYPE_VARIANTS.mcp}`}>
|
|
88
|
+
mcp
|
|
89
|
+
</span>
|
|
90
|
+
<div className="font-semibold text-card-foreground">{r.title}</div>
|
|
91
|
+
<div className="mt-1 text-sm text-muted-foreground">{r.description || 'No description'}</div>
|
|
92
|
+
{r.url && <div className="mt-2 truncate font-mono text-xs text-muted-foreground">{r.url}</div>}
|
|
90
93
|
</div>
|
|
91
94
|
))}
|
|
92
95
|
</div>
|