import { Button } from '@/components/ui/button'; import { LayoutGrid, Folder, Plus } from 'lucide-react'; import { useNavigate } from 'react-router-dom'; import type { Board } from '../api/types'; import { useAuth } from '../hooks/useAuth'; interface Props { boards: Board[]; loading?: boolean; selectedId?: number; onSelect: (id: number) => void; } export default function BoardGrid({ boards, loading = false, selectedId = 0, onSelect }: Props) { const nav = useNavigate(); const { user } = useAuth(); if (loading) { return (
{Array.from({ length: 4 }, (_, i) => (
))}
); } if (boards.length === 0) { return (

{user?.role === 'admin' ? '还没有板块,请先创建' : '管理员尚未创建板块'}

{user?.role === 'admin' && (
)}
); } return (
{boards.map(b => ( ))}
); }