import { Badge } from '@nice/ui/components/badge'; import { Button } from '@nice/ui/components/button'; import { Input } from '@nice/ui/components/input'; import { Label } from '@nice/ui/components/label'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@nice/ui/components/select'; import { TabsList, TabsTrigger } from '@nice/ui/components/tabs'; import { IconSearch } from '@tabler/icons-react'; import { SORT_OPTIONS, BATCH_ACTIONS } from '@/lib/articles/constants'; import { TermSelect } from '../selector/term-select'; import { useArticlesContext } from './context'; export function ArticleToolbar() { const { filters, selectedArticles, batchAction, stats, updateFilters, setBatchAction, handleBatchAction, resetSelection, } = useArticlesContext(); return (
{/* 左侧:状态标签页 */}
全部{' '} {stats.all} 已发布{' '} {stats.published} 草稿{' '} {stats.draft} 已归档{' '} {stats.archived} 已删除{' '} {stats.deleted}
{/* 中间:批量操作 */}
{selectedArticles.length > 0 && (
{selectedArticles.length} 篇已选
)}
{/* 右侧:搜索、分类和排序 */}
{/* 搜索和分类 */}
updateFilters({ searchTerm: e.target.value })} className="pl-10 h-9" />
updateFilters({ categoryFilter: value as string })} placeholder="全部分类" className="h-9 w-32" allowClear />
{/* 排序 */}
); }