New file format

This commit is contained in:
Vins 2024-11-14 12:04:53 +01:00
parent 4fc82849c5
commit a51813f1fe
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"]}>
{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 <FilePreview
href={this.state.fileBlob ? URL.createObjectURL(this.state.fileBlob) : ""} href={this.state.fileBlob ? URL.createObjectURL(this.state.fileBlob) : ""}
fileName={this.state.selectedFile.file_name} fileName={this.state.selectedFile.file_name}
key={this.state.selectedFile.uid} 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