mirror of
https://github.com/VueTorrent/VueTorrent.git
synced 2025-02-18 00:02:02 +03:00
perf(DnDZone): Open add dialog on drop (#1374)
This commit is contained in:
parent
a9d9721179
commit
5635099eee
1 changed files with 7 additions and 1 deletions
|
@ -1,5 +1,6 @@
|
||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { useAddTorrentStore, useAuthStore } from '@/stores'
|
import AddTorrentDialog from '@/components/Dialogs/AddTorrentDialog.vue'
|
||||||
|
import { useAddTorrentStore, useAuthStore, useDialogStore } from '@/stores'
|
||||||
import { useDropZone } from '@vueuse/core'
|
import { useDropZone } from '@vueuse/core'
|
||||||
import { onMounted, onUnmounted, ref } from 'vue'
|
import { onMounted, onUnmounted, ref } from 'vue'
|
||||||
import { useRoute } from 'vue-router'
|
import { useRoute } from 'vue-router'
|
||||||
|
@ -7,6 +8,7 @@ import { useRoute } from 'vue-router'
|
||||||
const route = useRoute()
|
const route = useRoute()
|
||||||
const addTorrentStore = useAddTorrentStore()
|
const addTorrentStore = useAddTorrentStore()
|
||||||
const authStore = useAuthStore()
|
const authStore = useAuthStore()
|
||||||
|
const dialogStore = useDialogStore()
|
||||||
|
|
||||||
const dndZoneRef = ref<HTMLDivElement>()
|
const dndZoneRef = ref<HTMLDivElement>()
|
||||||
|
|
||||||
|
@ -36,6 +38,10 @@ function onDrop(files: File[] | null, event: DragEvent) {
|
||||||
|
|
||||||
torrentFiles.forEach(addTorrentStore.pushTorrentToQueue)
|
torrentFiles.forEach(addTorrentStore.pushTorrentToQueue)
|
||||||
links.forEach(addTorrentStore.pushTorrentToQueue)
|
links.forEach(addTorrentStore.pushTorrentToQueue)
|
||||||
|
|
||||||
|
if (!dialogStore.hasActiveDialog) {
|
||||||
|
dialogStore.createDialog(AddTorrentDialog, {})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const { isOverDropZone } = useDropZone(dndZoneRef, { onDrop })
|
const { isOverDropZone } = useDropZone(dndZoneRef, { onDrop })
|
||||||
|
|
Loading…
Add table
Reference in a new issue