Skip to content

Commit

Permalink
chore: updated changelog.cd
Browse files Browse the repository at this point in the history
  • Loading branch information
Usmanfee committed Oct 1, 2024
1 parent 2dff02f commit cd13b47
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**:
Expand Down
14 changes: 6 additions & 8 deletions src/components/shared/basic/Dropzone/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<UploadFile>

Expand Down Expand Up @@ -113,24 +114,21 @@ 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 {
return sizeInMB.toFixed(1)
}
}

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 {
Expand Down
3 changes: 2 additions & 1 deletion src/components/shared/basic/ReleaseProcess/AppPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}}
Expand Down
3 changes: 3 additions & 0 deletions src/types/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit cd13b47

Please sign in to comment.