@vertesia/tools-admin-ui 1.2.0 → 1.4.0-dev.20260615.042549Z
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/LICENSE +198 -10
- package/lib/AdminApp.d.ts +1 -1
- package/lib/AdminApp.d.ts.map +1 -1
- package/lib/components/AdminTopBar.d.ts +1 -1
- package/lib/components/AdminTopBar.d.ts.map +1 -1
- package/lib/components/CollectionCard.d.ts +1 -1
- package/lib/components/CollectionCard.d.ts.map +1 -1
- package/lib/components/DetailPage.d.ts +1 -1
- package/lib/components/DetailPage.d.ts.map +1 -1
- package/lib/components/EndpointPanel.d.ts +1 -1
- package/lib/components/EndpointPanel.d.ts.map +1 -1
- package/lib/components/HeroSection.d.ts +1 -1
- package/lib/components/HeroSection.d.ts.map +1 -1
- package/lib/components/ResourceCard.d.ts +1 -1
- package/lib/components/ResourceCard.d.ts.map +1 -1
- package/lib/components/ResourceSection.d.ts +1 -1
- package/lib/components/ResourceSection.d.ts.map +1 -1
- package/lib/components/SearchBar.d.ts +1 -1
- package/lib/components/SearchBar.d.ts.map +1 -1
- package/lib/components/SummaryBadge.d.ts +1 -1
- package/lib/components/SummaryBadge.d.ts.map +1 -1
- package/lib/hooks.d.ts +2 -2
- package/lib/hooks.d.ts.map +1 -1
- package/lib/index.d.ts +4 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/pages/ActivityCollection.d.ts +1 -1
- package/lib/pages/ActivityCollection.d.ts.map +1 -1
- package/lib/pages/HomePage.d.ts +1 -1
- package/lib/pages/HomePage.d.ts.map +1 -1
- package/lib/pages/InteractionCollection.d.ts +1 -1
- package/lib/pages/InteractionCollection.d.ts.map +1 -1
- package/lib/pages/InteractionDetail.d.ts +1 -1
- package/lib/pages/InteractionDetail.d.ts.map +1 -1
- package/lib/pages/SkillCollection.d.ts +1 -1
- package/lib/pages/SkillCollection.d.ts.map +1 -1
- package/lib/pages/SkillDetail.d.ts +1 -1
- package/lib/pages/SkillDetail.d.ts.map +1 -1
- package/lib/pages/TemplateCollection.d.ts +1 -1
- package/lib/pages/TemplateCollection.d.ts.map +1 -1
- package/lib/pages/TemplateDetail.d.ts +1 -1
- package/lib/pages/TemplateDetail.d.ts.map +1 -1
- package/lib/pages/ToolCollection.d.ts +1 -1
- package/lib/pages/ToolCollection.d.ts.map +1 -1
- package/lib/pages/TypeCollection.d.ts +1 -1
- package/lib/pages/TypeCollection.d.ts.map +1 -1
- package/lib/pages/TypeDetail.d.ts +1 -1
- package/lib/pages/TypeDetail.d.ts.map +1 -1
- package/lib/tools-admin-ui.js +1484 -969
- package/lib/tools-admin-ui.js.map +1 -1
- package/lib/types.d.ts.map +1 -1
- package/package.json +16 -14
- package/src/AdminApp.tsx +14 -15
- package/src/components/AdminTopBar.tsx +7 -7
- package/src/components/CollectionCard.tsx +3 -1
- package/src/components/DetailPage.tsx +10 -4
- package/src/components/EndpointPanel.tsx +2 -9
- package/src/components/HeroSection.tsx +12 -3
- package/src/components/ResourceCard.tsx +8 -6
- package/src/components/ResourceSection.tsx +1 -1
- package/src/components/SearchBar.tsx +1 -5
- package/src/components/SummaryBadge.tsx +2 -1
- package/src/dev/env.ts +8 -8
- package/src/dev/main.tsx +20 -15
- package/src/hooks.ts +19 -12
- package/src/index.ts +4 -4
- package/src/pages/ActivityCollection.tsx +30 -12
- package/src/pages/HomePage.tsx +65 -57
- package/src/pages/InteractionCollection.tsx +26 -11
- package/src/pages/InteractionDetail.tsx +28 -13
- package/src/pages/SkillCollection.tsx +38 -18
- package/src/pages/SkillDetail.tsx +37 -13
- package/src/pages/TemplateCollection.tsx +28 -17
- package/src/pages/TemplateDetail.tsx +13 -7
- package/src/pages/ToolCollection.tsx +21 -10
- package/src/pages/TypeCollection.tsx +26 -17
- package/src/pages/TypeDetail.tsx +12 -6
- package/src/types.ts +16 -35
|
@@ -22,27 +22,38 @@ export function ToolCollection() {
|
|
|
22
22
|
const { baseUrl } = useAdminContext();
|
|
23
23
|
|
|
24
24
|
const { data, error } = useFetch<ToolCollectionResponse>(
|
|
25
|
-
() =>
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
() =>
|
|
26
|
+
fetch(`${baseUrl}/tools/${collection}`).then((r) => {
|
|
27
|
+
if (!r.ok) throw new Error(`Failed to load collection: ${r.statusText}`);
|
|
28
|
+
return r.json();
|
|
29
|
+
}),
|
|
30
|
+
[baseUrl, collection],
|
|
30
31
|
);
|
|
31
32
|
|
|
32
|
-
if (error)
|
|
33
|
-
|
|
33
|
+
if (error)
|
|
34
|
+
return <div className="p-6 text-destructive">Failed to load tool collection “{collection}”.</div>;
|
|
35
|
+
if (!data)
|
|
36
|
+
return (
|
|
37
|
+
<div className="flex h-64 items-center justify-center text-muted-foreground">
|
|
38
|
+
<Spinner />
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
34
41
|
|
|
35
42
|
return (
|
|
36
43
|
<DetailPage
|
|
37
44
|
type="tool"
|
|
38
45
|
title={data.title || collection}
|
|
39
|
-
description={
|
|
46
|
+
description={
|
|
47
|
+
data.description || `${data.tools.length} tool${data.tools.length !== 1 ? 's' : ''} in this collection.`
|
|
48
|
+
}
|
|
40
49
|
>
|
|
41
|
-
{data.tools.map(tool => (
|
|
50
|
+
{data.tools.map((tool) => (
|
|
42
51
|
<Card key={tool.name} className="mb-4">
|
|
43
52
|
<CardContent className="p-5">
|
|
44
53
|
<div className="mb-2 flex items-center gap-2">
|
|
45
|
-
<span
|
|
54
|
+
<span
|
|
55
|
+
className={`inline-block rounded-full px-2 py-0.5 text-[0.7rem] font-semibold uppercase tracking-wide ${TYPE_VARIANTS.tool}`}
|
|
56
|
+
>
|
|
46
57
|
tool
|
|
47
58
|
</span>
|
|
48
59
|
<span className="font-semibold text-card-foreground">{tool.name}</span>
|
|
@@ -11,15 +11,22 @@ export function TypeCollection() {
|
|
|
11
11
|
const { baseUrl } = useAdminContext();
|
|
12
12
|
|
|
13
13
|
const { data: types, error } = useFetch<InCodeTypeDefinition[]>(
|
|
14
|
-
() =>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
() =>
|
|
15
|
+
fetch(`${baseUrl}/types/${collection}`).then((r) => {
|
|
16
|
+
if (!r.ok) throw new Error(`Failed to load collection: ${r.statusText}`);
|
|
17
|
+
return r.json();
|
|
18
|
+
}),
|
|
19
|
+
[baseUrl, collection],
|
|
19
20
|
);
|
|
20
21
|
|
|
21
|
-
if (error)
|
|
22
|
-
|
|
22
|
+
if (error)
|
|
23
|
+
return <div className="p-6 text-destructive">Failed to load type collection “{collection}”.</div>;
|
|
24
|
+
if (!types)
|
|
25
|
+
return (
|
|
26
|
+
<div className="flex h-64 items-center justify-center text-muted-foreground">
|
|
27
|
+
<Spinner />
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
23
30
|
|
|
24
31
|
return (
|
|
25
32
|
<DetailPage
|
|
@@ -28,25 +35,27 @@ export function TypeCollection() {
|
|
|
28
35
|
description={`${types.length} content type${types.length !== 1 ? 's' : ''} in this collection.`}
|
|
29
36
|
>
|
|
30
37
|
<div className="grid grid-cols-1 gap-6 sm:grid-cols-2 lg:grid-cols-3">
|
|
31
|
-
{types.map(t => {
|
|
38
|
+
{types.map((t) => {
|
|
32
39
|
const typeName = t.id?.split(':')[1] || t.name;
|
|
33
40
|
return (
|
|
34
|
-
<NavLink
|
|
35
|
-
key={t.name}
|
|
36
|
-
href={`/types/${collection}/${typeName}`}
|
|
37
|
-
className="no-underline"
|
|
38
|
-
>
|
|
41
|
+
<NavLink key={t.name} href={`/types/${collection}/${typeName}`} className="no-underline">
|
|
39
42
|
<Card className="h-full transition-all hover:-translate-y-0.5 hover:shadow-md">
|
|
40
43
|
<CardContent className="p-5">
|
|
41
|
-
<span
|
|
44
|
+
<span
|
|
45
|
+
className={`mb-2 inline-block rounded-full px-2 py-0.5 text-[0.7rem] font-semibold uppercase tracking-wide ${TYPE_VARIANTS.type}`}
|
|
46
|
+
>
|
|
42
47
|
type
|
|
43
48
|
</span>
|
|
44
49
|
<div className="font-semibold text-card-foreground">{t.name}</div>
|
|
45
|
-
<div className="mt-1 text-sm text-muted-foreground">
|
|
50
|
+
<div className="mt-1 text-sm text-muted-foreground">
|
|
51
|
+
{t.description || 'No description'}
|
|
52
|
+
</div>
|
|
46
53
|
{t.tags && t.tags.length > 0 && (
|
|
47
54
|
<div className="mt-3 flex flex-wrap gap-1.5">
|
|
48
|
-
{t.tags.map(tag => (
|
|
49
|
-
<Badge key={tag} variant="default">
|
|
55
|
+
{t.tags.map((tag) => (
|
|
56
|
+
<Badge key={tag} variant="default">
|
|
57
|
+
{tag}
|
|
58
|
+
</Badge>
|
|
50
59
|
))}
|
|
51
60
|
</div>
|
|
52
61
|
)}
|
package/src/pages/TypeDetail.tsx
CHANGED
|
@@ -12,15 +12,21 @@ export function TypeDetail() {
|
|
|
12
12
|
const { baseUrl } = useAdminContext();
|
|
13
13
|
|
|
14
14
|
const { data: typeDef, error } = useFetch<InCodeTypeDefinition>(
|
|
15
|
-
() =>
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
() =>
|
|
16
|
+
fetch(`${baseUrl}/types/${collection}/${name}`).then((r) => {
|
|
17
|
+
if (!r.ok) throw new Error(`Failed to load type: ${r.statusText}`);
|
|
18
|
+
return r.json();
|
|
19
|
+
}),
|
|
20
|
+
[baseUrl, collection, name],
|
|
20
21
|
);
|
|
21
22
|
|
|
22
23
|
if (error) return <div className="p-6 text-destructive">Failed to load type “{name}”.</div>;
|
|
23
|
-
if (!typeDef)
|
|
24
|
+
if (!typeDef)
|
|
25
|
+
return (
|
|
26
|
+
<div className="flex h-64 items-center justify-center text-muted-foreground">
|
|
27
|
+
<Spinner />
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
24
30
|
|
|
25
31
|
return (
|
|
26
32
|
<DetailPage
|
package/src/types.ts
CHANGED
|
@@ -106,7 +106,7 @@ export interface ResourceData {
|
|
|
106
106
|
* Formats a kebab/snake-case name into a title.
|
|
107
107
|
*/
|
|
108
108
|
function formatTitle(name: string): string {
|
|
109
|
-
return name.replace(/[-_]/g, ' ').replace(/\b\w/g, c => c.toUpperCase());
|
|
109
|
+
return name.replace(/[-_]/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase());
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
/**
|
|
@@ -178,11 +178,7 @@ export function buildResourceData(
|
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
// --- Tools (url format: "tools/{collection}") ---
|
|
181
|
-
const toolCounts = countPerCollection(
|
|
182
|
-
toolsResp.tools,
|
|
183
|
-
toolsResp.collections,
|
|
184
|
-
(t) => t.url?.split('/').pop(),
|
|
185
|
-
);
|
|
181
|
+
const toolCounts = countPerCollection(toolsResp.tools, toolsResp.collections, (t) => t.url?.split('/').pop());
|
|
186
182
|
for (const col of toolsResp.collections) {
|
|
187
183
|
collections.push({
|
|
188
184
|
name: col.name,
|
|
@@ -203,11 +199,7 @@ export function buildResourceData(
|
|
|
203
199
|
}
|
|
204
200
|
|
|
205
201
|
// --- Skills (url format: "skills/{collection}") ---
|
|
206
|
-
const skillCounts = countPerCollection(
|
|
207
|
-
skillsResp.tools,
|
|
208
|
-
skillsResp.collections,
|
|
209
|
-
(t) => t.url?.split('/').pop(),
|
|
210
|
-
);
|
|
202
|
+
const skillCounts = countPerCollection(skillsResp.tools, skillsResp.collections, (t) => t.url?.split('/').pop());
|
|
211
203
|
for (const col of skillsResp.collections) {
|
|
212
204
|
collections.push({
|
|
213
205
|
name: col.name,
|
|
@@ -228,11 +220,7 @@ export function buildResourceData(
|
|
|
228
220
|
}
|
|
229
221
|
|
|
230
222
|
// --- Activities (use collection field from definition) ---
|
|
231
|
-
const actCounts = countPerCollection(
|
|
232
|
-
activitiesResp.activities,
|
|
233
|
-
activitiesResp.collections,
|
|
234
|
-
(a) => a.collection,
|
|
235
|
-
);
|
|
223
|
+
const actCounts = countPerCollection(activitiesResp.activities, activitiesResp.collections, (a) => a.collection);
|
|
236
224
|
for (const col of activitiesResp.collections) {
|
|
237
225
|
collections.push({
|
|
238
226
|
name: col.name,
|
|
@@ -253,11 +241,7 @@ export function buildResourceData(
|
|
|
253
241
|
}
|
|
254
242
|
|
|
255
243
|
// --- Types (id format: "collection:pathName") ---
|
|
256
|
-
const typeCounts = countPerCollection(
|
|
257
|
-
typesResp.types,
|
|
258
|
-
typesResp.collections,
|
|
259
|
-
(t) => t.id?.split(':')[0],
|
|
260
|
-
);
|
|
244
|
+
const typeCounts = countPerCollection(typesResp.types, typesResp.collections, (t) => t.id?.split(':')[0]);
|
|
261
245
|
for (const col of typesResp.collections) {
|
|
262
246
|
collections.push({
|
|
263
247
|
name: col.name,
|
|
@@ -278,14 +262,10 @@ export function buildResourceData(
|
|
|
278
262
|
}
|
|
279
263
|
|
|
280
264
|
// --- Templates (path format: "/api/templates/{collection}/{name}") ---
|
|
281
|
-
const tmplCounts = countPerCollection(
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
const segments = t.path?.split('/');
|
|
286
|
-
return segments && segments.length >= 4 ? segments[3] : undefined;
|
|
287
|
-
},
|
|
288
|
-
);
|
|
265
|
+
const tmplCounts = countPerCollection(templatesResp.templates, templatesResp.collections, (t) => {
|
|
266
|
+
const segments = t.path?.split('/');
|
|
267
|
+
return segments && segments.length >= 4 ? segments[3] : undefined;
|
|
268
|
+
});
|
|
289
269
|
for (const col of templatesResp.collections) {
|
|
290
270
|
collections.push({
|
|
291
271
|
name: col.name,
|
|
@@ -327,11 +307,12 @@ export function buildResourceData(
|
|
|
327
307
|
export function filterResources(items: ResourceItem[], query: string): ResourceItem[] {
|
|
328
308
|
const q = query.toLowerCase().trim();
|
|
329
309
|
if (!q) return items;
|
|
330
|
-
return items.filter(
|
|
331
|
-
item
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
310
|
+
return items.filter(
|
|
311
|
+
(item) =>
|
|
312
|
+
item.name.toLowerCase().includes(q) ||
|
|
313
|
+
item.title.toLowerCase().includes(q) ||
|
|
314
|
+
item.description.toLowerCase().includes(q) ||
|
|
315
|
+
item.type.includes(q) ||
|
|
316
|
+
item.tags?.some((t) => t.toLowerCase().includes(q)),
|
|
336
317
|
);
|
|
337
318
|
}
|