Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

fix(skills): handle empty skills list in explorer tab

Steven Enamakelae562e37a00f
diff --git a/app/src/components/skills/SkillsExplorerTab.tsx b/app/src/components/skills/SkillsExplorerTab.tsx
index 6278738175..ac252aac91 100644
--- a/app/src/components/skills/SkillsExplorerTab.tsx
+++ b/app/src/components/skills/SkillsExplorerTab.tsx
@@ -1,6 +1,6 @@
import debug from 'debug';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
-import { LuFilter } from 'react-icons/lu';
+import { LuLibrary, LuRefreshCw, LuSparkles } from 'react-icons/lu';
import { useT } from '../../lib/i18n/I18nContext';
import { type CatalogEntry, skillRegistryApi } from '../../services/api/skillRegistryApi';
@@ -10,16 +10,10 @@ import {
type WorkflowSummary,
} from '../../services/api/skillsApi';
import EmptyStateCard from '../EmptyStateCard';
-import { Badge, Checkbox, ModalShell, TabsList, TabsRoot, TabsTrigger, TextField } from '../ui';
+import ChipTabs from '../layout/ChipTabs';
+import { Badge, DataTable, type DataTableColumn, ModalShell } from '../ui';
import Button from '../ui/Button';
-import Card from '../ui/Card';
-import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '../ui/Table';
-import {
- DropdownMenuContent,
- DropdownMenuItem,
- DropdownMenuRoot,
- DropdownMenuTrigger,
-} from '../ui/DropdownMenu';
+import { TableCell, TableRow } from '../ui/Table';
import InstallSkillDialog from './InstallSkillDialog';
import UninstallSkillConfirmDialog from './UninstallSkillConfirmDialog';
@@ -93,9 +87,7 @@ function SourceBadge({ source }: { source: string }) {
'browse.sh':
'bg-amber-50 text-amber-700 border-amber-200 dark:bg-amber-500/10 dark:text-amber-300 dark:border-amber-500/30',
};
- const colors =
- SOURCE_COLORS[source] ??
- 'bg-surface-muted text-content-secondary border-line';
+ const colors = SOURCE_COLORS[source] ?? 'bg-surface-muted text-content-secondary border-line';
return (
<span
className={`inline-flex items-center rounded-full border px-1.5 py-0.5 text-[9px] font-semibold uppercase tracking-wider ${colors}`}>
@@ -135,8 +127,7 @@ function SkillFormatBadge({ format }: { format: string }) {
};
const entry = FORMAT_MAP[lower] ?? {
label: format || 'Skill',
- colors:
- 'bg-surface-muted text-content-secondary border-line',
+ colors: 'bg-surface-muted text-content-secondary border-line',
};
return (
<span
@@ -207,9 +198,7 @@ export function SkillTile({ skill, onUninstall, onClick }: SkillTileProps) {
</div>
</div>
- <h3 className="mt-2 line-clamp-1 text-sm font-semibold text-content">
- {skill.name}
- </h3>
+ <h3 className="mt-2 line-clamp-1 text-sm font-semibold text-content">{skill.name}</h3>
<p className="mt-0.5 line-clamp-2 text-[11px] leading-relaxed text-content-muted">
{skill.description || t('skills.explorer.noDescription')}
</p>
@@ -234,9 +223,7 @@ export function SkillTile({ skill, onUninstall, onClick }: SkillTileProps) {
<div className="mt-3 flex items-center justify-between gap-2">
{skill.version && (
- <span className="text-[10px] font-mono text-content-faint">
- v{skill.version}
- </span>
+ <span className="text-[10px] font-mono text-content-faint">v{skill.version}</span>
)}
{!skill.version && <span />}
{canUninstall && (
@@ -283,16 +270,25 @@ function InstalledSkillRow({ skill, onUninstall, onClick }: SkillTileProps) {
}}
className="cursor-pointer">
<TableCell className="min-w-48">
- <Button type="button" variant="tertiary" size="xs" onClick={onClick} className="h-auto max-w-full p-0 text-left font-medium hover:bg-transparent">
+ <Button
+ type="button"
+ variant="tertiary"
+ size="xs"
+ onClick={onClick}
+ className="h-auto max-w-full p-0 text-left font-medium hover:bg-transparent">
<span className="truncate">{skill.name}</span>
</Button>
</TableCell>
<TableCell className="min-w-[18rem] max-w-xl text-xs text-content-muted">
- <span className="line-clamp-1">{skill.description || t('skills.explorer.noDescription')}</span>
+ <span className="line-clamp-1">
+ {skill.description || t('skills.explorer.noDescription')}
+ </span>
{(skill.tags.length > 0 || skill.warnings.length > 0) && (
<div className="mt-1 flex flex-wrap items-center gap-1">
{skill.tags.map(tag => (
- <Badge key={tag} variant="neutral">{tag}</Badge>
+ <Badge key={tag} variant="neutral">
+ {tag}
+ </Badge>
))}
{skill.warnings.map(warning => (
<span key={warning} className="text-[10px] text-amber-700 dark:text-amber-300">
@@ -313,10 +309,20 @@ function InstalledSkillRow({ skill, onUninstall, onClick }: SkillTileProps) {
</TableCell>
<TableCell className="w-px whitespace-nowrap text-right">
{skill.scope === 'user' ? (
- <Button variant="secondary" tone="danger" size="xs" data-testid={`skill-uninstall-${skill.id}`} onClick={event => { event.stopPropagation(); onUninstall(); }}>
+ <Button
+ variant="secondary"
+ tone="danger"
+ size="xs"
+ data-testid={`skill-uninstall-${skill.id}`}
+ onClick={event => {
+ event.stopPropagation();
+ onUninstall();
+ }}>
{t('skills.disconnect')}
</Button>
- ) : <Badge variant="neutral">{t('skills.explorer.installed')}</Badge>}
+ ) : (
+ <Badge variant="neutral">{t('skills.explorer.installed')}</Badge>
+ )}
</TableCell>
</TableRow>
);
@@ -330,7 +336,13 @@ interface CatalogTileProps {
onClick: () => void;
}
-export function CatalogTile({ entry, installed, installing, onInstall, onClick }: CatalogTileProps) {
+export function CatalogTile({
+ entry,
+ installed,
+ installing,
+ onInstall,
+ onClick,
+}: CatalogTileProps) {
const { t } = useT();
return (
<div
@@ -371,9 +383,7 @@ export function CatalogTile({ entry, installed, installing, onInstall, onClick }
</div>
</div>
- <h3 className="mt-2 line-clamp-1 text-sm font-semibold text-content">
- {entry.name}
- </h3>
+ <h3 className="mt-2 line-clamp-1 text-sm font-semibold text-content">{entry.name}</h3>
<p className="mt-0.5 line-clamp-2 text-[11px] leading-relaxed text-content-muted">
{entry.description}
</p>
@@ -394,13 +404,9 @@ export function CatalogTile({ entry, installed, installing, onInstall, onClick }
<div className="mt-3 flex items-center justify-between gap-2">
<div className="flex items-center gap-2">
{entry.version && (
- <span className="text-[10px] font-mono text-content-faint">
- v{entry.version}
- </span>
- )}
- {entry.author && (
- <span className="text-[10px] text-content-faint">{entry.author}</span>
+ <span className="text-[10px] font-mono text-content-faint">v{entry.version}</span>
)}
+ {entry.author && <span className="text-[10px] text-content-faint">{entry.author}</span>}
</div>
{installed ? (
<span className="rounded-lg border border-sage-200 dark:border-sage-500/30 bg-sage-50 dark:bg-sage-500/10 px-2 py-1 text-[10px] font-medium text-sage-700 dark:text-sage-300">
@@ -462,7 +468,9 @@ function CatalogRow({ entry, installed, installing, onInstall, onClick }: Catalo
<TableCell className="min-w-[18rem] max-w-xl text-xs text-content-muted">
<span className="line-clamp-1">{entry.description}</span>
</TableCell>
- <TableCell className="whitespace-nowrap"><SourceBadge source={entry.source} /></TableCell>
+ <TableCell className="whitespace-nowrap">
+ <SourceBadge source={entry.source} />
+ </TableCell>
<TableCell className="w-px whitespace-nowrap text-right">
{installed ? (
<Badge variant="success">{t('skills.explorer.installed')}</Badge>
@@ -539,71 +547,69 @@ function SkillDetailDialog({
) : undefined
}>
<>
- {description && (
+ {description && (
+ <div>
+ <h3 className="text-[11px] font-semibold uppercase tracking-wider text-content-faint mb-1">
+ {t('skills.detail.description')}
+ </h3>
+ <p className="text-sm text-content-secondary leading-relaxed whitespace-pre-wrap">
+ {description}
+ </p>
+ </div>
+ )}
+
+ <div className="flex flex-wrap gap-x-6 gap-y-2">
+ {version && (
<div>
- <h3 className="text-[11px] font-semibold uppercase tracking-wider text-content-faint mb-1">
- {t('skills.detail.description')}
- </h3>
- <p className="text-sm text-content-secondary leading-relaxed whitespace-pre-wrap">
- {description}
- </p>
+ <span className="text-[10px] font-semibold uppercase tracking-wider text-content-faint">
+ {t('skills.detail.version')}
+ </span>
+ <p className="text-xs font-mono text-content-secondary">v{version}</p>
</div>
)}
-
- <div className="flex flex-wrap gap-x-6 gap-y-2">
- {version && (
- <div>
- <span className="text-[10px] font-semibold uppercase tracking-wider text-content-faint">
- {t('skills.detail.version')}
- </span>
- <p className="text-xs font-mono text-content-secondary">v{version}</p>
- </div>
- )}
- {author && (
- <div>
- <span className="text-[10px] font-semibold uppercase tracking-wider text-content-faint">
- {t('skills.detail.author')}
- </span>
- <p className="text-xs text-content-secondary">{author}</p>
- </div>
- )}
- {license && (
- <div>
- <span className="text-[10px] font-semibold uppercase tracking-wider text-content-faint">
- {t('skills.detail.license')}
- </span>
- <p className="text-xs text-content-secondary">{license}</p>
- </div>
- )}
- </div>
-
- {tags.length > 0 && (
+ {author && (
<div>
- <h3 className="text-[11px] font-semibold uppercase tracking-wider text-content-faint mb-1.5">
- {t('skills.detail.tags')}
- </h3>
- <div className="flex flex-wrap gap-1.5">
- {tags.map(tag => (
- <span
- key={tag}
- className="rounded-full bg-surface-subtle px-2 py-0.5 text-[10px] font-medium text-content-secondary">
- {tag}
- </span>
- ))}
- </div>
+ <span className="text-[10px] font-semibold uppercase tracking-wider text-content-faint">
+ {t('skills.detail.author')}
+ </span>
+ <p className="text-xs text-content-secondary">{author}</p>
</div>
)}
-
- {downloadUrl && (
+ {license && (
<div>
- <h3 className="text-[11px] font-semibold uppercase tracking-wider text-content-faint mb-1">
- {t('skills.detail.source')}
- </h3>
- <p className="text-[11px] font-mono text-content-faint break-all">
- {downloadUrl}
- </p>
+ <span className="text-[10px] font-semibold uppercase tracking-wider text-content-faint">
+ {t('skills.detail.license')}
+ </span>
+ <p className="text-xs text-content-secondary">{license}</p>
</div>
)}
+ </div>
+
+ {tags.length > 0 && (
+ <div>
+ <h3 className="text-[11px] font-semibold uppercase tracking-wider text-content-faint mb-1.5">
+ {t('skills.detail.tags')}
+ </h3>
+ <div className="flex flex-wrap gap-1.5">
+ {tags.map(tag => (
+ <span
+ key={tag}
+ className="rounded-full bg-surface-subtle px-2 py-0.5 text-[10px] font-medium text-content-secondary">
+ {tag}
+ </span>
+ ))}
+ </div>
+ </div>
+ )}
+
+ {downloadUrl && (
+ <div>
+ <h3 className="text-[11px] font-semibold uppercase tracking-wider text-content-faint mb-1">
+ {t('skills.detail.source')}
+ </h3>
+ <p className="text-[11px] font-mono text-content-faint break-all">{downloadUrl}</p>
+ </div>
+ )}
</>
</ModalShell>
);
@@ -860,283 +866,208 @@ export default function SkillsExplorerTab({ onToast }: SkillsExplorerTabProps) {
const loading = view === 'installed' ? skillsLoading : catalogLoading;
const error = view === 'installed' ? skillsError : catalogError;
- return (
- <div className="flex h-full min-h-0 flex-col overflow-hidden animate-fade-up">
- <div className="pb-3">
- <div className="flex items-center gap-2">
- <TabsRoot value={view} onValueChange={value => setView(value as ExplorerView)}>
- <TabsList aria-label={t('skills.explorer.title')}>
- <TabsTrigger value="registry" onClick={() => setView("registry")}>
+ const columns: DataTableColumn<never>[] = [
+ { id: 'name', header: t('skills.explorer.colSkill'), className: 'min-w-48' },
+ { id: 'description', header: t('skills.explorer.colDescription'), className: 'min-w-[18rem]' },
+ { id: 'provider', header: t('skills.explorer.colProvider') },
+ { id: 'action', header: t('skills.explorer.colAction'), align: 'right' },
+ ];
+
+ // The two views share one toolbar so the tab chips, the search box and the
+ // row of actions do not jump between them. Registry-only affordances (source
+ // filter, catalog refresh) render conditionally rather than in a second bar.
+ const toolbarStart = (
+ <>
+ <ChipTabs<ExplorerView>
+ ariaLabel={t('skills.explorer.title')}
+ className="flex flex-wrap gap-1.5"
+ testIdPrefix="skill-explorer-tab"
+ value={view}
+ onChange={setView}
+ items={[
+ {
+ id: 'registry',
+ label: (
+ <>
{t('skills.explorer.registryTab')}
- {catalogTotal > 0 && <span className="text-[10px] opacity-70">{catalogTotal.toLocaleString()}</span>}
- </TabsTrigger>
- <TabsTrigger value="installed" onClick={() => setView("installed")}>
+ {catalogTotal > 0 && (
+ <span className="tabular-nums opacity-70">{catalogTotal.toLocaleString()}</span>
+ )}
+ </>
+ ),
+ },
+ {
+ id: 'installed',
+ label: (
+ <>
{t('skills.explorer.installedTab')}
- {skills.length > 0 && <span className="text-[10px] opacity-70">{skills.length}</span>}
- </TabsTrigger>
- </TabsList>
- </TabsRoot>
- <Button
- variant="secondary"
- size="sm"
- data-testid="skill-install-from-url-btn"
- onClick={() => setInstallDialogOpen(true)}
- className="shrink-0">
- {t('skills.explorer.installFromUrl')}
- </Button>
- {/* Source filter */}
- {view === 'registry' && sources.length > 0 && (
- <div className="shrink-0">
- <DropdownMenuRoot>
- <DropdownMenuTrigger asChild>
- <Button
- type="button"
- variant="secondary"
- size="sm"
- leadingIcon={<LuFilter className="h-3.5 w-3.5" />}
- aria-label={t('skills.explorer.sourceFilterAria', 'Filter by source')}>
- Filter{activeSources.size < sources.length ? ` (${activeSources.size})` : ''}
- </Button>
- </DropdownMenuTrigger>
- <DropdownMenuContent align="start" className="min-w-48">
- {sources.map(src => {
- const active = activeSources.has(src);
- return (
- <DropdownMenuItem
- key={src}
- onSelect={event => {
- event.preventDefault();
- setActiveSources(previous => {
- const next = new Set(previous);
- if (next.has(src)) next.delete(src);
- else next.add(src);
- return next;
- });
- }}>
- <Checkbox checked={active} onCheckedChange={() => {}} className="pointer-events-none" />
- <span>{src}</span>
- </DropdownMenuItem>
- );
- })}
- </DropdownMenuContent>
- </DropdownMenuRoot>
- </div>
- )}
+ {skills.length > 0 && (
+ <span className="tabular-nums opacity-70">{skills.length}</span>
+ )}
+ </>
+ ),
+ },
+ ]}
+ />
+ <Button
+ variant="secondary"
+ size="sm"
+ data-testid="skill-install-from-url-btn"
+ onClick={() => setInstallDialogOpen(true)}
+ className="shrink-0">
+ {t('skills.explorer.installFromUrl')}
+ </Button>
+ </>
+ );
- {/* Search */}
- <div className="flex min-w-0 flex-1 gap-2">
- <div className="relative flex-1">
- <svg
- className="absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-content-faint"
- fill="none"
- viewBox="0 0 24 24"
- stroke="currentColor"
- strokeWidth={2}>
- <path
- strokeLinecap="round"
- strokeLinejoin="round"
- d="m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"
- />
- </svg>
- <TextField
- type="text"
- data-testid="skill-search-input"
- value={searchQuery}
- onChange={e => setSearchQuery(e.target.value)}
- placeholder={t('skills.explorer.searchPlaceholder')}
- className="pl-9 pr-3 text-xs shadow-xs"
- />
- </div>
- {view === 'registry' && (
- <Button
- iconOnly
- variant="secondary"
- size="md"
- onClick={() => void fetchCatalog(debouncedQuery, activeSourceFilter, true)}
- disabled={catalogLoading}
- title={t('skills.explorer.refreshRegistry')}
- aria-label={t('skills.explorer.refreshRegistry')}
- className="shrink-0 text-content-muted shadow-xs">
- <svg
- className={`h-4 w-4 ${catalogLoading ? 'animate-spin' : ''}`}
- fill="none"
- viewBox="0 0 24 24"
- stroke="currentColor"
- strokeWidth={2}>
- <path
- strokeLinecap="round"
- strokeLinejoin="round"
- d="M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182"
- />
- </svg>
- </Button>
- )}
+ const toolbarEnd =
+ view === 'registry' ? (
+ <Button
+ iconOnly
+ variant="secondary"
+ size="md"
+ onClick={() => void fetchCatalog(debouncedQuery, activeSourceFilter, true)}
+ disabled={catalogLoading}
+ title={t('skills.explorer.refreshRegistry')}
+ aria-label={t('skills.explorer.refreshRegistry')}
+ className="shrink-0 text-content-muted shadow-xs">
+ <LuRefreshCw className={`h-4 w-4 ${catalogLoading ? 'animate-spin' : ''}`} />
+ </Button>
+ ) : null;
+
+ const filters =
+ view === 'registry' && sources.length > 0
+ ? [
+ {
+ id: 'source',
+ label: t('common.filter'),
+ ariaLabel: t('skills.explorer.sourceFilterAria'),
+ testId: 'skill-source-filter',
+ options: sources.map(source => ({ value: source })),
+ selected: activeSources,
+ onChange: setActiveSources,
+ },
+ ]
+ : undefined;
+
+ const errorNode =
+ !loading && error ? (
+ <div className="rounded-xl border border-coral-200 bg-coral-50 p-3 dark:border-coral-500/30 dark:bg-coral-500/10">
+ <p className="text-xs font-medium text-coral-700 dark:text-coral-300">{error}</p>
+ <Button
+ variant="secondary"
+ tone="danger"
+ size="xs"
+ onClick={() =>
+ void (view === 'installed'
+ ? fetchSkills()
+ : fetchCatalog(debouncedQuery, activeSourceFilter, true))
+ }
+ className="mt-2">
+ {t('common.retry')}
+ </Button>
</div>
+ ) : null;
+
+ const installedEmpty =
+ // A search that matched nothing is not the same as having no skills — the
+ // second offers an install CTA, the first would be nonsense.
+ skills.length > 0 ? (
+ <p className="px-1 py-8 text-center text-xs text-content-faint">{t('skills.noResults')}</p>
+ ) : (
+ <EmptyStateCard
+ className="mx-1 mb-3 py-10"
+ icon={<LuSparkles className="h-7 w-7 text-primary-500" strokeWidth={1.5} />}
+ title={t('skills.explorer.emptyTitle')}
+ description={t('skills.explorer.emptyDescription')}
+ actionLabel={t('skills.explorer.emptyCta')}
+ onAction={() => setInstallDialogOpen(true)}
+ />
+ );
+ const registryEmpty = catalogInitialized ? (
+ <EmptyStateCard
+ className="mx-1 mb-3 py-10"
+ icon={<LuLibrary className="h-7 w-7 text-primary-500" strokeWidth={1.5} />}
+ title={debouncedQuery ? t('skills.noResults') : t('skills.explorer.registryEmptyTitle')}
+ description={debouncedQuery ? '' : t('skills.explorer.registryEmptyDescription')}
+ actionLabel={debouncedQuery ? undefined : t('skills.explorer.refreshRegistry')}
+ onAction={debouncedQuery ? undefined : () => void fetchCatalog('', undefined, true)}
+ />
+ ) : null;
+
+ const registryFooter =
+ filteredCatalog.length > displayedCatalog.length ? (
+ <div className="mt-3 flex flex-col items-center gap-1">
+ <Button
+ variant="secondary"
+ size="sm"
+ data-testid="registry-show-more"
+ onClick={() => setVisibleCount(c => c + CATALOG_PAGE_SIZE)}
+ className="h-auto border-line px-4 py-2 text-xs font-medium text-content-secondary shadow-soft">
+ {t('common.showMore')}
+ </Button>
+ <p className="text-[11px] text-content-faint">
+ {displayedCatalog.length.toLocaleString()} / {filteredCatalog.length.toLocaleString()}
+ </p>
</div>
- </div>
-
- <div className="min-h-0 flex-1 overflow-y-auto p-3 pt-0">
-
- {/* Loading */}
- {loading && (
- <div className="flex items-center justify-center py-12">
- <span className="h-5 w-5 animate-spin rounded-full border-2 border-line border-t-primary-500" />
- </div>
- )}
-
- {/* Error */}
- {!loading && error && (
- <div className="mx-1 mb-3 rounded-xl border border-coral-200 dark:border-coral-500/30 bg-coral-50 dark:bg-coral-500/10 p-3">
- <p className="text-xs font-medium text-coral-700 dark:text-coral-300">{error}</p>
- <Button
- variant="secondary"
- tone="danger"
- size="xs"
- onClick={() =>
- void (view === 'installed'
- ? fetchSkills()
- : fetchCatalog(debouncedQuery, activeSourceFilter, true))
- }
- className="mt-2">
- {t('common.retry')}
- </Button>
- </div>
- )}
+ ) : null;
+
+ const shared = {
+ columns,
+ search: {
+ value: searchQuery,
+ onChange: setSearchQuery,
+ placeholder: t('skills.explorer.searchPlaceholder'),
+ testId: 'skill-search-input',
+ },
+ toolbarStart,
+ toolbarEnd,
+ filters,
+ loading,
+ error: errorNode,
+ ariaLabel: t('skills.explorer.title'),
+ };
- {/* ── Installed view ── */}
- {view === 'installed' && !loading && !error && (
- <>
- {skills.length === 0 && (
- <EmptyStateCard
- className="mx-1 mb-3 py-10"
- icon={
- <svg
- className="h-7 w-7 text-primary-500"
- fill="none"
- viewBox="0 0 24 24"
- stroke="currentColor"
- strokeWidth={1.5}>
- <path
- strokeLinecap="round"
- strokeLinejoin="round"
- d="M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09Z"
- />
- </svg>
- }
- title={t('skills.explorer.emptyTitle')}
- description={t('skills.explorer.emptyDescription')}
- actionLabel={t('skills.explorer.emptyCta')}
- onAction={() => setInstallDialogOpen(true)}
+ return (
+ <div className="flex h-full min-h-0 flex-col overflow-hidden animate-fade-up">
+ {view === 'installed' ? (
+ <DataTable<WorkflowSummary>
+ {...shared}
+ columns={columns as DataTableColumn<WorkflowSummary>[]}
+ rows={sortedSkills}
+ rowKey={skill => skill.id}
+ empty={installedEmpty}
+ renderRow={skill => (
+ <InstalledSkillRow
+ key={skill.id}
+ skill={skill}
+ onClick={() => setDetailSkill(skill)}
+ onUninstall={() => setUninstallTarget(skill)}
/>
)}
-
- {skills.length > 0 && sortedSkills.length === 0 && (
- <p className="px-1 py-8 text-center text-xs text-content-faint">
- {t('skills.noResults')}
- </p>
- )}
-
- {sortedSkills.length > 0 && (
- <Card className="w-full">
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead className="sticky top-0 z-10 min-w-48 bg-surface">Skill</TableHead>
- <TableHead className="sticky top-0 z-10 min-w-[18rem] bg-surface">Description</TableHead>
- <TableHead className="sticky top-0 z-10 bg-surface">Provider</TableHead>
- <TableHead className="sticky top-0 z-10 bg-surface text-right">Action</TableHead>
- </TableRow>
- </TableHeader>
- <TableBody>
- {sortedSkills.map(skill => (
- <InstalledSkillRow key={skill.id} skill={skill} onClick={() => setDetailSkill(skill)} onUninstall={() => setUninstallTarget(skill)} />
- ))}
- </TableBody>
- </Table>
- </Card>
- )}
- </>
- )}
-
- {/* ── Registry view ── */}
- {view === 'registry' && !loading && !error && (
- <>
- {catalogInitialized && filteredCatalog.length === 0 && (
- <EmptyStateCard
- className="mx-1 mb-3 py-10"
- icon={
- <svg
- className="h-7 w-7 text-primary-500"
- fill="none"
- viewBox="0 0 24 24"
- stroke="currentColor"
- strokeWidth={1.5}>
- <path
- strokeLinecap="round"
- strokeLinejoin="round"
- d="M12 21v-8.25M15.75 21v-8.25M8.25 21v-8.25M3 9l9-6 9 6m-1.5 12V10.332A48.36 48.36 0 0 0 12 9.75c-2.551 0-5.056.2-7.5.582V21M3 21h18M12 6.75h.008v.008H12V6.75Z"
- />
- </svg>
- }
- title={
- debouncedQuery ? t('skills.noResults') : t('skills.explorer.registryEmptyTitle')
- }
- description={debouncedQuery ? '' : t('skills.explorer.registryEmptyDescription')}
- actionLabel={debouncedQuery ? undefined : t('skills.explorer.refreshRegistry')}
- onAction={debouncedQuery ? undefined : () => void fetchCatalog('', undefined, true)}
+ />
+ ) : (
+ <DataTable<CatalogEntry>
+ {...shared}
+ columns={columns as DataTableColumn<CatalogEntry>[]}
+ rows={displayedCatalog}
+ rowKey={entry => `${entry.source}-${entry.id}`}
+ empty={registryEmpty}
+ footer={registryFooter}
+ renderRow={entry => (
+ <CatalogRow
+ key={`${entry.source}-${entry.id}`}
+ entry={entry}
+ installed={entryInstalled(entry)}
+ installing={installingId === entry.id}
+ onClick={() => setDetailEntry(entry)}
+ onInstall={() => void handleRegistryInstall(entry)}
/>
)}
-
- {displayedCatalog.length > 0 && (
- <>
- <Card className="w-full">
- <Table>
- <TableHeader>
- <TableRow>
- <TableHead className="sticky top-0 z-10 min-w-48 bg-surface">Skill</TableHead>
- <TableHead className="sticky top-0 z-10 min-w-[18rem] bg-surface">Description</TableHead>
- <TableHead className="sticky top-0 z-10 bg-surface">Provider</TableHead>
- <TableHead className="sticky top-0 z-10 bg-surface text-right">Action</TableHead>
- </TableRow>
- </TableHeader>
- <TableBody>
- {displayedCatalog.map(entry => (
- <CatalogRow
- key={`${entry.source}-${entry.id}`}
- entry={entry}
- installed={entryInstalled(entry)}
- installing={installingId === entry.id}
- onClick={() => setDetailEntry(entry)}
- onInstall={() => void handleRegistryInstall(entry)}
- />
- ))}
- </TableBody>
- </Table>
- </Card>
- {filteredCatalog.length > displayedCatalog.length && (
- <div className="mt-3 flex flex-col items-center gap-1">
- <Button
- variant="secondary"
- size="sm"
- data-testid="registry-show-more"
- onClick={() => setVisibleCount(c => c + CATALOG_PAGE_SIZE)}
- className="h-auto border-line px-4 py-2 text-xs font-medium text-content-secondary shadow-soft">
- {t('common.showMore')}
- </Button>
- <p className="text-[11px] text-content-faint">
- {displayedCatalog.length.toLocaleString()} /{' '}
- {filteredCatalog.length.toLocaleString()}
- </p>
- </div>
- )}
- </>
- )}
- </>
+ />
)}
- </div>
-
{installDialogOpen && (
<InstallSkillDialog
onClose={() => setInstallDialogOpen(false)}