A self-hosted media server and file management system
Vue ffmpegfile-serverjellyfinlaravelmediamedia-playermedia-servermediabrowsermediaservermusicmusic-librarymusic-playermusicplayerself-hostedvuejs
dashboard and layout changes
aminnausin5af638b80866
diff --git a/resources/js/components/cards/StatsCard.vue b/resources/js/components/cards/StatsCard.vueindex da7ae9d0..c97c2a21 100644--- a/resources/js/components/cards/StatsCard.vue+++ b/resources/js/components/cards/StatsCard.vue@@ -5,7 +5,10 @@ const props = defineProps<{ title: string; data?: any[]; forceCount?: number; cl<div:class="`flex flex-col gap-2 p-4 overflow-clip rounded-xl shadow-lg dark:bg-primary-dark-800/70 bg-white ring-1 ring-gray-900/5 flex-1 w-1/3 ${props.class}`">- <p class="text-sm dark:text-slate-400 text-slate-500 max-w-full text-nowrap">{{ props.title }}</p>+ <span>+ <slot name="icon"> </slot>+ <p class="text-sm dark:text-slate-400 text-slate-500 max-w-full text-nowrap">{{ props.title }}</p>+ </span><h3 class="text-xl">{{ props.forceCount ?? data?.length ?? 0 }}</h3></div></template>diff --git a/resources/js/components/charts/PulseLineChart.vue b/resources/js/components/charts/PulseLineChart.vueindex 65619893..aec19519 100644--- a/resources/js/components/charts/PulseLineChart.vue+++ b/resources/js/components/charts/PulseLineChart.vue@@ -62,7 +62,7 @@ const defaultChartOptions = {<template><Line- :class="`${props.class ?? 'w-full ring-1 ring-gray-900/5 bg-white dark:bg-gray-900 rounded-md shadow-sm'}`"+ :class="`${props.class ?? 'w-full ring-1 ring-gray-900/5 bg-white dark:bg-primary-dark-800 rounded-md shadow-sm'}`":data="props.chartData ?? defaultChartData":options="props.chartOptions ?? defaultChartOptions"></Line>diff --git a/resources/js/components/panels/NavBar.vue b/resources/js/components/panels/NavBar.vueindex f4372be0..96de4909 100755--- a/resources/js/components/panels/NavBar.vue+++ b/resources/js/components/panels/NavBar.vue@@ -73,6 +73,11 @@ watch(userData, handleAuthEvent, { immediate: false });</span><span class="flex flex-wrap sm:flex-nowrap sm:max-w-sm items-center gap-1 sm:shrink-0 justify-end sm:justify-normal sm:w-auto"><section id="navbar-video" class="flex items-center gap-1 text-slate-900 antialiased">+ <NavLink v-if="$route.name != 'home'" :label="'home'" :URL="'/'" :class="`ring-1 ring-gray-900/5`">+ <template #icon>+ <CircumMonitor height="24" width="24" />+ </template>+ </NavLink><NavButton v-if="username" @click="cycleSideBar('notifications')" :label="'notifications'" class="hidden"><template #icon><CircumInboxIn height="24" width="24" />@@ -111,11 +116,6 @@ watch(userData, handleAuthEvent, { immediate: false });<MaterialSymbolsLightMenu height="26" width="26" /></template></NavButton>- <NavLink v-if="$route.name != 'home'" :label="'home'" :URL="'/'" :class="`ring-1 ring-gray-900/5`">- <template #icon>- <CircumMonitor height="24" width="24" />- </template>- </NavLink></section><ToggleLightMode /></span>diff --git a/resources/js/components/panels/VideoSidebar.vue b/resources/js/components/panels/VideoSidebar.vueindex 29ba2eb7..bf5645f4 100755--- a/resources/js/components/panels/VideoSidebar.vue+++ b/resources/js/components/panels/VideoSidebar.vue@@ -32,37 +32,39 @@ watch(selectedSideBar, () => {</script><template>- <div class="flex p-1 text-ri">- <h1 id="sidebar-title" class="text-xl h-8 w-full capitalize dark:text-white">{{ selectedSideBar }}</h1>- </div>+ <div class="p-3">+ <div class="flex p-1 text-ri">+ <h1 id="sidebar-title" class="text-xl h-8 w-full capitalize dark:text-white">{{ selectedSideBar }}</h1>+ </div>- <hr class="mt-2 mb-3" />- <section v-if="selectedSideBar === 'folders'" id="list-content-folders" class="flex space-y-2 flex-wrap">- <FolderCard- v-for="folder in stateDirectory.folders"- :key="folder.id"- :folder="folder"- :categoryName="stateDirectory.name"- :stateFolderName="stateFolder?.name"- @clickAction="handleShare"- />- </section>- <section v-if="selectedSideBar === 'history'" id="list-content-history" class="flex space-y-2 flex-wrap">- <RecordCard v-for="record in stateRecords.slice(0, 10)" :key="record.id" :record="record" @clickAction="handleShare" />- <RouterLink- v-if="stateRecords.length != 0"- to="/history"- class="text-center text-sm dark:text-neutral-400 mx-auto p-3 hover:underline"- >View More</RouterLink- >- <h2 v-else class="text-gray-500 dark:text-gray-400 tracking-wider w-full py-2">Nothing Yet...</h2>- </section>- <ModalBase :modalData="shareModal">- <template #content>- <div class="py-3">Copy link to clipboard to share it.</div>- </template>- <template #controls>- <ButtonClipboard :text="shareLink" />- </template>- </ModalBase>+ <hr class="mt-2 mb-3" />+ <section v-if="selectedSideBar === 'folders'" id="list-content-folders" class="flex space-y-2 flex-wrap">+ <FolderCard+ v-for="folder in stateDirectory.folders"+ :key="folder.id"+ :folder="folder"+ :categoryName="stateDirectory.name"+ :stateFolderName="stateFolder?.name"+ @clickAction="handleShare"+ />+ </section>+ <section v-if="selectedSideBar === 'history'" id="list-content-history" class="flex space-y-2 flex-wrap">+ <RecordCard v-for="record in stateRecords.slice(0, 10)" :key="record.id" :record="record" @clickAction="handleShare" />+ <RouterLink+ v-if="stateRecords.length != 0"+ to="/history"+ class="text-center text-sm dark:text-neutral-400 mx-auto p-3 hover:underline"+ >View More</RouterLink+ >+ <h2 v-else class="text-gray-500 dark:text-gray-400 tracking-wider w-full py-2">Nothing Yet...</h2>+ </section>+ <ModalBase :modalData="shareModal">+ <template #content>+ <div class="py-3">Copy link to clipboard to share it.</div>+ </template>+ <template #controls>+ <ButtonClipboard :text="shareLink" />+ </template>+ </ModalBase>+ </div></template>diff --git a/resources/js/components/pulseCards/PulseServers.vue b/resources/js/components/pulseCards/PulseServers.vueindex c7780fb8..d16a095c 100644--- a/resources/js/components/pulseCards/PulseServers.vue+++ b/resources/js/components/pulseCards/PulseServers.vue@@ -305,7 +305,7 @@ watch(:id="`${server}-cpu-graph`":class="`flex items-center pr-8 xl:pr-12 ${(Object.keys(servers).length ?? 0) > 1 ? 'py-2' : ''} ${!servers[server].recently_reported ? 'opacity-25 animate-pulse' : ''}`">- <div class="w-full min-w-[5rem] max-w-xs h-9 relative">+ <div class="w-full min-w-[5rem] h-9 relative"><PulseLineChart:chart-data="{labels: Object.keys(servers[server].cpu),@@ -380,7 +380,7 @@ watch(:id="`${server}-memory-graph`":class="`flex items-center pr-8 xl:pr-12 ${(Object.keys(servers).length ?? 0) > 1 ? 'py-2' : ''} ${!servers[server].recently_reported ? 'opacity-25 animate-pulse' : ''}`">- <div class="w-full min-w-[5rem] max-w-xs h-9 relative">+ <div class="w-full min-w-[5rem] h-9 relative"><PulseLineChart:chart-data="{labels: Object.keys(servers[server].memory),diff --git a/resources/js/layouts/LayoutBase.vue b/resources/js/layouts/LayoutBase.vueindex 713ac4fc..2d8fa21b 100755--- a/resources/js/layouts/LayoutBase.vue+++ b/resources/js/layouts/LayoutBase.vue@@ -23,13 +23,17 @@ const scrollBody = ref(null);<mainclass="grid grid-cols-1 lg:grid-cols-6 p-6 gap-6 snap-y bg-primary-950 dark:bg-primary-dark-950 dark:text-[#e2e0e2] font-sans text-gray-900 antialiased">- <section id="left-card" class="col-span-1 h-fit order-2 lg:order-1 p-3 pb-6 rounded-2xl space-y-2 scroll-mt-6 hidden lg:block">+ <section+ id="left-card"+ :class="{ invisible: !selectedSideBar }"+ class="col-span-1 h-fit order-2 lg:order-1 bg-primary-900 dark:bg-primary-dark-900 dark:text-[#e2e0e2] shadow-xl rounded-2xl space-y-2 scroll-mt-6 z-20 ring-1 ring-gray-900/5"+ ><slot name="leftSidebar"></slot></section><!-- class="bg-primary-900 dark:bg-primary-dark-900 dark:text-[#e2e0e2] shadow-xl p-6 pt-3 rounded-2xl w-full h-fit flex flex-col gap-3 z-20 ring-1 ring-gray-900/5" --><sectionid="content-card"- class="col-span-4 flex-grow order-1 lg:order-2 bg-primary-900 dark:bg-primary-dark-900 dark:text-[#e2e0e2] shadow-xl p-6 pt-3 rounded-2xl w-full h-fit flex flex-col gap-3 z-20 ring-1 ring-gray-900/5"+ class="col-span-full lg:col-span-4 flex-grow order-1 lg:order-2 bg-primary-900 dark:bg-primary-dark-900 dark:text-[#e2e0e2] shadow-xl p-6 pt-3 rounded-2xl w-full h-fit flex flex-col gap-3 z-20 ring-1 ring-gray-900/5"><NavBar class="z-20" /><slot name="content" class="relative z-0"></slot>@@ -37,7 +41,7 @@ const scrollBody = ref(null);<sectionid="list-card":class="{ invisible: !selectedSideBar }"- class="col-span-1 h-fit order-3 bg-primary-900 dark:bg-primary-dark-900 dark:text-[#e2e0e2] shadow-xl p-3 rounded-2xl space-y-2 scroll-mt-6 z-20 ring-1 ring-gray-900/5"+ class="col-span-1 h-fit order-3 bg-primary-900 dark:bg-primary-dark-900 dark:text-[#e2e0e2] shadow-xl rounded-2xl space-y-2 scroll-mt-6 z-20 ring-1 ring-gray-900/5"><!-- w-full h-fit lg:w-1/6 lg:max-w-72 sm:min-w-32 shrink-0 --><!-- class="bg-primary-900 dark:bg-primary-dark-900 dark:text-[#e2e0e2] shadow-xl p-3 rounded-2xl w-full h-fit lg:w-1/6 lg:max-w-72 sm:min-w-32 shrink-0 space-y-2 scroll-mt-6 z-20 ring-1 ring-gray-900/5" -->diff --git a/resources/js/views/DashboardView.vue b/resources/js/views/DashboardView.vueindex db0bcd93..10592d47 100644--- a/resources/js/views/DashboardView.vue+++ b/resources/js/views/DashboardView.vue@@ -1,5 +1,5 @@<script setup lang="ts">-import { onMounted, ref } from 'vue';+import { nextTick, onMounted, ref, watch } from 'vue';import { useAppStore } from '@/stores/AppStore';import { storeToRefs } from 'pinia';import { getStats } from '@/service/siteAPI';@@ -10,9 +10,22 @@ import ModalBase from '@/components/pinesUI/ModalBase.vue';import StatsCard from '@/components/cards/StatsCard.vue';import useModal from '@/composables/useModal';+import LucideChartNoAxesCombined from '~icons/lucide/chart-no-axes-combined?width=24px&height=24px';+import ButtonText from '@/components/inputs/ButtonText.vue';+import CircumCirclePlus from '~icons/circum/circle-plus?width=24px&height=24px';++const dashboardPages = [+ { title: 'overview', timeControls: true },+ { title: 'content', timeControls: false },+ { title: 'activity', timeControls: false },+ { title: 'users', timeControls: false },+ { title: 'jobs', timeControls: false },+];+const cancelModal = useModal({ title: 'Cancel Job?', submitText: 'Confim' });const appStore = useAppStore();const stats = ref<{ title: string; count: number }[]>([]);+const dashboardPage = ref('overview');const { pageTitle, selectedSideBar } = storeToRefs(appStore);@@ -32,6 +45,12 @@ const setPeriod = (period: string) => {// window.location = `${location.pathname}?${query}`;};+async function cycleSideBar(state: string) {+ if (!state) return;+ await nextTick();+ document.querySelector('#left-card')?.scrollIntoView({ behavior: 'smooth' });+}+onMounted(async () => {pageTitle.value = 'Dashboard';selectedSideBar.value = '';@@ -42,17 +61,51 @@ onMounted(async () => {const { data } = await getStats();stats.value = data;});+watch(() => selectedSideBar.value, cycleSideBar, { immediate: false });</script><template><LayoutBase><template v-slot:content>- <section id="content-dashboard" class="flex flex-wrap gap-4 flex-col min-h-[80vh]">- <PulseServers />- <span class="mx-auto grid grid-flow-row auto-rows-max gap-6 w-full">- <StatsCard v-for="stat in stats" :title="`Total ${stat.title}`" :forceCount="stat.count" />- </span>+ <section id="content-dashboard" class="min-h-[80vh]">+ <section class="flex flex-wrap gap-4 flex-col" v-if="dashboardPage == 'overview'">+ <PulseServers />+ <span class="mx-auto grid grid-cols-2 md:grid-cols-3 lg:grid-cols-6 gap-6 w-full">+ <StatsCard+ v-for="stat in stats"+ :title="`Total ${stat.title}`"+ :forceCount="stat.count"+ class="col-span-1 row-span-1 w-full"+ />+ <div+ :class="`flex col-span-2 row-span-4 flex-col gap-2 p-4 overflow-clip rounded-xl shadow-lg dark:bg-primary-dark-800/70 bg-white ring-1 ring-gray-900/5 w-full`"+ >+ <span class="flex items-center gap-2 w-full">+ <LucideChartNoAxesCombined class="h-6 w-6"></LucideChartNoAxesCombined>+ <p class="max-w-full text-nowrap">Totals</p>+ </span>+ <span v-for="(stat, index) in stats" :key="index" class="flex gap-2 capitalize items-center flex-wrap">+ <h3 class="text-sm dark:text-slate-400 text-slate-500 w-full text-nowrap">Total {{ stat.title }}</h3>+ <span>+ <h3 class="text-lg">{{ stat.count ?? 0 }}</h3>+ </span>+ <h4 class="text-sm text-green-600 ml-auto">+40%</h4>+ </span>+ </div>+ </span>+ </section>+ <section v-if="dashboardPage == 'content'">+ <span>+ <ButtonText title="Add New Category">+ <template #text class="flex">+ <p class="text-nowrap">Add New Category</p>+ <CircumCirclePlus height="24" width="24" />+ </template>+ </ButtonText>+ </span>+ </section></section>+<ModalBase :modalData="cancelModal" :action="handleCancel"><template #content><div class="relative w-auto pb-8">@@ -61,47 +114,55 @@ onMounted(async () => {</template></ModalBase></template>- <template v-slot:sidebar>+ <template v-slot:leftSidebar><!-- <HistorySidebar /> -->- <div class="flex p-1 text-ri">- <h1 id="sidebar-title" class="text-2xl h-8 w-full capitalize dark:text-white">{{ 'Management' }}</h1>- </div>+ <div class="p-3">+ <div class="flex p-1">+ <h1 id="sidebar-title" class="text-2xl h-8 w-full capitalize dark:text-white">{{ 'Management' }}</h1>+ </div>- <hr class="mt-2 mb-3" />+ <hr class="mt-2 mb-3" />- <section class="sm:text-lg flex flex-col gap-2">- <div- class="flex justify-between items-center bg-white rounded-lg p-2 shadow ring-inset ring-purple-600 hover:ring-[0.125rem]"- >- Pulse- <div class="flex items-center">- <button- @click="setPeriod('1_hour')"- class="p-1 font-semibold sm:text-lg text-gray-300 dark:text-gray-600 hover:text-gray-400 dark:hover:text-gray-500"- >- 1h- </button>- <button- @click="setPeriod('6_hours')"- class="p-1 font-semibold sm:text-lg text-gray-300 dark:text-gray-600 hover:text-gray-400 dark:hover:text-gray-500"- >- 6h- </button>- <button @click="setPeriod('24_hours')" class="p-1 font-semibold sm:text-lg text-gray-700 dark:text-gray-300">- 24h- </button>- <button- @click="setPeriod('7_days')"- class="p-1 font-semibold sm:text-lg text-gray-300 dark:text-gray-600 hover:text-gray-400 dark:hover:text-gray-500"- >- 7d- </button>+ <section class="sm:text-lg flex flex-col gap-2">+ <div+ v-for="(page, index) in dashboardPages"+ :key="index"+ :class="`+ flex flex-wrap items-center justify-between gap-2+ rounded-lg shadow p-3 group cursor-pointer+ capitalize dark:text-white overflow-hidden+ dark:bg-primary-dark-800/70 bg-primary-800 dark:hover:bg-primary-dark-600 hover:bg-gray-200+ ring-inset ring-purple-600/50 hover:ring-purple-600 hover:ring-[0.125rem] ${dashboardPage == page.title && 'ring-[0.125rem]'}+ `"+ @click="dashboardPage = page.title"+ >+ {{ page.title }}+ <div class="flex items-center flex-wrap gap-2" v-if="page.timeControls">+ <button+ @click="setPeriod('1_hour')"+ class="font-semibold sm:text-lg text-gray-300 dark:text-gray-600 hover:text-gray-400 dark:hover:text-gray-500"+ >+ 1h+ </button>+ <button+ @click="setPeriod('6_hours')"+ class="font-semibold sm:text-lg text-gray-300 dark:text-gray-600 hover:text-gray-400 dark:hover:text-gray-500"+ >+ 6h+ </button>+ <button @click="setPeriod('24_hours')" class="font-semibold sm:text-lg text-gray-700 dark:text-gray-300">+ 24h+ </button>+ <button+ @click="setPeriod('7_days')"+ class="font-semibold sm:text-lg text-gray-300 dark:text-gray-600 hover:text-gray-400 dark:hover:text-gray-500"+ >+ 7d+ </button>+ </div></div>- </div>- <div class="flex justify-between items-center bg-white rounded-lg p-2 shadow">Activity</div>- <div class="flex justify-between items-center bg-white rounded-lg p-2 shadow">Jobs</div>- <div class="flex justify-between items-center bg-white rounded-lg p-2 shadow">Content</div>- </section>+ </section>+ </div></template></LayoutBase></template>diff --git a/resources/js/views/VideoView.vue b/resources/js/views/VideoView.vueindex 0d4af1c4..00862bd9 100755--- a/resources/js/views/VideoView.vue+++ b/resources/js/views/VideoView.vue@@ -102,14 +102,7 @@ onMounted(async () => {await getCategory(URL_CATEGORY, URL_FOLDER);loading.value = false;- // pageTitle.value = 'Dashboard';selectedSideBar.value = '';- // (async () => {- // await getRecords();- // loading.value = false;- // })();- // const { data } = await getStats();- // stats.value = data;});watch(