@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
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { useFetch } from '@vertesia/ui/core';
|
|
1
|
+
import { Card, CardContent, Spinner, useFetch } from '@vertesia/ui/core';
|
|
2
2
|
import { useParams } from '@vertesia/ui/router';
|
|
3
|
+
|
|
3
4
|
import { useAdminContext } from '../AdminContext.js';
|
|
4
5
|
import { DetailPage } from '../components/DetailPage.js';
|
|
6
|
+
import { TYPE_VARIANTS } from '../components/typeVariants.js';
|
|
5
7
|
|
|
6
8
|
interface ToolDef {
|
|
7
9
|
name: string;
|
|
@@ -19,7 +21,7 @@ export function ToolCollection() {
|
|
|
19
21
|
const collection = useParams('collection');
|
|
20
22
|
const { baseUrl } = useAdminContext();
|
|
21
23
|
|
|
22
|
-
const { data,
|
|
24
|
+
const { data, error } = useFetch<ToolCollectionResponse>(
|
|
23
25
|
() => fetch(`${baseUrl}/tools/${collection}`).then(r => {
|
|
24
26
|
if (!r.ok) throw new Error(`Failed to load collection: ${r.statusText}`);
|
|
25
27
|
return r.json();
|
|
@@ -27,8 +29,8 @@ export function ToolCollection() {
|
|
|
27
29
|
[baseUrl, collection]
|
|
28
30
|
);
|
|
29
31
|
|
|
30
|
-
if (
|
|
31
|
-
if (
|
|
32
|
+
if (error) return <div className="p-6 text-destructive">Failed to load tool collection “{collection}”.</div>;
|
|
33
|
+
if (!data) return <div className="flex h-64 items-center justify-center text-muted-foreground"><Spinner /></div>;
|
|
32
34
|
|
|
33
35
|
return (
|
|
34
36
|
<DetailPage
|
|
@@ -37,18 +39,22 @@ export function ToolCollection() {
|
|
|
37
39
|
description={data.description || `${data.tools.length} tool${data.tools.length !== 1 ? 's' : ''} in this collection.`}
|
|
38
40
|
>
|
|
39
41
|
{data.tools.map(tool => (
|
|
40
|
-
<
|
|
41
|
-
<
|
|
42
|
-
<
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
42
|
+
<Card key={tool.name} className="mb-4">
|
|
43
|
+
<CardContent className="p-5">
|
|
44
|
+
<div className="mb-2 flex items-center gap-2">
|
|
45
|
+
<span className={`inline-block rounded-full px-2 py-0.5 text-[0.7rem] font-semibold uppercase tracking-wide ${TYPE_VARIANTS.tool}`}>
|
|
46
|
+
tool
|
|
47
|
+
</span>
|
|
48
|
+
<span className="font-semibold text-card-foreground">{tool.name}</span>
|
|
49
|
+
</div>
|
|
50
|
+
<div className="text-sm text-muted-foreground">{tool.description || 'No description'}</div>
|
|
51
|
+
{tool.input_schema && (
|
|
52
|
+
<pre className="mt-3 whitespace-pre-wrap wrap-break-word rounded-lg border border-border bg-muted-background p-4 font-mono text-sm text-foreground">
|
|
53
|
+
{JSON.stringify(tool.input_schema, null, 2)}
|
|
54
|
+
</pre>
|
|
55
|
+
)}
|
|
56
|
+
</CardContent>
|
|
57
|
+
</Card>
|
|
52
58
|
))}
|
|
53
59
|
</DetailPage>
|
|
54
60
|
);
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { useFetch } from '@vertesia/ui/core';
|
|
2
|
-
import { useParams, NavLink } from '@vertesia/ui/router';
|
|
3
1
|
import type { InCodeTypeDefinition } from '@vertesia/common';
|
|
2
|
+
import { Badge, Card, CardContent, Spinner, useFetch } from '@vertesia/ui/core';
|
|
3
|
+
import { NavLink, useParams } from '@vertesia/ui/router';
|
|
4
|
+
|
|
4
5
|
import { useAdminContext } from '../AdminContext.js';
|
|
5
6
|
import { DetailPage } from '../components/DetailPage.js';
|
|
7
|
+
import { TYPE_VARIANTS } from '../components/typeVariants.js';
|
|
6
8
|
|
|
7
9
|
export function TypeCollection() {
|
|
8
10
|
const collection = useParams('collection');
|
|
9
11
|
const { baseUrl } = useAdminContext();
|
|
10
12
|
|
|
11
|
-
const { data: types,
|
|
13
|
+
const { data: types, error } = useFetch<InCodeTypeDefinition[]>(
|
|
12
14
|
() => fetch(`${baseUrl}/types/${collection}`).then(r => {
|
|
13
15
|
if (!r.ok) throw new Error(`Failed to load collection: ${r.statusText}`);
|
|
14
16
|
return r.json();
|
|
@@ -16,8 +18,8 @@ export function TypeCollection() {
|
|
|
16
18
|
[baseUrl, collection]
|
|
17
19
|
);
|
|
18
20
|
|
|
19
|
-
if (
|
|
20
|
-
if (
|
|
21
|
+
if (error) return <div className="p-6 text-destructive">Failed to load type collection “{collection}”.</div>;
|
|
22
|
+
if (!types) return <div className="flex h-64 items-center justify-center text-muted-foreground"><Spinner /></div>;
|
|
21
23
|
|
|
22
24
|
return (
|
|
23
25
|
<DetailPage
|
|
@@ -25,32 +27,38 @@ export function TypeCollection() {
|
|
|
25
27
|
title={collection}
|
|
26
28
|
description={`${types.length} content type${types.length !== 1 ? 's' : ''} in this collection.`}
|
|
27
29
|
>
|
|
28
|
-
<div className="
|
|
30
|
+
<div className="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">
|
|
29
31
|
{types.map(t => {
|
|
30
32
|
const typeName = t.id?.split(':')[1] || t.name;
|
|
31
33
|
return (
|
|
32
34
|
<NavLink
|
|
33
35
|
key={t.name}
|
|
34
36
|
href={`/types/${collection}/${typeName}`}
|
|
35
|
-
className="
|
|
37
|
+
className="no-underline"
|
|
36
38
|
>
|
|
37
|
-
<
|
|
38
|
-
<
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
<div className="
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
{t.strict_mode &&
|
|
52
|
-
|
|
53
|
-
|
|
39
|
+
<Card className="h-full transition-all hover:-translate-y-0.5 hover:shadow-md">
|
|
40
|
+
<CardContent className="p-5">
|
|
41
|
+
<span className={`mb-2 inline-block rounded-full px-2 py-0.5 text-[0.7rem] font-semibold uppercase tracking-wide ${TYPE_VARIANTS.type}`}>
|
|
42
|
+
type
|
|
43
|
+
</span>
|
|
44
|
+
<div className="font-semibold text-card-foreground">{t.name}</div>
|
|
45
|
+
<div className="mt-1 text-sm text-muted-foreground">{t.description || 'No description'}</div>
|
|
46
|
+
{t.tags && t.tags.length > 0 && (
|
|
47
|
+
<div className="mt-3 flex flex-wrap gap-1.5">
|
|
48
|
+
{t.tags.map(tag => (
|
|
49
|
+
<Badge key={tag} variant="default">{tag}</Badge>
|
|
50
|
+
))}
|
|
51
|
+
</div>
|
|
52
|
+
)}
|
|
53
|
+
{(t.is_chunkable || t.strict_mode) && (
|
|
54
|
+
<div className="mt-2 truncate font-mono text-xs text-muted-foreground">
|
|
55
|
+
{t.is_chunkable && 'chunkable'}
|
|
56
|
+
{t.is_chunkable && t.strict_mode && ' · '}
|
|
57
|
+
{t.strict_mode && 'strict'}
|
|
58
|
+
</div>
|
|
59
|
+
)}
|
|
60
|
+
</CardContent>
|
|
61
|
+
</Card>
|
|
54
62
|
</NavLink>
|
|
55
63
|
);
|
|
56
64
|
})}
|
package/src/pages/TypeDetail.tsx
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { useFetch } from '@vertesia/ui/core';
|
|
2
|
-
import { useParams } from '@vertesia/ui/router';
|
|
3
1
|
import type { InCodeTypeDefinition } from '@vertesia/common';
|
|
2
|
+
import { Badge, Spinner, useFetch } from '@vertesia/ui/core';
|
|
3
|
+
import { useParams } from '@vertesia/ui/router';
|
|
4
|
+
|
|
4
5
|
import { useAdminContext } from '../AdminContext.js';
|
|
5
6
|
import { DetailPage } from '../components/DetailPage.js';
|
|
6
7
|
|
|
@@ -10,7 +11,7 @@ export function TypeDetail() {
|
|
|
10
11
|
const name = params.name;
|
|
11
12
|
const { baseUrl } = useAdminContext();
|
|
12
13
|
|
|
13
|
-
const { data: typeDef,
|
|
14
|
+
const { data: typeDef, error } = useFetch<InCodeTypeDefinition>(
|
|
14
15
|
() => fetch(`${baseUrl}/types/${collection}/${name}`).then(r => {
|
|
15
16
|
if (!r.ok) throw new Error(`Failed to load type: ${r.statusText}`);
|
|
16
17
|
return r.json();
|
|
@@ -18,8 +19,8 @@ export function TypeDetail() {
|
|
|
18
19
|
[baseUrl, collection, name]
|
|
19
20
|
);
|
|
20
21
|
|
|
21
|
-
if (
|
|
22
|
-
if (
|
|
22
|
+
if (error) return <div className="p-6 text-destructive">Failed to load type “{name}”.</div>;
|
|
23
|
+
if (!typeDef) return <div className="flex h-64 items-center justify-center text-muted-foreground"><Spinner /></div>;
|
|
23
24
|
|
|
24
25
|
return (
|
|
25
26
|
<DetailPage
|
|
@@ -29,31 +30,28 @@ export function TypeDetail() {
|
|
|
29
30
|
tags={typeDef.tags}
|
|
30
31
|
backHref={`/types/${collection}`}
|
|
31
32
|
>
|
|
32
|
-
{/* Flags */}
|
|
33
33
|
{(typeDef.is_chunkable || typeDef.strict_mode) && (
|
|
34
|
-
<div className="
|
|
35
|
-
<div className="
|
|
36
|
-
{typeDef.is_chunkable && <
|
|
37
|
-
{typeDef.strict_mode && <
|
|
34
|
+
<div className="mb-8">
|
|
35
|
+
<div className="flex flex-wrap gap-2">
|
|
36
|
+
{typeDef.is_chunkable && <Badge variant="success">Chunkable</Badge>}
|
|
37
|
+
{typeDef.strict_mode && <Badge variant="success">Strict Mode</Badge>}
|
|
38
38
|
</div>
|
|
39
39
|
</div>
|
|
40
40
|
)}
|
|
41
41
|
|
|
42
|
-
{/* Object Schema */}
|
|
43
42
|
{typeDef.object_schema && (
|
|
44
|
-
<div className="
|
|
45
|
-
<h2>Object Schema</h2>
|
|
46
|
-
<pre className="
|
|
43
|
+
<div className="mb-8">
|
|
44
|
+
<h2 className="mb-3 text-lg font-semibold text-foreground">Object Schema</h2>
|
|
45
|
+
<pre className="whitespace-pre-wrap wrap-break-word rounded-lg border border-border bg-muted-background p-4 font-mono text-sm text-foreground">
|
|
47
46
|
{JSON.stringify(typeDef.object_schema, null, 2)}
|
|
48
47
|
</pre>
|
|
49
48
|
</div>
|
|
50
49
|
)}
|
|
51
50
|
|
|
52
|
-
{/* Table Layout */}
|
|
53
51
|
{typeDef.table_layout && typeDef.table_layout.length > 0 && (
|
|
54
|
-
<div className="
|
|
55
|
-
<h2>Table Layout</h2>
|
|
56
|
-
<pre className="
|
|
52
|
+
<div className="mb-8">
|
|
53
|
+
<h2 className="mb-3 text-lg font-semibold text-foreground">Table Layout</h2>
|
|
54
|
+
<pre className="whitespace-pre-wrap wrap-break-word rounded-lg border border-border bg-muted-background p-4 font-mono text-sm text-foreground">
|
|
57
55
|
{JSON.stringify(typeDef.table_layout, null, 2)}
|
|
58
56
|
</pre>
|
|
59
57
|
</div>
|
package/src/theme.css
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Default theme for @vertesia/tools-admin-ui.
|
|
3
|
+
*
|
|
4
|
+
* Consumers should import this file (or provide their own equivalent)
|
|
5
|
+
* so that @vertesia/ui shadcn components resolve their CSS custom properties.
|
|
6
|
+
*
|
|
7
|
+
* @import '@vertesia/tools-admin-ui/theme.css';
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
@import "@vertesia/ui/styles/color.css";
|
|
11
|
+
@import "@vertesia/ui/styles/theme.css";
|
|
12
|
+
@import "@vertesia/ui/styles/utilities.css";
|