Fix some errors in drag and drop feature

This commit is contained in:
Hongbo Wu
2022-11-30 11:53:06 +08:00
parent f0aaceabea
commit 9646092d1a
3 changed files with 29 additions and 12 deletions

View File

@ -1,4 +1,4 @@
import { Box, HStack, SpanBox, VStack } from './../../elements/LayoutPrimitives'
import { Box, HStack, VStack } from './../../elements/LayoutPrimitives'
import Dropzone from 'react-dropzone'
import * as Progress from '@radix-ui/react-progress'
import type {
@ -100,17 +100,14 @@ export function HomeFeedContainer(): JSX.Element {
const gridContainerRef = useRef<HTMLDivElement>(null)
const [shareTarget, setShareTarget] = useState<LibraryItem | undefined>(
undefined
)
const [shareTarget, setShareTarget] =
useState<LibraryItem | undefined>(undefined)
const [snoozeTarget, setSnoozeTarget] = useState<LibraryItem | undefined>(
undefined
)
const [snoozeTarget, setSnoozeTarget] =
useState<LibraryItem | undefined>(undefined)
const [labelsTarget, setLabelsTarget] = useState<LibraryItem | undefined>(
undefined
)
const [labelsTarget, setLabelsTarget] =
useState<LibraryItem | undefined>(undefined)
const [showAddLinkModal, setShowAddLinkModal] = useState(false)
const [showEditTitleModal, setShowEditTitleModal] = useState(false)
@ -771,8 +768,13 @@ function HomeFeedGrid(props: HomeFeedContentProps): JSX.Element {
'Content-Type': 'application/pdf',
},
onUploadProgress: (p) => {
console.log('upload progress: ', (p.loaded / p.total) * 100)
setUploadProgress((p.loaded / p.total) * 100)
if (!p.total) {
console.warn('No total available for upload progress')
return
}
const progress = (p.loaded / p.total) * 100
console.log('upload progress: ', progress)
setUploadProgress(progress)
},
})

View File

@ -31,6 +31,7 @@
"@sentry/nextjs": "^6.16.1",
"@stitches/react": "^1.2.5",
"antd": "4.24.3",
"axios": "^1.2.0",
"color2k": "^2.0.0",
"cookie": "^0.5.0",
"diff-match-patch": "^1.0.5",

View File

@ -10139,6 +10139,15 @@ axios@^0.27.2:
follow-redirects "^1.14.9"
form-data "^4.0.0"
axios@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/axios/-/axios-1.2.0.tgz#1cb65bd75162c70e9f8d118a905126c4a201d383"
integrity sha512-zT7wZyNYu3N5Bu0wuZ6QccIf93Qk1eV8LOewxgjOZFd2DenOs98cJ7+Y6703d0wkaXGY6/nZd4EweJaHz9uzQw==
dependencies:
follow-redirects "^1.15.0"
form-data "^4.0.0"
proxy-from-env "^1.1.0"
axobject-query@^2.2.0:
version "2.2.0"
resolved "https://registry.yarnpkg.com/axobject-query/-/axobject-query-2.2.0.tgz#943d47e10c0b704aa42275e20edf3722648989be"
@ -14568,6 +14577,11 @@ follow-redirects@^1.0.0, follow-redirects@^1.14.0, follow-redirects@^1.14.4, fol
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.1.tgz#0ca6a452306c9b276e4d3127483e29575e207ad5"
integrity sha512-yLAMQs+k0b2m7cVxpS1VKJVvoz7SS9Td1zss3XRwXj+ZDH00RJgnuLx7E44wx02kQLrdM3aOOy+FpzS7+8OizA==
follow-redirects@^1.15.0:
version "1.15.2"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13"
integrity sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==
for-in@^0.1.3:
version "0.1.8"
resolved "https://registry.yarnpkg.com/for-in/-/for-in-0.1.8.tgz#d8773908e31256109952b1fdb9b3fa867d2775e1"