This commit is contained in:
VincentAlamelle 2024-11-14 16:02:12 +01:00 committed by GitHub
commit 8c90d358e5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 53 additions and 10 deletions

View File

@ -39,19 +39,31 @@ type IMimeTypes = {
const mimeTypesAccepted: { [key: string]: IMimeTypes } = { const mimeTypesAccepted: { [key: string]: IMimeTypes } = {
"application/pdf": { "application/pdf": {
extension: "pdf", extension: "pdf",
size: 41943040, size: 104857600, // 100MB
}, },
"image/jpeg": { "image/jpeg": {
extension: "jpeg", extension: "jpeg",
size: 41943040, size: 104857600, // 100MB
}, },
"image/png": { "image/png": {
extension: "png", extension: "png",
size: 41943040, size: 104857600, // 100MB
}, },
"image/jpg": { "image/jpg": {
extension: "jpg", extension: "jpg",
size: 41943040, size: 104857600, // 100MB
},
"text/csv": {
extension: "csv",
size: 104857600, // 100MB
},
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": {
extension: "xlsx",
size: 104857600, // 100MB
},
"application/vnd.ms-excel": {
extension: "xls",
size: 104857600, // 100MB
}, },
}; };

View File

@ -28,9 +28,13 @@
.file-container { .file-container {
max-width: 1000px; max-width: 1000px;
margin: auto; margin: auto;
min-height: 700px; min-height: 600px;
flex: 1; flex: 1;
} }
.unsuported-format {
text-align: center;
}
} }
.footer { .footer {

View File

@ -89,11 +89,38 @@ class ViewDocumentsClass extends BasePage<IPropsClass, IState> {
</div> </div>
)} )}
<div className={classes["file-container"]}> <div className={classes["file-container"]}>
<FilePreview {this.state.selectedFile.mimetype !== "text/csv" &&
href={this.state.fileBlob ? URL.createObjectURL(this.state.fileBlob) : ""} this.state.selectedFile.mimetype !==
fileName={this.state.selectedFile.file_name} "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" &&
key={this.state.selectedFile.uid} this.state.selectedFile.mimetype !== "application/vnd.ms-excel" && (
/> <FilePreview
href={this.state.fileBlob ? URL.createObjectURL(this.state.fileBlob) : ""}
fileName={this.state.selectedFile.file_name}
key={this.state.selectedFile.uid}
/>
)}
{this.state.selectedFile.mimetype === "text/csv" && (
<div className={classes["unsuported-format"]}>
<Typography typo={ETypo.TEXT_MD_REGULAR} color={ETypoColor.COLOR_GENERIC_BLACK}>
L'affichage de ce format de fichier n'est pas supporté.
</Typography>
</div>
)}
{this.state.selectedFile.mimetype ===
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" && (
<div className={classes["unsuported-format"]}>
<Typography typo={ETypo.TEXT_MD_REGULAR} color={ETypoColor.COLOR_GENERIC_BLACK}>
L'affichage de ce format de fichier n'est pas supporté.
</Typography>
</div>
)}
{this.state.selectedFile.mimetype === "application/vnd.ms-excel" && (
<div className={classes["unsuported-format"]}>
<Typography typo={ETypo.TEXT_MD_REGULAR} color={ETypoColor.COLOR_GENERIC_BLACK}>
L'affichage de ce format de fichier n'est pas supporté.
</Typography>
</div>
)}
</div> </div>
{this.state.document.files.length > 1 && ( {this.state.document.files.length > 1 && (
<div <div