filebrowser/frontend/src/views/Layout.vue

91 lines
2.3 KiB
Vue
Raw Normal View History

2018-02-01 12:17:04 +00:00
<template>
<div>
<div v-if="progress" class="progress">
<div v-bind:style="{ width: this.progress + '%' }"></div>
2018-02-01 12:17:04 +00:00
</div>
2023-09-04 02:21:25 +00:00
<defaultBar v-if="currentView === 'listing'"></defaultBar>
<editorBar v-else-if="currentView === 'editor'"></editorBar>
<editorBar v-else-if="currentView === 'share'"></editorBar>
<editorBar v-else-if="currentView === 'dashboard'"></editorBar>
<editorBar v-else-if="currentView === 'error'"></editorBar>
2023-08-31 22:15:44 +00:00
<defaultBar v-else></defaultBar>
2018-02-01 12:17:04 +00:00
<sidebar></sidebar>
<main>
<router-view></router-view>
2018-02-01 12:17:04 +00:00
</main>
<prompts></prompts>
<upload-files></upload-files>
2018-02-01 12:17:04 +00:00
</div>
</template>
<script>
2023-09-04 02:21:25 +00:00
import editorBar from "./files/EditorBar.vue"
2023-08-31 22:15:44 +00:00
import defaultBar from "./files/Default.vue"
2023-09-04 02:21:25 +00:00
import listingBar from "./files/Listing.vue"
2023-08-31 22:15:44 +00:00
import previewBar from "./files/Preview.vue"
2023-08-31 23:28:34 +00:00
import Prompts from "@/components/prompts/Prompts";
import Action from "@/components/header/Action";
2021-03-21 11:51:58 +00:00
import { mapState, mapGetters } from "vuex";
2023-08-31 22:15:44 +00:00
import Sidebar from "@/components/Sidebar.vue";
2023-08-31 23:28:34 +00:00
import UploadFiles from "../components/prompts/UploadFiles";
2021-03-21 11:51:58 +00:00
import { enableExec } from "@/utils/constants";
2018-02-01 12:17:04 +00:00
export default {
2021-03-21 11:51:58 +00:00
name: "layout",
2018-02-01 12:17:04 +00:00
components: {
2023-08-31 22:15:44 +00:00
defaultBar,
editorBar,
listingBar,
previewBar,
2023-08-19 18:32:29 +00:00
Action,
2018-02-01 12:17:04 +00:00
Sidebar,
Prompts,
UploadFiles,
},
2023-08-31 22:15:44 +00:00
data: function () {
return {
showContexts: true,
dragCounter: 0,
width: window.innerWidth,
itemWeight: 0,
};
},
computed: {
2023-09-04 02:21:25 +00:00
...mapGetters(["isLogged", "progress", "isListing"]),
...mapState(["req", "user", "state"]),
2021-03-21 11:51:58 +00:00
isExecEnabled: () => enableExec,
2023-09-04 02:21:25 +00:00
currentView() {
if (this.req.type == undefined) {
return null;
}
if (this.req.isDir) {
return "listing";
} else if (
this.req.type === "text" ||
this.req.type === "textImmutable"
) {
return "editor";
} else {
return "preview";
}
2023-08-31 22:15:44 +00:00
},
2018-02-01 12:17:04 +00:00
},
watch: {
2021-03-21 11:51:58 +00:00
$route: function () {
this.$store.commit("resetSelected");
this.$store.commit("multiple", false);
2023-08-31 22:15:44 +00:00
if (this.$store.state.show !== "success") this.$store.commit("closeHovers");
2021-03-21 11:51:58 +00:00
},
},
2023-08-19 18:32:29 +00:00
methods: {
2023-08-31 22:15:44 +00:00
getTitle() {
let title = "Title"
2023-09-04 02:21:25 +00:00
if (this.$route.path.startsWith('/settings/')) {
2023-08-31 22:15:44 +00:00
title = "Settings"
}
return title
2023-08-19 18:32:29 +00:00
},
2023-08-31 22:15:44 +00:00
},
2021-03-21 11:51:58 +00:00
};
2023-08-31 22:32:57 +00:00
</script>