StatusBadge.tsx 769 B

12345678910111213141516171819
  1. import type { CourseStatus } from '../types'
  2. const statusMap: Record<CourseStatus, { label: string; className: string }> = {
  3. DRAFT: { label: '准备素材', className: 'status--draft' },
  4. WAITING_PRODUCTION: { label: '等待制作', className: 'status--waiting_production' },
  5. IN_PRODUCTION: { label: '制作中', className: 'status--in_production' },
  6. COMPLETED: { label: '制作完成', className: 'status--completed' },
  7. REJECTED: { label: '已驳回', className: 'status--rejected' }
  8. }
  9. export function StatusBadge({ status }: { status: CourseStatus }) {
  10. const current = statusMap[status] || { label: status, className: 'status--unknown' }
  11. return (
  12. <span className={`status ${current.className}`}>
  13. <i />
  14. {current.label}
  15. </span>
  16. )
  17. }