From cd13b47695810036ce94f754286f20b6722cce4c Mon Sep 17 00:00:00 2001 From: "m.usman" Date: Tue, 1 Oct 2024 10:30:34 +0200 Subject: [PATCH] chore: updated changelog.cd --- CHANGELOG.md | 4 ++++ src/components/shared/basic/Dropzone/index.tsx | 14 ++++++-------- .../shared/basic/ReleaseProcess/AppPage/index.tsx | 3 ++- .../basic/ReleaseProcess/OfferPage/index.tsx | 3 ++- src/types/Constants.ts | 3 +++ 5 files changed, 17 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c9c53845..66ddff1b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -172,8 +172,12 @@ - **Scroll Integration**: - integrated now scroll-to-top component from shared components for all pages [#872](https://github.com/eclipse-tractusx/portal-frontend/pull/872) - **Credential Request**: + - UI improvements such as table headers, joint table columns, type updates, etc. [#866](https://github.com/eclipse-tractusx/portal-frontend/pull/866) +- **Increase Upload File Limit**: + - Allowed uplaoded document file limit increase to 5 mb [#866](https://github.com/eclipse-tractusx/portal-frontend/issues/1186) + ### Feature - **Company Role**: diff --git a/src/components/shared/basic/Dropzone/index.tsx b/src/components/shared/basic/Dropzone/index.tsx index 85f8ebc84..c9defc5f6 100644 --- a/src/components/shared/basic/Dropzone/index.tsx +++ b/src/components/shared/basic/Dropzone/index.tsx @@ -32,6 +32,7 @@ import { import { type FunctionComponent, useCallback, useState } from 'react' import { type Accept, useDropzone } from 'react-dropzone' import { useTranslation } from 'react-i18next' +import { CONVERT_TO_MB } from 'types/Constants' export type DropzoneFile = File & Partial @@ -113,7 +114,7 @@ export const Dropzone = ({ const handleFileSizeValidator = (file: File) => { const formatFileSize = (bytes: number): string => { - const sizeInMB = bytes / 1048576 + const sizeInMB = bytes / CONVERT_TO_MB if (Number.isInteger(sizeInMB)) { return sizeInMB.toString() } else { @@ -121,16 +122,13 @@ export const Dropzone = ({ } } - if (maxFileSize) { - if (file.size > maxFileSize) { - return { + if (!maxFileSize) return null + return file.size > maxFileSize + ? { code: 'size-too-large', message: `File is larger than ${formatFileSize(maxFileSize)} MB`, } - } - return null - } - return null + : null } const { diff --git a/src/components/shared/basic/ReleaseProcess/AppPage/index.tsx b/src/components/shared/basic/ReleaseProcess/AppPage/index.tsx index c8dca70f5..46f2c285d 100644 --- a/src/components/shared/basic/ReleaseProcess/AppPage/index.tsx +++ b/src/components/shared/basic/ReleaseProcess/AppPage/index.tsx @@ -68,6 +68,7 @@ import { import { ButtonLabelTypes } from '..' import { PrivacyPolicyType } from 'features/adminBoard/adminBoardApiSlice' import { phone } from 'phone' +import { ALLOWED_MAX_SIZE_DOCUMENT } from 'types/Constants' type FormDataType = { longDescriptionEN: string @@ -547,7 +548,7 @@ export default function AppPage() { 'image/jpeg': [], }} maxFilesToUpload={3} - maxFileSize={819200} + maxFileSize={ALLOWED_MAX_SIZE_DOCUMENT} DropArea={renderDropArea} handleDelete={(documentId: string) => { setDeleteSuccess(false) diff --git a/src/components/shared/basic/ReleaseProcess/OfferPage/index.tsx b/src/components/shared/basic/ReleaseProcess/OfferPage/index.tsx index 7d680c8f2..074be0273 100644 --- a/src/components/shared/basic/ReleaseProcess/OfferPage/index.tsx +++ b/src/components/shared/basic/ReleaseProcess/OfferPage/index.tsx @@ -54,6 +54,7 @@ import type { LanguageStatusType } from 'features/appManagement/types' import { DocumentTypeId } from 'features/appManagement/apiSlice' import { ButtonLabelTypes } from '..' import { success, error } from 'services/NotifyService' +import { ALLOWED_MAX_SIZE_DOCUMENT } from 'types/Constants' type FormDataType = { longDescriptionEN: string @@ -347,7 +348,7 @@ export default function OfferPage({ 'application/pdf': ['.pdf'], }} maxFilesToUpload={1} - maxFileSize={5242880} + maxFileSize={ALLOWED_MAX_SIZE_DOCUMENT} handleDelete={(documentId: string) => { documentId && deleteDocument(documentId) }} diff --git a/src/types/Constants.ts b/src/types/Constants.ts index 40d9e282f..c1b53918c 100644 --- a/src/types/Constants.ts +++ b/src/types/Constants.ts @@ -239,3 +239,6 @@ export enum HINTS { COMING_SOON = 'coming_soon', NEW = 'new', } + +export const ALLOWED_MAX_SIZE_DOCUMENT = 5242880 +export const CONVERT_TO_MB = 1048576