Skip to content

A self-hosted media server and file management system

1.5 KB
Raw Blame
<script setup lang="ts">
import { useRecentlyUpdated, useRecentlyUploaded } from '@/service/explore/useExploreQueries';
import { defineAsyncComponent, computed } from 'vue';
import { useAppStore } from '@/stores/AppStore';

import SidebarSkeleton from '@/components/skeleton/composites/SidebarSkeleton.vue';

const { data: recentlyUploadedMusic, isLoading: isLoadingMusic } = useRecentlyUploaded('audio');
const { data: recentlyUploaded, isLoading: isLoadingVideo } = useRecentlyUploaded('video');
const { data: recentlyUpdated, isLoading: isLoadingUpdated } = useRecentlyUpdated();

const AppStore = useAppStore();
const ExploreActivityFeedAsync = defineAsyncComponent(async () => await import('@/components/explore/ExploreActivityFeed.vue'));
const HistorySidebarAsync = defineAsyncComponent(async () => await import('@/components/panels/HistorySidebar.vue'));

const isLoading = computed(() => isLoadingVideo.value || isLoadingMusic.value || isLoadingUpdated.value);
</script>

<template>
    <Suspense v-if="AppStore.selectedSideBar === 'feed'">
        <ExploreActivityFeedAsync :videos="recentlyUploaded" :music="recentlyUploadedMusic" :updated-folders="recentlyUpdated" :is-loading="isLoading" />

        <template #fallback>
            <SidebarSkeleton />
        </template>
    </Suspense>
    <Suspense v-if="AppStore.selectedSideBar === 'history'">
        <HistorySidebarAsync />
        <template #fallback>
            <SidebarSkeleton />
        </template>
    </Suspense>
</template>