FIX: UI doesn't load for non-user on share (#51)
Co-authored-by: Graham Steffaniak <graham.steffaniak@autodesk.com>
This commit is contained in:
parent
3c1a852435
commit
3fd8ee7783
|
@ -3,7 +3,7 @@ server:
|
||||||
baseURL: "/"
|
baseURL: "/"
|
||||||
auth:
|
auth:
|
||||||
method: password
|
method: password
|
||||||
signup: false
|
signup: true
|
||||||
userDefaults:
|
userDefaults:
|
||||||
darkMode: true
|
darkMode: true
|
||||||
disableSettings: false
|
disableSettings: false
|
||||||
|
|
|
@ -1,12 +1,31 @@
|
||||||
<template>
|
<template>
|
||||||
<div id="search" @click="open" v-bind:class="{ active, ongoing, 'dark-mode': isDarkMode }">
|
<div
|
||||||
|
id="search"
|
||||||
|
@click="open"
|
||||||
|
v-bind:class="{ active, ongoing, 'dark-mode': isDarkMode }"
|
||||||
|
>
|
||||||
<div id="input">
|
<div id="input">
|
||||||
<button v-if="active" class="action" @click="close" :aria-label="$t('buttons.close')" :title="$t('buttons.close')">
|
<button
|
||||||
|
v-if="active"
|
||||||
|
class="action"
|
||||||
|
@click="close"
|
||||||
|
:aria-label="$t('buttons.close')"
|
||||||
|
:title="$t('buttons.close')"
|
||||||
|
>
|
||||||
<i class="material-icons">close</i>
|
<i class="material-icons">close</i>
|
||||||
</button>
|
</button>
|
||||||
<i v-else class="material-icons">search</i>
|
<i v-else class="material-icons">search</i>
|
||||||
<input class="main-input" type="text" @keyup.exact="keyup" @input="submit" ref="input" :autofocus="active"
|
<input
|
||||||
v-model.trim="value" :aria-label="$t('search.search')" :placeholder="$t('search.search')" />
|
class="main-input"
|
||||||
|
type="text"
|
||||||
|
@keyup.exact="keyup"
|
||||||
|
@input="submit"
|
||||||
|
ref="input"
|
||||||
|
:autofocus="active"
|
||||||
|
v-model.trim="value"
|
||||||
|
:aria-label="$t('search.search')"
|
||||||
|
:placeholder="$t('search.search')"
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="isMobile && active" id="result" :class="{ hidden: !active }" ref="result">
|
<div v-if="isMobile && active" id="result" :class="{ hidden: !active }" ref="result">
|
||||||
<div id="result-list">
|
<div id="result-list">
|
||||||
|
@ -14,7 +33,12 @@
|
||||||
Search Context: {{ getContext(this.$route.path) }}
|
Search Context: {{ getContext(this.$route.path) }}
|
||||||
</div>
|
</div>
|
||||||
<ul v-show="results.length > 0">
|
<ul v-show="results.length > 0">
|
||||||
<li v-for="(s, k) in results" :key="k" @click.stop.prevent="navigateTo(s.url)" style="cursor: pointer">
|
<li
|
||||||
|
v-for="(s, k) in results"
|
||||||
|
:key="k"
|
||||||
|
@click.stop.prevent="navigateTo(s.url)"
|
||||||
|
style="cursor: pointer"
|
||||||
|
>
|
||||||
<router-link to="#" event="">
|
<router-link to="#" event="">
|
||||||
<i v-if="s.dir" class="material-icons folder-icons"> folder </i>
|
<i v-if="s.dir" class="material-icons folder-icons"> folder </i>
|
||||||
<i v-else-if="s.audio" class="material-icons audio-icons"> volume_up </i>
|
<i v-else-if="s.audio" class="material-icons audio-icons"> volume_up </i>
|
||||||
|
@ -37,15 +61,26 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<template v-if="isEmpty">
|
<template v-if="isEmpty">
|
||||||
<button class="mobile-boxes" v-if="value.length === 0 && !showBoxes" @click="resetSearchFilters()">
|
<button
|
||||||
|
class="mobile-boxes"
|
||||||
|
v-if="value.length === 0 && !showBoxes"
|
||||||
|
@click="resetSearchFilters()"
|
||||||
|
>
|
||||||
Reset filters
|
Reset filters
|
||||||
</button>
|
</button>
|
||||||
<template v-if="value.length === 0 && showBoxes">
|
<template v-if="value.length === 0 && showBoxes">
|
||||||
<div class="boxes">
|
<div class="boxes">
|
||||||
<h3>{{ $t("search.types") }}</h3>
|
<h3>{{ $t("search.types") }}</h3>
|
||||||
<div>
|
<div>
|
||||||
<div class="mobile-boxes" tabindex="0" v-for="(v, k) in boxes" :key="k" role="button"
|
<div
|
||||||
@click="addToTypes('type:' + k)" :aria-label="v.label">
|
class="mobile-boxes"
|
||||||
|
tabindex="0"
|
||||||
|
v-for="(v, k) in boxes"
|
||||||
|
:key="k"
|
||||||
|
role="button"
|
||||||
|
@click="addToTypes('type:' + k)"
|
||||||
|
:aria-label="v.label"
|
||||||
|
>
|
||||||
<i class="material-icons">{{ v.icon }}</i>
|
<i class="material-icons">{{ v.icon }}</i>
|
||||||
<p>{{ v.label }}</p>
|
<p>{{ v.label }}</p>
|
||||||
</div>
|
</div>
|
||||||
|
@ -90,26 +125,51 @@
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<template>
|
<template>
|
||||||
<ButtonGroup :buttons="folderSelect" @button-clicked="addToTypes" @remove-button-clicked="removeFromTypes"
|
<ButtonGroup
|
||||||
@disableAll="folderSelectClicked()" @enableAll="resetButtonGroups()" />
|
:buttons="folderSelect"
|
||||||
<ButtonGroup :buttons="typeSelect" @button-clicked="addToTypes" @remove-button-clicked="removeFromTypes"
|
@button-clicked="addToTypes"
|
||||||
:isDisabled="isTypeSelectDisabled" />
|
@remove-button-clicked="removeFromTypes"
|
||||||
|
@disableAll="folderSelectClicked()"
|
||||||
|
@enableAll="resetButtonGroups()"
|
||||||
|
/>
|
||||||
|
<ButtonGroup
|
||||||
|
:buttons="typeSelect"
|
||||||
|
@button-clicked="addToTypes"
|
||||||
|
@remove-button-clicked="removeFromTypes"
|
||||||
|
:isDisabled="isTypeSelectDisabled"
|
||||||
|
/>
|
||||||
<div class="sizeConstraints">
|
<div class="sizeConstraints">
|
||||||
<div class="sizeInputWrapper">
|
<div class="sizeInputWrapper">
|
||||||
<p>Smaller Than:</p>
|
<p>Smaller Than:</p>
|
||||||
<input class="sizeInput" v-model="smallerThan" type="number" min="0" placeholder="number" />
|
<input
|
||||||
|
class="sizeInput"
|
||||||
|
v-model="smallerThan"
|
||||||
|
type="number"
|
||||||
|
min="0"
|
||||||
|
placeholder="number"
|
||||||
|
/>
|
||||||
<p>MB</p>
|
<p>MB</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="sizeInputWrapper">
|
<div class="sizeInputWrapper">
|
||||||
<p>Larger Than:</p>
|
<p>Larger Than:</p>
|
||||||
<input class="sizeInput" v-model="largerThan" type="number" placeholder="number" />
|
<input
|
||||||
|
class="sizeInput"
|
||||||
|
v-model="largerThan"
|
||||||
|
type="number"
|
||||||
|
placeholder="number"
|
||||||
|
/>
|
||||||
<p>MB</p>
|
<p>MB</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</template>
|
</template>
|
||||||
<ul v-show="results.length > 0">
|
<ul v-show="results.length > 0">
|
||||||
<li v-for="(s, k) in results" :key="k" @click.stop.prevent="navigateTo(s.url)" style="cursor: pointer">
|
<li
|
||||||
|
v-for="(s, k) in results"
|
||||||
|
:key="k"
|
||||||
|
@click.stop.prevent="navigateTo(s.url)"
|
||||||
|
style="cursor: pointer"
|
||||||
|
>
|
||||||
<router-link to="#" event="">
|
<router-link to="#" event="">
|
||||||
<i v-if="s.dir" class="material-icons folder-icons"> folder </i>
|
<i v-if="s.dir" class="material-icons folder-icons"> folder </i>
|
||||||
<i v-else-if="s.audio" class="material-icons audio-icons"> volume_up </i>
|
<i v-else-if="s.audio" class="material-icons audio-icons"> volume_up </i>
|
||||||
|
@ -142,7 +202,7 @@
|
||||||
border-right: 1px solid gray;
|
border-right: 1px solid gray;
|
||||||
}
|
}
|
||||||
|
|
||||||
#result-desktop>#result-list {
|
#result-desktop > #result-list {
|
||||||
max-height: 80vh;
|
max-height: 80vh;
|
||||||
width: 35em;
|
width: 35em;
|
||||||
overflow: scroll;
|
overflow: scroll;
|
||||||
|
@ -180,8 +240,8 @@
|
||||||
#search.active #result-desktop ul li a {
|
#search.active #result-desktop ul li a {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: .3em 0;
|
padding: 0.3em 0;
|
||||||
margin-right: .3em;
|
margin-right: 0.3em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#search #result-list.active {
|
#search #result-list.active {
|
||||||
|
@ -204,10 +264,10 @@
|
||||||
|
|
||||||
/* Search */
|
/* Search */
|
||||||
#search {
|
#search {
|
||||||
background-color:unset;
|
background-color: unset;
|
||||||
z-index:3;
|
z-index: 3;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: .5em;
|
top: 0.5em;
|
||||||
min-width: 35em;
|
min-width: 35em;
|
||||||
left: 50%;
|
left: 50%;
|
||||||
-webkit-transform: translateX(-50%);
|
-webkit-transform: translateX(-50%);
|
||||||
|
@ -259,7 +319,6 @@
|
||||||
direction: rtl;
|
direction: rtl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#search #result {
|
#search #result {
|
||||||
padding-top: 1em;
|
padding-top: 1em;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
|
@ -280,7 +339,7 @@ body.rtl #search #result {
|
||||||
direction: ltr;
|
direction: ltr;
|
||||||
}
|
}
|
||||||
|
|
||||||
#search #result>div>*:first-child {
|
#search #result > div > *:first-child {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,7 +349,7 @@ body.rtl #search #result {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Search Results */
|
/* Search Results */
|
||||||
body.rtl #search #result ul>* {
|
body.rtl #search #result ul > * {
|
||||||
direction: ltr;
|
direction: ltr;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
@ -415,7 +474,7 @@ body.rtl #search .boxes h3 {
|
||||||
width: 5em;
|
width: 5em;
|
||||||
border-radius: 1em;
|
border-radius: 1em;
|
||||||
padding: 1em;
|
padding: 1em;
|
||||||
backdrop-filter: invert(.1);
|
backdrop-filter: invert(0.1);
|
||||||
border: none !important;
|
border: none !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -431,7 +490,7 @@ body.rtl #search .boxes h3 {
|
||||||
-webkit-box-align: center;
|
-webkit-box-align: center;
|
||||||
-ms-flex-align: center;
|
-ms-flex-align: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
border: 1px solid #ccc
|
border: 1px solid #ccc;
|
||||||
}
|
}
|
||||||
|
|
||||||
.helpButton {
|
.helpButton {
|
||||||
|
@ -457,6 +516,7 @@ body.rtl #search .boxes h3 {
|
||||||
import ButtonGroup from "./ButtonGroup.vue";
|
import ButtonGroup from "./ButtonGroup.vue";
|
||||||
import { mapState, mapGetters, mapMutations } from "vuex";
|
import { mapState, mapGetters, mapMutations } from "vuex";
|
||||||
import { search } from "@/api";
|
import { search } from "@/api";
|
||||||
|
import { darkMode } from "@/utils/constants";
|
||||||
|
|
||||||
var boxes = {
|
var boxes = {
|
||||||
folder: { label: "folders", icon: "folder" },
|
folder: { label: "folders", icon: "folder" },
|
||||||
|
@ -506,12 +566,11 @@ export default {
|
||||||
const resultList = document.getElementById("result-list");
|
const resultList = document.getElementById("result-list");
|
||||||
if (!active) {
|
if (!active) {
|
||||||
resultList.classList.remove("active");
|
resultList.classList.remove("active");
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
resultList.classList.add("active");
|
resultList.classList.add("active");
|
||||||
}, 100);
|
}, 100);
|
||||||
|
|
||||||
},
|
},
|
||||||
show(val, old) {
|
show(val, old) {
|
||||||
this.active = val === "search";
|
this.active = val === "search";
|
||||||
|
@ -543,7 +602,7 @@ export default {
|
||||||
...mapState(["user", "show"]),
|
...mapState(["user", "show"]),
|
||||||
...mapGetters(["isListing"]),
|
...mapGetters(["isListing"]),
|
||||||
isDarkMode() {
|
isDarkMode() {
|
||||||
return this.user.darkMode === true
|
return this.user && this.user.darkMode ? this.user.darkMode : darkMode;
|
||||||
},
|
},
|
||||||
showBoxes() {
|
showBoxes() {
|
||||||
return this.searchTypes == "";
|
return this.searchTypes == "";
|
||||||
|
@ -630,7 +689,6 @@ export default {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
this.searchTypes = this.searchTypes + string + " ";
|
this.searchTypes = this.searchTypes + string + " ";
|
||||||
|
|
||||||
},
|
},
|
||||||
resetSearchFilters() {
|
resetSearchFilters() {
|
||||||
this.searchTypes = "";
|
this.searchTypes = "";
|
||||||
|
|
|
@ -1,59 +1,99 @@
|
||||||
<template>
|
<template>
|
||||||
<nav :class="{ active, 'dark-mode': isDarkMode }">
|
<nav :class="{ active, 'dark-mode': isDarkMode }">
|
||||||
<template v-if="isLogged">
|
<template v-if="isLogged">
|
||||||
<button class="action" @click="toRoot" :aria-label="$t('sidebar.myFiles')" :title="$t('sidebar.myFiles')">
|
<button
|
||||||
|
class="action"
|
||||||
|
@click="toRoot"
|
||||||
|
:aria-label="$t('sidebar.myFiles')"
|
||||||
|
:title="$t('sidebar.myFiles')"
|
||||||
|
>
|
||||||
<i class="material-icons">folder</i>
|
<i class="material-icons">folder</i>
|
||||||
<span>{{ $t("sidebar.myFiles") }}</span>
|
<span>{{ $t("sidebar.myFiles") }}</span>
|
||||||
</button>
|
</button>
|
||||||
<div v-if="user.perm.create">
|
<div v-if="user.perm.create">
|
||||||
<button @click="$store.commit('showHover', 'newDir')" class="action" :aria-label="$t('sidebar.newFolder')"
|
<button
|
||||||
:title="$t('sidebar.newFolder')">
|
@click="$store.commit('showHover', 'newDir')"
|
||||||
|
class="action"
|
||||||
|
:aria-label="$t('sidebar.newFolder')"
|
||||||
|
:title="$t('sidebar.newFolder')"
|
||||||
|
>
|
||||||
<i class="material-icons">create_new_folder</i>
|
<i class="material-icons">create_new_folder</i>
|
||||||
<span>{{ $t("sidebar.newFolder") }}</span>
|
<span>{{ $t("sidebar.newFolder") }}</span>
|
||||||
</button>
|
</button>
|
||||||
<button @click="$store.commit('showHover', 'newFile')" class="action" :aria-label="$t('sidebar.newFile')"
|
<button
|
||||||
:title="$t('sidebar.newFile')">
|
@click="$store.commit('showHover', 'newFile')"
|
||||||
|
class="action"
|
||||||
|
:aria-label="$t('sidebar.newFile')"
|
||||||
|
:title="$t('sidebar.newFile')"
|
||||||
|
>
|
||||||
<i class="material-icons">note_add</i>
|
<i class="material-icons">note_add</i>
|
||||||
<span>{{ $t("sidebar.newFile") }}</span>
|
<span>{{ $t("sidebar.newFile") }}</span>
|
||||||
</button>
|
</button>
|
||||||
<button id="upload-button" @click="upload($event)" class="action" >
|
<button id="upload-button" @click="upload($event)" class="action">
|
||||||
<i class="material-icons">file_upload</i>
|
<i class="material-icons">file_upload</i>
|
||||||
<span>Upload file</span>
|
<span>Upload file</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button class="action" @click="toSettings" :aria-label="$t('sidebar.settings')" :title="$t('sidebar.settings')">
|
<button
|
||||||
|
class="action"
|
||||||
|
@click="toSettings"
|
||||||
|
:aria-label="$t('sidebar.settings')"
|
||||||
|
:title="$t('sidebar.settings')"
|
||||||
|
>
|
||||||
<i class="material-icons">settings_applications</i>
|
<i class="material-icons">settings_applications</i>
|
||||||
<span>{{ $t("sidebar.settings") }}</span>
|
<span>{{ $t("sidebar.settings") }}</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button v-if="canLogout" @click="logout" class="action" id="logout" :aria-label="$t('sidebar.logout')"
|
<button
|
||||||
:title="$t('sidebar.logout')">
|
v-if="canLogout"
|
||||||
|
@click="logout"
|
||||||
|
class="action"
|
||||||
|
id="logout"
|
||||||
|
:aria-label="$t('sidebar.logout')"
|
||||||
|
:title="$t('sidebar.logout')"
|
||||||
|
>
|
||||||
<i class="material-icons">exit_to_app</i>
|
<i class="material-icons">exit_to_app</i>
|
||||||
<span>{{ $t("sidebar.logout") }}</span>
|
<span>{{ $t("sidebar.logout") }}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<template v-else>
|
<template v-else>
|
||||||
<router-link class="action" to="/login" :aria-label="$t('sidebar.login')" :title="$t('sidebar.login')">
|
<router-link
|
||||||
|
class="action"
|
||||||
|
to="/login"
|
||||||
|
:aria-label="$t('sidebar.login')"
|
||||||
|
:title="$t('sidebar.login')"
|
||||||
|
>
|
||||||
<i class="material-icons">exit_to_app</i>
|
<i class="material-icons">exit_to_app</i>
|
||||||
<span>{{ $t("sidebar.login") }}</span>
|
<span>{{ $t("sidebar.login") }}</span>
|
||||||
</router-link>
|
</router-link>
|
||||||
<router-link v-if="signup" class="action" to="/login" :aria-label="$t('sidebar.signup')"
|
<router-link
|
||||||
:title="$t('sidebar.signup')">
|
v-if="signup"
|
||||||
|
class="action"
|
||||||
|
to="/login"
|
||||||
|
:aria-label="$t('sidebar.signup')"
|
||||||
|
:title="$t('sidebar.signup')"
|
||||||
|
>
|
||||||
<i class="material-icons">person_add</i>
|
<i class="material-icons">person_add</i>
|
||||||
<span>{{ $t("sidebar.signup") }}</span>
|
<span>{{ $t("sidebar.signup") }}</span>
|
||||||
</router-link>
|
</router-link>
|
||||||
</template>
|
</template>
|
||||||
<div class="credits" v-if="$router.currentRoute.path.includes('/files/') && !disableUsedPercentage
|
<div
|
||||||
">
|
class="credits"
|
||||||
|
v-if="$router.currentRoute.path.includes('/files/') && !disableUsedPercentage"
|
||||||
|
>
|
||||||
<progress-bar :val="usage.usedPercentage" size="medium"></progress-bar>
|
<progress-bar :val="usage.usedPercentage" size="medium"></progress-bar>
|
||||||
<span style="text-align:center">{{ usage.usedPercentage }}%</span>
|
<span style="text-align: center">{{ usage.usedPercentage }}%</span>
|
||||||
<span>{{ usage.used }} of {{ usage.total }} used</span>
|
<span>{{ usage.used }} of {{ usage.total }} used</span>
|
||||||
<br>
|
<br />
|
||||||
<span v-if="disableExternal">File Browser</span>
|
<span v-if="disableExternal">File Browser</span>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
<a rel="noopener noreferrer" target="_blank" href="https://github.com/gtsteffaniak/filebrowser">
|
<a
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
target="_blank"
|
||||||
|
href="https://github.com/gtsteffaniak/filebrowser"
|
||||||
|
>
|
||||||
File Browser
|
File Browser
|
||||||
</a>
|
</a>
|
||||||
</span>
|
</span>
|
||||||
|
@ -79,6 +119,7 @@ import {
|
||||||
import { files as api } from "@/api";
|
import { files as api } from "@/api";
|
||||||
import ProgressBar from "vue-simple-progress";
|
import ProgressBar from "vue-simple-progress";
|
||||||
import prettyBytes from "pretty-bytes";
|
import prettyBytes from "pretty-bytes";
|
||||||
|
import { darkMode } from "@/utils/constants";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "sidebar",
|
name: "sidebar",
|
||||||
|
@ -88,7 +129,7 @@ export default {
|
||||||
computed: {
|
computed: {
|
||||||
...mapState(["user"]),
|
...mapState(["user"]),
|
||||||
isDarkMode() {
|
isDarkMode() {
|
||||||
return this.user.darkMode === true
|
return this.user && this.user.darkMode ? this.user.darkMode : darkMode;
|
||||||
},
|
},
|
||||||
...mapGetters(["isLogged"]),
|
...mapGetters(["isLogged"]),
|
||||||
active() {
|
active() {
|
||||||
|
@ -130,11 +171,11 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
toRoot() {
|
toRoot() {
|
||||||
this.$router.push({ path: "/files/" }, () => { });
|
this.$router.push({ path: "/files/" }, () => {});
|
||||||
this.$store.commit("closeHovers");
|
this.$store.commit("closeHovers");
|
||||||
},
|
},
|
||||||
toSettings() {
|
toSettings() {
|
||||||
this.$router.push({ path: "/settings" }, () => { });
|
this.$router.push({ path: "/settings" }, () => {});
|
||||||
this.$store.commit("closeHovers");
|
this.$store.commit("closeHovers");
|
||||||
},
|
},
|
||||||
help() {
|
help() {
|
||||||
|
|
|
@ -16,14 +16,16 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import editorBar from "./bars/EditorBar.vue"
|
import editorBar from "./bars/EditorBar.vue";
|
||||||
import defaultBar from "./bars/Default.vue"
|
import defaultBar from "./bars/Default.vue";
|
||||||
import listingBar from "./bars/ListingBar.vue"
|
import listingBar from "./bars/ListingBar.vue";
|
||||||
import Prompts from "@/components/prompts/Prompts";
|
import Prompts from "@/components/prompts/Prompts";
|
||||||
import { mapState, mapGetters } from "vuex";
|
import { mapState, mapGetters } from "vuex";
|
||||||
import Sidebar from "@/components/Sidebar.vue";
|
import Sidebar from "@/components/Sidebar.vue";
|
||||||
import UploadFiles from "../components/prompts/UploadFiles";
|
import UploadFiles from "../components/prompts/UploadFiles";
|
||||||
import { enableExec } from "@/utils/constants";
|
import { enableExec } from "@/utils/constants";
|
||||||
|
import { darkMode } from "@/utils/constants";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "layout",
|
name: "layout",
|
||||||
components: {
|
components: {
|
||||||
|
@ -46,7 +48,7 @@ export default {
|
||||||
...mapGetters(["isLogged", "progress", "isListing"]),
|
...mapGetters(["isLogged", "progress", "isListing"]),
|
||||||
...mapState(["req", "user", "state"]),
|
...mapState(["req", "user", "state"]),
|
||||||
isDarkMode() {
|
isDarkMode() {
|
||||||
return this.user.darkMode === true
|
return this.user && this.user.darkMode ? this.user.darkMode : darkMode;
|
||||||
},
|
},
|
||||||
isExecEnabled: () => enableExec,
|
isExecEnabled: () => enableExec,
|
||||||
currentView() {
|
currentView() {
|
||||||
|
@ -56,10 +58,7 @@ export default {
|
||||||
|
|
||||||
if (this.req.isDir) {
|
if (this.req.isDir) {
|
||||||
return "listing";
|
return "listing";
|
||||||
} else if (
|
} else if (this.req.type === "text" || this.req.type === "textImmutable") {
|
||||||
this.req.type === "text" ||
|
|
||||||
this.req.type === "textImmutable"
|
|
||||||
) {
|
|
||||||
return "editor";
|
return "editor";
|
||||||
} else {
|
} else {
|
||||||
return "preview";
|
return "preview";
|
||||||
|
@ -75,28 +74,25 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getTitle() {
|
getTitle() {
|
||||||
let title = "Title"
|
let title = "Title";
|
||||||
if (this.$route.path.startsWith('/settings/')) {
|
if (this.$route.path.startsWith("/settings/")) {
|
||||||
title = "Settings"
|
title = "Settings";
|
||||||
}
|
}
|
||||||
return title
|
return title;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
||||||
/* Use the class .dark-mode to apply styles conditionally */
|
/* Use the class .dark-mode to apply styles conditionally */
|
||||||
.dark-mode {
|
.dark-mode {
|
||||||
background: var(--background);
|
background: var(--background);
|
||||||
color: var(--textPrimary);
|
color: var(--textPrimary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Header */
|
/* Header */
|
||||||
.dark-mode-header {
|
.dark-mode-header {
|
||||||
color:white;
|
|
||||||
background: var(--surfacePrimary);
|
background: var(--surfacePrimary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,5 +103,4 @@ export default {
|
||||||
backdrop-filter: blur(16px) invert(0.1);
|
backdrop-filter: blur(16px) invert(0.1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
</style>
|
||||||
</style>
|
|
||||||
|
|
Loading…
Reference in New Issue