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 } = {
"application/pdf": {
extension: "pdf",
size: 41943040,
size: 104857600, // 100MB
},
"image/jpeg": {
extension: "jpeg",
size: 41943040,
size: 104857600, // 100MB
},
"image/png": {
extension: "png",
size: 41943040,
size: 104857600, // 100MB
},
"image/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 {
max-width: 1000px;
margin: auto;
min-height: 700px;
min-height: 600px;
flex: 1;
}
.unsuported-format {
text-align: center;
}
}
.footer {

View File

@ -89,11 +89,38 @@ class ViewDocumentsClass extends BasePage<IPropsClass, IState> {
</div>
)}
<div className={classes["file-container"]}>
<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" &&
this.state.selectedFile.mimetype !==
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" &&
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>
{this.state.document.files.length > 1 && (
<div