"use client"; import { DOCUMENT_FILE_ACCEPT, MAX_DOCUMENT_FILES } from "@/utils/shared"; import DocumentItem from "./DocumentItem"; import useCompanyDocumentsPresenter from "./useCompanyDocumentsPresenter"; interface IProps { /** Present in edit mode; switches uploads to the company-documents endpoint. */ companyId?: string; value: string[]; onChange: (ids: string[]) => void; } const CompanyDocuments = ({ companyId, value, onChange }: IProps) => { const { isUploading, uploadProgress, failed, errorMessage, onSelectFiles, onRemove, } = useCompanyDocumentsPresenter({ companyId, value, onChange }); const inputId = "company-documents-input"; return (
{isUploading ? (

Uploading documents… {companyId ? "" : `${uploadProgress}%`}

) : null}
{errorMessage ? (

{errorMessage}

) : null} {value.length > 0 ? (
{value.map((fileId) => ( ))}
) : (

No documents attached yet.

)} {failed.length > 0 ? (

Failed uploads

    {failed.map((item, index) => (
  • {item.filename}: {item.error}
  • ))}
) : null}
); }; export default CompanyDocuments;