Files
filebrowser/frontend/src/views/Layout.vue
T

64 lines
1.8 KiB
Vue

<template>
<div :class="{ 'without-sidebar': hideSidebar }">
<div
v-if="layoutStore.loading"
class="navigation-progress"
role="progressbar"
:aria-label="$t('files.loading')"
></div>
<div v-if="uploadStore.totalBytes" class="progress">
<div
v-bind:style="{
width: sentPercent + '%',
}"
></div>
</div>
<sidebar v-if="!hideSidebar"></sidebar>
<main>
<router-view></router-view>
<shell
v-if="
enableExec && authStore.isLoggedIn && authStore.user?.perm.execute
"
/>
</main>
<prompts></prompts>
<upload-files></upload-files>
</div>
</template>
<script setup lang="ts">
import { useAuthStore } from "@/stores/auth";
import { useLayoutStore } from "@/stores/layout";
import { useFileStore } from "@/stores/file";
import { useUploadStore } from "@/stores/upload";
import Sidebar from "@/components/Sidebar.vue";
import Prompts from "@/components/prompts/Prompts.vue";
import Shell from "@/components/Shell.vue";
import UploadFiles from "@/components/prompts/UploadFiles.vue";
import { enableExec, hideLoginButton } from "@/utils/constants";
import { computed, watch } from "vue";
import { useRoute } from "vue-router";
const layoutStore = useLayoutStore();
const authStore = useAuthStore();
const fileStore = useFileStore();
const uploadStore = useUploadStore();
const route = useRoute();
const hideSidebar = computed(
() => route.name === "Share" && (hideLoginButton || layoutStore.publicLanding)
);
const sentPercent = computed(() =>
((uploadStore.sentBytes / uploadStore.totalBytes) * 100).toFixed(2)
);
watch(route, () => {
fileStore.selected = [];
fileStore.multiple = false;
if (layoutStore.currentPromptName !== "success") {
layoutStore.closeHovers();
}
});
</script>