import React, { useState, useEffect } from 'react'; import { Folder, Plus, Edit, Trash2 } from 'lucide-react'; export default function CategoryManager() { const [categories, setCategories] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { fetchCategories(); }, []); const fetchCategories = async () => { setLoading(true); try { const result = await window.mcp.callTool('clover_list_categories', { expand: 'items', }); setCategories(result.categories || []); } catch (error) { console.error('Failed to fetch categories:', error); } finally { setLoading(false); } }; const createCategory = async () => { const name = prompt('Category name:'); if (!name) return; try { await window.mcp.callTool('clover_create_category', { name }); fetchCategories(); } catch (error) { alert('Failed to create category'); } }; return (

Category Manager

{loading ? (
Loading categories...
) : (
{categories.map((category) => (

{category.name}

{category.items?.length || 0} items

))}
)}
); }