Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion bbbeasy-frontend/src/components/RoomPresentations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@

import React, { useState } from 'react';
import { Trans } from 'react-i18next';
import { t } from 'i18next';

import { Card, Modal, Typography, Upload } from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import { UploadFile } from 'antd/es/upload/interface';
import { RcFile, UploadProps } from 'antd/es/upload';
import Notifications from "./Notifications";

const { Title } = Typography;

Expand Down Expand Up @@ -72,7 +74,26 @@ const RoomPresentations = () => {
setPreviewImage(file.url || (file.preview as string));
setPreviewOpen(true);
};
const handleChange: UploadProps['onChange'] = ({ fileList: newFileList }) => setFileList(newFileList);
const handleChange: UploadProps['onChange'] = ({ fileList: newFileList }) =>
{
const validFormats =
[
'xls','xlsx','doc','docx','ppt',
'pptx','odt','rtf','txt','ods',
'odp','avi','mpg','mp3','pdf',
'jpg','jpeg','png','svg'
];
const lastFile= newFileList[(newFileList.length)-1];
const filename = lastFile.name;
if(filename.includes(".")){
const fileFormat = filename.substring(filename.indexOf('.')+1);
if(validFormats.includes(fileFormat)){
setFileList(newFileList);
return;
}
}
Notifications.openNotificationWithIcon('error', t('invalid_format'));
}

const uploadButton = (
<div>
Expand Down
5 changes: 3 additions & 2 deletions bbbeasy-frontend/src/locale/ar-TN.json
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,8 @@
"no_recordings": "لا توجد تسجيلات",
"no_rooms": "لا يوجد غرف دردشة",
"no_presets": "لا توجد إعدادات مسبقة",

"no_labels": "لا توجد علامات",
"no_data": "لا توجد بيانات"
"no_data": "لا توجد بيانات",
"invalid_format": "تنسيق هذا الملف غير مناسب"

}
3 changes: 2 additions & 1 deletion bbbeasy-frontend/src/locale/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -397,5 +397,6 @@
"no_rooms": "No Rooms",
"no_presets": "No Presets",
"no_labels": "No labels",
"no_data": "No Data"
"no_data": "No Data",
"invalid_format": "invalid file format"
}
3 changes: 2 additions & 1 deletion bbbeasy-frontend/src/locale/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -391,5 +391,6 @@
"no_rooms": "Aucune Salle",
"no_presets": "Aucun Préréglage",
"no_labels": "Aucun Label",
"no_data": "Aucune donnée"
"no_data": "Aucune donnée",
"invalid_format": "Format de fichier invalide"
}