2018-02-01 12:17:04 +00:00
|
|
|
<template>
|
2024-02-10 00:13:02 +00:00
|
|
|
<div >
|
|
|
|
<div v-show="showOverlay" @click="resetPrompts" class="overlay"></div>
|
2022-02-21 18:30:42 +00:00
|
|
|
<div v-if="progress" class="progress">
|
2020-07-07 19:41:13 +00:00
|
|
|
<div v-bind:style="{ width: this.progress + '%' }"></div>
|
2018-02-01 12:17:04 +00:00
|
|
|
</div>
|
2024-02-10 00:13:02 +00:00
|
|
|
<listingBar
|
|
|
|
:class="{ 'dark-mode-header': isDarkMode }"
|
|
|
|
v-if="currentView == 'listingView'"
|
|
|
|
></listingBar>
|
|
|
|
<editorBar
|
|
|
|
:class="{ 'dark-mode-header': isDarkMode }"
|
|
|
|
v-else-if="currentView == 'editor'"
|
|
|
|
></editorBar>
|
2023-10-11 14:37:32 +00:00
|
|
|
<defaultBar :class="{ 'dark-mode-header': isDarkMode }" v-else></defaultBar>
|
2018-02-01 12:17:04 +00:00
|
|
|
<sidebar></sidebar>
|
2024-02-10 00:13:02 +00:00
|
|
|
<main :class="{ 'dark-mode': isDarkMode }" >
|
2019-01-05 16:12:09 +00:00
|
|
|
<router-view></router-view>
|
2018-02-01 12:17:04 +00:00
|
|
|
</main>
|
2023-10-09 22:24:48 +00:00
|
|
|
<prompts :class="{ 'dark-mode': isDarkMode }"></prompts>
|
2022-02-21 18:30:42 +00:00
|
|
|
<upload-files></upload-files>
|
2018-02-01 12:17:04 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2023-10-14 13:43:25 +00:00
|
|
|
import editorBar from "./bars/EditorBar.vue";
|
|
|
|
import defaultBar from "./bars/Default.vue";
|
|
|
|
import listingBar from "./bars/ListingBar.vue";
|
2023-08-31 23:28:34 +00:00
|
|
|
import Prompts from "@/components/prompts/Prompts";
|
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";
|
2023-10-14 13:43:25 +00:00
|
|
|
import { darkMode } 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,
|
2018-02-01 12:17:04 +00:00
|
|
|
Sidebar,
|
2019-01-05 16:12:09 +00:00
|
|
|
Prompts,
|
2022-02-21 18:30:42 +00:00
|
|
|
UploadFiles,
|
2019-01-05 16:12:09 +00:00
|
|
|
},
|
2023-08-31 22:15:44 +00:00
|
|
|
data: function () {
|
|
|
|
return {
|
|
|
|
showContexts: true,
|
|
|
|
dragCounter: 0,
|
|
|
|
width: window.innerWidth,
|
|
|
|
itemWeight: 0,
|
|
|
|
};
|
|
|
|
},
|
2019-01-05 16:12:09 +00:00
|
|
|
computed: {
|
2024-02-10 00:13:02 +00:00
|
|
|
...mapGetters([
|
|
|
|
"isLogged",
|
|
|
|
"progress",
|
|
|
|
"isListing",
|
|
|
|
"currentPrompt",
|
|
|
|
"currentPromptName",
|
|
|
|
]),
|
2023-09-04 02:21:25 +00:00
|
|
|
...mapState(["req", "user", "state"]),
|
2024-02-10 00:13:02 +00:00
|
|
|
showOverlay: function () {
|
|
|
|
return this.currentPrompt !== null && this.currentPrompt.prompt !== "more";
|
|
|
|
},
|
2023-10-09 22:24:48 +00:00
|
|
|
isDarkMode() {
|
2024-02-10 00:13:02 +00:00
|
|
|
return this.user && Object.prototype.hasOwnProperty.call(this.user, "darkMode")
|
|
|
|
? this.user.darkMode
|
|
|
|
: darkMode;
|
2023-10-09 22:24:48 +00:00
|
|
|
},
|
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) {
|
2024-02-10 00:13:02 +00:00
|
|
|
return "listingView";
|
|
|
|
} else if (Object.prototype.hasOwnProperty.call(this.req, 'content')) {
|
2023-09-04 02:21:25 +00:00
|
|
|
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);
|
2024-02-10 00:13:02 +00:00
|
|
|
if (this.currentPrompt?.prompt !== "success") this.$store.commit("closeHovers");
|
2021-03-21 11:51:58 +00:00
|
|
|
},
|
|
|
|
},
|
2023-08-19 18:32:29 +00:00
|
|
|
methods: {
|
2024-02-10 00:13:02 +00:00
|
|
|
resetPrompts() {
|
|
|
|
this.$store.commit("closeHovers");
|
|
|
|
},
|
2023-08-31 22:15:44 +00:00
|
|
|
getTitle() {
|
2023-10-14 13:43:25 +00:00
|
|
|
let title = "Title";
|
|
|
|
if (this.$route.path.startsWith("/settings/")) {
|
|
|
|
title = "Settings";
|
2023-08-31 22:15:44 +00:00
|
|
|
}
|
2023-10-14 13:43:25 +00:00
|
|
|
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-10-09 22:24:48 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
2023-12-01 23:47:00 +00:00
|
|
|
main {
|
2024-02-10 00:13:02 +00:00
|
|
|
-ms-overflow-style: none; /* Internet Explorer 10+ */
|
|
|
|
scrollbar-width: none; /* Firefox */
|
2023-12-01 23:47:00 +00:00
|
|
|
}
|
2024-02-10 00:13:02 +00:00
|
|
|
main::-webkit-scrollbar {
|
|
|
|
display: none; /* Safari and Chrome */
|
2023-12-01 23:47:00 +00:00
|
|
|
}
|
2023-10-09 22:24:48 +00:00
|
|
|
/* Use the class .dark-mode to apply styles conditionally */
|
|
|
|
.dark-mode {
|
|
|
|
background: var(--background);
|
|
|
|
color: var(--textPrimary);
|
|
|
|
}
|
|
|
|
|
2023-10-11 14:37:32 +00:00
|
|
|
/* Header */
|
|
|
|
.dark-mode-header {
|
2024-02-10 00:13:02 +00:00
|
|
|
color: white;
|
2023-10-11 14:37:32 +00:00
|
|
|
background: var(--surfacePrimary);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Header with backdrop-filter support */
|
|
|
|
@supports (backdrop-filter: none) {
|
|
|
|
.dark-mode-header {
|
|
|
|
background: transparent;
|
|
|
|
backdrop-filter: blur(16px) invert(0.1);
|
|
|
|
}
|
|
|
|
}
|
2023-10-14 13:43:25 +00:00
|
|
|
</style>
|