empty page refactored

This commit is contained in:
Peter Papp
2021-08-20 17:51:58 +02:00
parent b5a8fe8b1a
commit b23259309c
15 changed files with 85 additions and 101 deletions
@@ -121,8 +121,6 @@
'isVisibleSidebar',
'FilePreviewType',
'currentFolder',
'browseHistory',
'homeDirectory',
'clipboard',
]),
isLoadedFolder() {
@@ -1,31 +1,10 @@
<template>
<div class="empty-page" v-if="isLoading || isEmpty">
<div class="empty-state">
<!--Shared empty message-->
<div class="text-content" v-if="$isThisLocation(['shared']) && ! isLoading">
<h1 class="title">{{ $t('shared.empty_shared') }}</h1>
<div v-if="!isLoading" class="text-content">
<slot></slot>
</div>
<!--Trash empty message-->
<div class="text-content" v-if="$isThisLocation(['trash', 'trash-root']) && ! isLoading">
<h1 class="title">{{ $t('empty_page.title') }}</h1>
</div>
<!--Base file browser empty message-->
<div class="text-content" v-if="$isThisLocation(['base', 'public', 'latest']) && !isLoading">
<h1 class="title">{{ $t('empty_page.title') }}</h1>
<p v-if="$checkPermission(['master', 'editor'])" class="description">{{ $t('empty_page.description') }}</p>
<ButtonUpload
v-if="$checkPermission(['master', 'editor'])"
button-style="theme"
>
{{ $t('empty_page.call_to_action') }}
</ButtonUpload>
</div>
<!--Spinner-->
<div class="text-content" v-if="isLoading">
<div v-else class="text-content">
<Spinner />
</div>
</div>
@@ -33,23 +12,16 @@
</template>
<script>
import ButtonUpload from '/resources/js/components/FilesView/ButtonUpload'
import Spinner from '/resources/js/components/FilesView/Spinner'
import {mapGetters} from 'vuex'
export default {
name: 'EmptyFilePage',
props: [
'title',
'description'
],
components: {
ButtonUpload,
Spinner,
},
computed: {
...mapGetters([
'currentFolder',
'isLoading',
'entries',
]),
@@ -20,9 +20,14 @@
<!--Mobile Actions-->
<FileActionsMobile>
<slot name="file-actions-mobile"></slot>
<slot name="file-actions-mobile" />
</FileActionsMobile>
<!--Show empty page if no content-->
<EmptyFilePage>
<slot name="empty-file-page" />
</EmptyFilePage>
<!--Item previews list-->
<div v-if="isList" class="file-list-wrapper">
<transition-group
@@ -64,9 +69,6 @@
/>
</transition-group>
</div>
<!--Show empty page if folder is empty-->
<EmptyFilePage />
</div>
<!--File Info Panel-->
@@ -29,14 +29,9 @@ export default {
MenuMobile,
Option,
},
computed: {
...mapGetters([
'homeDirectory'
]),
},
methods: {
goToFiles() {
this.$store.dispatch('getFolder', [{folder: this.homeDirectory, back: false, init: true}])
this.$store.dispatch('getFolder')
},
goToLatest() {
this.$store.dispatch('getLatest')
@@ -3,7 +3,7 @@
<!-- Go back-->
<div @click="goBack" class="go-back-button">
<chevron-left-icon size="17" class="icon-back" :class="{'is-visible': browseHistory.length > 1}" />
<chevron-left-icon size="17" class="icon-back" :class="{'is-visible': isLoadedFolder }" />
<!--Folder Title-->
<div class="directory-name">
@@ -26,7 +26,6 @@
import { MenuIcon, ChevronLeftIcon } from 'vue-feather-icons'
import {mapGetters} from 'vuex'
import {events} from '/resources/js/bus'
import {last} from 'lodash'
export default {
name: 'MobileToolBar',
@@ -41,39 +40,34 @@
'isVisibleSidebar',
'FilePreviewType',
'currentFolder',
'browseHistory',
'homeDirectory',
]),
directoryName() {
return this.currentFolder ? this.currentFolder.name : this.homeDirectory.name
}
directoryName() {
if (this.currentFolder) {
return this.currentFolder.name
} else {
return {
'RecentUploads': this.$t('Recent'),
'MySharedItems': this.$t('Shared'),
'Trash': this.$t('Trash'),
'Public': this.$t('Files'),
'Files': this.$t('Files'),
}[this.$route.name]
}
},
isLoadedFolder() {
return this.$route.params.id
},
},
methods: {
showMobileNavigation() {
events.$emit('mobile-menu:show', 'user-navigation')
events.$emit('mobileSelecting:stop')
},
goBack() {
let previousFolder = last(this.browseHistory)
if (previousFolder.location === 'trash-root') {
this.$store.dispatch('getTrash')
} else if (previousFolder.location === 'shared') {
this.$store.dispatch('getShared')
} else {
if ( this.$isThisLocation('public') ) {
this.$store.dispatch('browseShared', [{folder: previousFolder, back: true, init: false}])
} else {
this.$store.dispatch('getFolder', [{folder: previousFolder, back: true, init: false}])
}
}
},
goBack() {
if (this.isLoadedFolder) this.$router.back()
},
},
created() {
// Listen for hide sidebar
events.$on('show:content', () => {
if (this.isSidebarMenu) this.isSidebarMenu = false
})