'use client' import { useEffect, useState } from 'react' import { useSearchParams } from 'next/navigation' import { useTranslation } from 'react-i18next' import { listWorkspaces, type ChatWorkspaceRegistration } from '@/lib/workspaces-api' export function SkillLibraryScope() { const { t } = useTranslation() const search = useSearchParams() const scope = search.get('skill_workspace') ?? '' const [workspaces, setWorkspaces] = useState([]) const [error, setError] = useState('') useEffect(() => { let active = true listWorkspaces() .then(rows => { if (active) setWorkspaces(rows.filter(row => row.kind === 'workspace' && !row.archived)) }) .catch(err => { if (active) setError(err instanceof Error ? err.message : String(err)) }) return () => { active = false } }, []) return (

{scope ? t( 'Skills created here belong to this workspace. Same-name skills override shared versions when enabled.' ) : t('Shared skills can be assigned to multiple workspaces.')}

{error && (

{error}

)}
) }