import { createPortal } from 'react-dom' import { X } from 'lucide-react' import type { UserProductStatus } from '../types/userProduct' import { useT } from '../i18n/useT' import modalStyles from './CategoryModal.module.css' import styles from './UserProductStatusModal.module.css' const STATUSES: UserProductStatus[] = [ 'draft', 'published', 'rejected', 'archived', ] interface UserProductStatusModalProps { open: boolean currentStatus: UserProductStatus saving?: boolean onClose: () => void onSave: (status: UserProductStatus) => void } export function UserProductStatusModal({ open, currentStatus, saving = false, onClose, onSave, }: UserProductStatusModalProps) { const t = useT() if (!open) return null function statusLabel(value: UserProductStatus) { if (value === 'draft') return t('customerProducts.status.pending') if (value === 'published') return t('customerProducts.status.published') if (value === 'rejected') return t('customerProducts.status.rejected') return t('customerProducts.status.archived') } function handleSelect(value: UserProductStatus) { if (saving) return if (value === currentStatus) { onClose() return } onSave(value) } return createPortal(
e.stopPropagation()} >

{t('customerProducts.statusModalTitle')}

{t('customerProducts.statusModalHint')}

{STATUSES.map((value) => { const selected = value === currentStatus return ( ) })}
{saving ? (

{t('customerProducts.form.submitting')}

) : null}
, document.body, ) }