Skip to content

Commit

Permalink
feat: open addmodal when dragging a file into the dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
m4ximuel committed Apr 21, 2021
1 parent 011a5bd commit 5807db5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
11 changes: 10 additions & 1 deletion src/components/Modals/AddModal.vue
Expand Up @@ -2,6 +2,7 @@
<v-dialog
v-model="dialog"
scrollable
:transition="dTransition"
:content-class="phoneLayout ? 'rounded-0' : 'rounded-form'"
max-width="500px"
:fullscreen="phoneLayout"
Expand Down Expand Up @@ -201,9 +202,11 @@ import { FullScreenModal } from '@/mixins'
export default {
name: 'AddModal',
mixins: [Modal, FullScreenModal],
props: ['initialMagnet'],
props: ['initialMagnet', 'openSuddenly'],
data() {
return {
dTransition: 'scale-transition',
hndlDialog: true,
showWrapDrag: false,
files: [],
category: null,
Expand Down Expand Up @@ -253,6 +256,12 @@ export default {
this.$store.commit('FETCH_CATEGORIES')
this.urls = this.initialMagnet
this.setSettings()
if (this.openSuddenly == true) {
this.dTransition = 'none'
}
},
mounted() {
this.dTransition = 'scale-transition'
},
methods: {
setSettings() {
Expand Down
5 changes: 3 additions & 2 deletions src/views/Dashboard.vue
@@ -1,7 +1,6 @@
<template>
<div
class="px-1 px-sm-5 pt-4 background noselect"
@dragenter.prevent="detectDragEnter()"
@click.self="resetSelected"
>
<v-row
Expand Down Expand Up @@ -294,6 +293,7 @@ export default {
},
mounted() {
document.addEventListener('keydown', this.handleKeyboardShortcut)
document.addEventListener('dragenter', this.detectDragEnter)
},
created() {
this.$store.dispatch('INIT_INTERVALS')
Expand All @@ -302,6 +302,7 @@ export default {
beforeDestroy() {
this.$store.commit('REMOVE_INTERVALS')
document.removeEventListener('keydown', this.handleKeyboardShortcut)
document.removeEventListener('dragenter', this.detectDragEnter)
},
methods: {
strTouchStart(e, data) {
Expand Down Expand Up @@ -354,7 +355,7 @@ export default {
},
detectDragEnter() {
if (this.selected_torrents.length == 0 && this.$store.state.modals.length < 1) {
this.addModal('AddModal')
this.createModal('AddModal', { openSuddenly: true })
}
return true
Expand Down

1 comment on commit 5807db5

@IevgenSobko
Copy link
Contributor

@IevgenSobko IevgenSobko commented on 5807db5 May 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tried this functionality in the new 0.10.0 release and would like to say it is just awesome for desktop users.
It saves a lot of time necessary to open additional dialogs and search for the downloaded file if you already have it opened in your file browser.
Thanks for this brilliant idea and your contributions to the project.

Please sign in to comment.