Skip to content

Commit 6364e08

Browse files
authored
Merge pull request #342 from kleros/feat/restrict-upload-sizes-and-notify
feat: restrict file sizes and notify
2 parents c394586 + c0fe720 commit 6364e08

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

src/components/evidence-form.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,9 @@ const EvidenceForm = ({
8181
}
8282

8383
const beforeFileUpload = useCallback(file => {
84-
const isLt10M = file.size / 1024 / 1024 < 15
85-
if (!isLt10M) message.error('File must smaller than 15MB.')
86-
return isLt10M
84+
const isLt4M = file.size / 1024 / 1024 < 4
85+
if (!isLt4M) message.error('File must be smaller than 4MB.')
86+
return isLt4M
8787
}, [])
8888

8989
return (

src/components/input-selector.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ const InputSelector: React.FC<InputSelectorProps> = p => {
9191
}
9292

9393
if (file.size / 1024 / 1024 > (p.maxFileSizeMb || 2)) {
94-
message.error(`Image must smaller than ${p.maxFileSizeMb || 2}MB.`)
94+
message.error(`Image must be smaller than ${p.maxFileSizeMb || 2}MB.`)
9595
return false
9696
}
9797

@@ -112,8 +112,8 @@ const InputSelector: React.FC<InputSelectorProps> = p => {
112112
return false
113113
}
114114

115-
if (file.size / 1024 / 1024 > (p.maxFileSizeMb || 10)) {
116-
message.error(`File must smaller than ${p.maxFileSizeMb || 10}MB.`)
115+
if (file.size / 1024 / 1024 > (p.maxFileSizeMb || 4)) {
116+
message.error(`File must be smaller than ${p.maxFileSizeMb || 4}MB.`)
117117
return false
118118
}
119119

src/pages/factory-classic/rel-tcr-params.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ const RelTCRParams = ({
126126
const isPDF = file.type === 'application/pdf'
127127
if (!isPDF) message.error('Please upload file as PDF.')
128128

129-
const isLt10M = file.size / 1024 / 1024 < 10
130-
if (!isLt10M) message.error('File must smaller than 10MB.')
129+
const isLt4M = file.size / 1024 / 1024 < 4
130+
if (!isLt4M) message.error('File must be smaller than 4MB.')
131131

132-
return isPDF && isLt10M
132+
return isPDF && isLt4M
133133
}, [])
134134

135135
const onChangeDepositVal = useCallback(

src/pages/factory-classic/tcr-params.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ const TCRParams = ({
135135
if (!isSupportedImage) message.error('Please use PNG, jpeg, webp or SVG.')
136136

137137
const isLt2M = file.size / 1024 / 1024 < 2
138-
if (!isLt2M) message.error('Image must smaller than 2MB.')
138+
if (!isLt2M) message.error('Image must be smaller than 2MB.')
139139

140140
return isSupportedImage && isLt2M
141141
}, [])
@@ -144,10 +144,10 @@ const TCRParams = ({
144144
const isPDF = file.type === 'application/pdf'
145145
if (!isPDF) message.error('Please upload file as PDF.')
146146

147-
const isLt10M = file.size / 1024 / 1024 < 10
148-
if (!isLt10M) message.error('File must smaller than 10MB.')
147+
const isLt4M = file.size / 1024 / 1024 < 4
148+
if (!isLt4M) message.error('File must be smaller than 4MB.')
149149

150-
return isPDF && isLt10M
150+
return isPDF && isLt4M
151151
}, [])
152152

153153
const customRequest = useCallback(

src/pages/factory/rel-tcr-params.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ const RelTCRParams = ({
126126
const isPDF = file.type === 'application/pdf'
127127
if (!isPDF) message.error('Please upload file as PDF.')
128128

129-
const isLt10M = file.size / 1024 / 1024 < 10
130-
if (!isLt10M) message.error('File must smaller than 10MB.')
129+
const isLt4M = file.size / 1024 / 1024 < 4
130+
if (!isLt4M) message.error('File must be smaller than 4MB.')
131131

132-
return isPDF && isLt10M
132+
return isPDF && isLt4M
133133
}, [])
134134

135135
const onChangeDepositVal = useCallback(

src/pages/factory/tcr-params.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ const TCRParams = ({
192192
if (!isSupportedImage) message.error('Please use PNG, webp, jpeg or SVG.')
193193

194194
const isLt2M = file.size / 1024 / 1024 < 2
195-
if (!isLt2M) message.error('Image must smaller than 2MB.')
195+
if (!isLt2M) message.error('Image must be smaller than 2MB.')
196196

197197
return isSupportedImage && isLt2M
198198
}, [])
@@ -201,10 +201,10 @@ const TCRParams = ({
201201
const isPDF = file.type === 'application/pdf'
202202
if (!isPDF) message.error('Please upload file as PDF.')
203203

204-
const isLt10M = file.size / 1024 / 1024 < 10
205-
if (!isLt10M) message.error('File must smaller than 10MB.')
204+
const isLt4M = file.size / 1024 / 1024 < 4
205+
if (!isLt4M) message.error('File must be smaller than 4MB.')
206206

207-
return isPDF && isLt10M
207+
return isPDF && isLt4M
208208
}, [])
209209

210210
const customRequest = useCallback(

0 commit comments

Comments
 (0)