fix: (Share Page)

- Fixed the pagination logic in `filelisting`.
- Restored the original functionality of `header-bar`.
This commit is contained in:
kissudad@outlook.com 2024-04-10 23:22:41 +08:00
parent bb8c4b7884
commit 00a2527151
5 changed files with 50 additions and 68 deletions

View File

@ -1,15 +1,17 @@
<template> <template>
<div> <div>
<header-bar showMenu showLogo> <header-bar showMenu showLogo>
<search /> <search v-if="enableSearch" />
<title /> <title />
<action <action
v-if="enableSearch"
class="search-button" class="search-button"
icon="search" icon="search"
:label="t('buttons.search')" :label="t('buttons.search')"
@action="openSearch()" @action="openSearch()"
/> />
<slot />
<template #actions> <template #actions>
<template v-if="!isMobile"> <template v-if="!isMobile">
<action <action
@ -74,7 +76,7 @@
/> />
<action icon="info" :label="t('buttons.info')" show="info" /> <action icon="info" :label="t('buttons.info')" show="info" />
<action <action
v-if="authStore.isLoggedIn" v-if="showMultipleSelectionButton"
icon="check_circle" icon="check_circle"
:label="t('buttons.selectMultiple')" :label="t('buttons.selectMultiple')"
@action="toggleMultipleSelection" @action="toggleMultipleSelection"
@ -313,9 +315,17 @@ import {
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { storeToRefs } from "pinia"; import { storeToRefs } from "pinia";
const { headerStickyTop } = defineProps<{ const { headerStickyTop } = withDefaults(
headerStickyTop?: string; defineProps<{
}>(); headerStickyTop?: string;
enableSearch: boolean;
showMultipleSelectionButton: boolean;
}>(),
{
enableSearch: true,
showMultipleSelectionButton: true,
}
);
const showLimit = ref<number>(50); const showLimit = ref<number>(50);
const columnWidth = ref<number>(280); const columnWidth = ref<number>(280);

View File

@ -56,7 +56,7 @@
.share__box__items { .share__box__items {
text-align: left; text-align: left;
flex: 10 0 25em; flex: 10 0 32em;
} }
.share__box__items #listing.list .item { .share__box__items #listing.list .item {

View File

@ -1,14 +0,0 @@
import { defineStore } from "pinia";
/**
* Dummy store for exposing router to be used in other stores
* @example
* // route: () => {
* // const routerStore = useRouterStore();
* // return routerStore.router.currentRoute;
* // },
*/
export const useRouterStore = defineStore("routerStore", () => {
// can be an empty definition
return {};
});

View File

@ -47,7 +47,7 @@ import Breadcrumbs from "@/components/Breadcrumbs.vue";
import Errors from "@/views/Errors.vue"; import Errors from "@/views/Errors.vue";
import { useI18n } from "vue-i18n"; import { useI18n } from "vue-i18n";
import { useRoute } from "vue-router"; import { useRoute } from "vue-router";
import FileListing from "@/views/files/FileListing.vue"; import FileListing from "@/components/files/FileListing.vue";
import { StatusError } from "@/api/utils"; import { StatusError } from "@/api/utils";
const Editor = defineAsyncComponent(() => import("@/views/files/Editor.vue")); const Editor = defineAsyncComponent(() => import("@/views/files/Editor.vue"));
const Preview = defineAsyncComponent(() => import("@/views/files/Preview.vue")); const Preview = defineAsyncComponent(() => import("@/views/files/Preview.vue"));

View File

@ -1,31 +1,5 @@
<template> <template>
<div> <div>
<header-bar showMenu showLogo>
<title />
<action
v-if="fileStore.selectedCount"
icon="file_download"
:label="t('buttons.download')"
@action="download"
:counter="fileStore.selectedCount"
/>
<button
v-if="isSingleFile()"
class="action copy-clipboard"
:aria-label="t('buttons.copyDownloadLinkToClipboard')"
:data-title="t('buttons.copyDownloadLinkToClipboard')"
@click="copyToClipboard(linkSelected())"
>
<i class="material-icons">content_paste</i>
</button>
<action
icon="check_circle"
:label="t('buttons.selectMultiple')"
@action="toggleMultipleSelection"
/>
</header-bar>
<breadcrumbs :base="'/share/' + hash" /> <breadcrumbs :base="'/share/' + hash" />
<div v-if="layoutStore.loading"> <div v-if="layoutStore.loading">
@ -77,12 +51,10 @@
<div class="share"> <div class="share">
<div <div
class="share__box share__box__info" class="share__box share__box__info"
style=" style="position: -webkit-sticky; position: sticky; z-index: 999"
position: -webkit-sticky; :style="{
position: sticky; top: isMobile ? '-25.6em' : '4em',
top: -25.6em; }"
z-index: 999;
"
> >
<div class="share__box__header" style="height: 3em"> <div class="share__box__header" style="height: 3em">
{{ {{
@ -233,10 +205,32 @@
style="background-color: transparent" style="background-color: transparent"
> >
<FileListing <FileListing
:header-sticky-top=" :header-sticky-top="isMobile ? '19em' : '4em'"
useMediaQuery('min-width: 916px') ? '19em' : '0' :enable-search="false"
" :show-multiple-selection-button="false"
/> >
<action
v-if="fileStore.selectedCount"
icon="file_download"
:label="t('buttons.download')"
@action="download"
:counter="fileStore.selectedCount"
/>
<button
v-if="isSingleFile()"
class="action copy-clipboard"
:aria-label="t('buttons.copyDownloadLinkToClipboard')"
:data-title="t('buttons.copyDownloadLinkToClipboard')"
@click="copyToClipboard(linkSelected())"
>
<i class="material-icons">content_paste</i>
</button>
<action
icon="check_circle"
:label="t('buttons.selectMultiple')"
@action="toggleMultipleSelection"
/>
</FileListing>
</div> </div>
<div <div
v-else-if="req.isDir && req.items.length === 0" v-else-if="req.isDir && req.items.length === 0"
@ -257,12 +251,11 @@ import { pub as api } from "@/api";
import { filesize } from "@/utils"; import { filesize } from "@/utils";
import dayjs from "dayjs"; import dayjs from "dayjs";
import HeaderBar from "@/components/header/HeaderBar.vue";
import Action from "@/components/header/Action.vue"; import Action from "@/components/header/Action.vue";
import Breadcrumbs from "@/components/Breadcrumbs.vue"; import Breadcrumbs from "@/components/Breadcrumbs.vue";
import Errors from "@/views/Errors.vue"; import Errors from "@/views/Errors.vue";
import QrcodeVue from "qrcode.vue"; import QrcodeVue from "qrcode.vue";
import FileListing from "@/views/files/FileListing.vue"; import FileListing from "@/components/files/FileListing.vue";
import { useFileStore } from "@/stores/file"; import { useFileStore } from "@/stores/file";
import { useAuthStore } from "@/stores/auth"; import { useAuthStore } from "@/stores/auth";
@ -276,6 +269,7 @@ import { copy } from "@/utils/clipboard";
import { storeToRefs } from "pinia"; import { storeToRefs } from "pinia";
import { useMediaQuery } from "@vueuse/core"; import { useMediaQuery } from "@vueuse/core";
const isMobile = useMediaQuery("(max-width: 1125px)");
const error = ref<StatusError | null>(null); const error = ref<StatusError | null>(null);
const showLimit = ref<number>(100); const showLimit = ref<number>(100);
const password = ref<string>(""); const password = ref<string>("");
@ -415,6 +409,7 @@ const keyEvent = (event: KeyboardEvent) => {
const toggleMultipleSelection = () => { const toggleMultipleSelection = () => {
fileStore.toggleMultiple(); fileStore.toggleMultiple();
layoutStore.closeHovers();
}; };
const isSingleFile = () => const isSingleFile = () =>
@ -489,12 +484,3 @@ onBeforeUnmount(() => {
window.removeEventListener("keydown", keyEvent); window.removeEventListener("keydown", keyEvent);
}); });
</script> </script>
<style scoped>
@media (min-width: 916px) {
.share__box__items {
height: calc(100vh - 9.8em);
overflow-y: auto;
}
}
</style>