refactor: remove file-size
This commit is contained in:
parent
712a0d42db
commit
54bf9cbb16
|
|
@ -72,7 +72,6 @@
|
|||
"emoji-mart": "5.5.2",
|
||||
"fast-average-color": "^9.3.0",
|
||||
"fast-deep-equal": "3.1.3",
|
||||
"file-size": "^1.0.0",
|
||||
"hast-util-to-html": "^8.0.4",
|
||||
"hast-util-to-text": "^3.1.2",
|
||||
"i18next": "^22.4.15",
|
||||
|
|
@ -98,8 +97,8 @@
|
|||
"pangu": "^4.0.7",
|
||||
"pinyin-pro": "^3.14.0",
|
||||
"prismjs": "1.29.0",
|
||||
"rc-dplayer": "^0.1.0",
|
||||
"qier-progress": "1.0.4",
|
||||
"rc-dplayer": "^0.1.0",
|
||||
"react": "18.2.0",
|
||||
"react-dom": "18.2.0",
|
||||
"react-hook-form": "7.43.9",
|
||||
|
|
@ -157,7 +156,6 @@
|
|||
"@types/canvas-confetti": "^1.6.0",
|
||||
"@types/chroma-js": "^2.4.0",
|
||||
"@types/cookie": "0.5.1",
|
||||
"@types/file-size": "^1.0.1",
|
||||
"@types/hast": "2.3.4",
|
||||
"@types/js-yaml": "4.0.5",
|
||||
"@types/katex": "^0.16.0",
|
||||
|
|
|
|||
|
|
@ -133,9 +133,6 @@ dependencies:
|
|||
fast-deep-equal:
|
||||
specifier: 3.1.3
|
||||
version: 3.1.3
|
||||
file-size:
|
||||
specifier: ^1.0.0
|
||||
version: 1.0.0
|
||||
hast-util-to-html:
|
||||
specifier: ^8.0.4
|
||||
version: 8.0.4
|
||||
|
|
@ -384,9 +381,6 @@ devDependencies:
|
|||
'@types/cookie':
|
||||
specifier: 0.5.1
|
||||
version: 0.5.1
|
||||
'@types/file-size':
|
||||
specifier: ^1.0.1
|
||||
version: 1.0.1
|
||||
'@types/hast':
|
||||
specifier: 2.3.4
|
||||
version: 2.3.4
|
||||
|
|
@ -4587,10 +4581,6 @@ packages:
|
|||
resolution: {integrity: sha512-R1g/VyKFFI2HLC1QGAeTtCBWCo6n75l41OnsVYNbmKG+kempOESaodf6BeJyUM3Q0rKa/NQcTHbB2+66lNnxLw==}
|
||||
dev: false
|
||||
|
||||
/@types/file-size@1.0.1:
|
||||
resolution: {integrity: sha512-jFSF8iZRWGD6trgBC6IfuTSDsEv8IHN5bW7cTO6FxPiS8FKP3kno68fI9FA7m7vV+XpplgV72wROkzigNmWcsg==}
|
||||
dev: true
|
||||
|
||||
/@types/glob@7.2.0:
|
||||
resolution: {integrity: sha512-ZUxbzKl0IfJILTS6t7ip5fQQM/J3TJYubDm3nMbgubNNYS62eXeUpoLUC8/7fJNiFYHTrGPQn7hspDUzIHX3UA==}
|
||||
dependencies:
|
||||
|
|
@ -8128,10 +8118,6 @@ packages:
|
|||
tslib: 2.5.0
|
||||
dev: false
|
||||
|
||||
/file-size@1.0.0:
|
||||
resolution: {integrity: sha512-tLIdonWTpABkU6Axg2yGChYdrOsy4V8xcm0IcyAP8fSsu6jiXLm5pgs083e4sq5fzNRZuAYolUbZyYmPvCKfwQ==}
|
||||
dev: false
|
||||
|
||||
/file-uri-to-path@1.0.0:
|
||||
resolution: {integrity: sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==}
|
||||
dev: false
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
"use client"
|
||||
|
||||
import { useDebounceEffect } from "ahooks"
|
||||
import filesize from "file-size"
|
||||
import type { Root } from "mdast"
|
||||
import { nanoid } from "nanoid"
|
||||
import { useParams, useRouter, useSearchParams } from "next/navigation"
|
||||
|
|
@ -356,9 +355,9 @@ export default function SubdomainEditor() {
|
|||
throw new Error("You can only upload images, audios and videos")
|
||||
}
|
||||
|
||||
const uploadFilesize = filesize(file.size).to("MB")
|
||||
const uploadFilesizeInMB = file.size / 1024 / 1024
|
||||
|
||||
if (Number(uploadFilesize) > MAXIMUM_FILE_SIZE) {
|
||||
if (uploadFilesizeInMB > MAXIMUM_FILE_SIZE) {
|
||||
toast.error(
|
||||
`File Size is too big. It should be less than ${MAXIMUM_FILE_SIZE} MB`,
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in New Issue