feat: add new folder button to move/create dialogs (#2667)

---------

Co-authored-by: Oleg Lobanov <oleg@lobanov.me>
This commit is contained in:
ArthurMousatov
2023-08-26 18:28:58 -04:00
committed by GitHub
parent 374bbd3ec1
commit 5994224468
21 changed files with 199 additions and 129 deletions

View File

@@ -1,6 +1,12 @@
<template>
<div>
<component ref="currentComponent" :is="currentComponent"></component>
<component
v-if="showOverlay"
:ref="currentPromptName"
:is="currentPromptName"
v-bind="currentPrompt.props"
>
</component>
<div v-show="showOverlay" @click="resetPrompts" class="overlay"></div>
</div>
</template>
@@ -20,7 +26,8 @@ import ReplaceRename from "./ReplaceRename.vue";
import Share from "./Share.vue";
import Upload from "./Upload.vue";
import ShareDelete from "./ShareDelete.vue";
import { mapState } from "vuex";
import Sidebar from "../Sidebar.vue";
import { mapGetters, mapState } from "vuex";
import buttons from "@/utils/buttons";
export default {
@@ -40,6 +47,7 @@ export default {
ReplaceRename,
Upload,
ShareDelete,
Sidebar
},
data: function () {
return {
@@ -52,7 +60,7 @@ export default {
},
created() {
window.addEventListener("keydown", (event) => {
if (this.show == null) return;
if (this.currentPrompt == null) return;
let prompt = this.$refs.currentComponent;
@@ -64,7 +72,7 @@ export default {
// Enter
if (event.keyCode == 13) {
switch (this.show) {
switch (this.currentPrompt.prompt) {
case "delete":
prompt.submit();
break;
@@ -82,31 +90,13 @@ export default {
});
},
computed: {
...mapState(["show", "plugins"]),
currentComponent: function () {
const matched =
[
"info",
"help",
"delete",
"rename",
"move",
"copy",
"newFile",
"newDir",
"download",
"replace",
"replace-rename",
"share",
"upload",
"share-delete",
].indexOf(this.show) >= 0;
return (matched && this.show) || null;
},
...mapState(["plugins"]),
...mapGetters(["currentPrompt", "currentPromptName"]),
showOverlay: function () {
return (
this.show !== null && this.show !== "search" && this.show !== "more"
this.currentPrompt !== null &&
this.currentPrompt.prompt !== "search" &&
this.currentPrompt.prompt !== "more"
);
},
},