A self-hosted media server and file management system
Vue ffmpegfile-serverjellyfinlaravelmediamedia-playermedia-servermediabrowsermediaservermusicmusic-librarymusic-playermusicplayerself-hostedvuejs
make folder and record cards consistant
aminnausin3265f0ca5d01
diff --git a/resources/js/components/cards/FolderCard.vue b/resources/js/components/cards/FolderCard.vueindex 712c2914..a4d18ebf 100644--- a/resources/js/components/cards/FolderCard.vue+++ b/resources/js/components/cards/FolderCard.vue@@ -1,21 +1,47 @@<script setup>- import { RouterLink } from 'vue-router';+import ButtonCorner from '../inputs/ButtonCorner.vue';+import CircumShare1 from '~icons/circum/share-1';+import CircumFolderOn from '~icons/circum/folder-on';- const { folder, categoryName } = defineProps(['folder', 'categoryName']);+import { RouterLink } from 'vue-router';+import { ref } from 'vue';++const props = defineProps(['folder', 'categoryName', 'stateFolderName']);+const folderLink = ref(`/${props.categoryName}/${props.folder.attributes.name}`)</script><template>- <RouterLink class="p-2 flex flex-wrap rounded-xl dark:bg-primary-dark-800 bg-primary-800 dark:text-white shadow-md w-full divide-y divide-gray-300 group" :to="`/${categoryName}/${folder.attributes.name}`">- <section class="flex justify-between items-baseline w-full">- <h2 class="text-xl truncate">{{ folder.attributes.name }}</h2>+ <RouterLink :to="folderLink"+ class="text-left relative flex flex-col gap-4 lg:gap-2 sm:flex-row flex-wrap rounded-xl dark:bg-primary-dark-800/70 bg-primary-800 dark:hover:bg-primary-dark-600 hover:bg-gray-200 dark:text-white shadow p-3 w-full group cursor-pointer divide-gray-300 dark:divide-gray-400">+ <section class="flex justify-between gap-4 w-full">+ <h2 class="text-xl w-full truncate">{{ props.folder.attributes.name }}</h2>+ <div class="flex justify-end gap-1">+ <ButtonCorner :positionClasses="'w-7 h-7'"+ :textClasses="'hover:text-neutral-900 dark:hover:text-violet-400'"+ :colourClasses="'dark:hover:bg-neutral-800 hover:bg-gray-300'"+ :label="'Share Folder'"+ @click.stop.prevent="$emit('clickAction', folderLink)">+ <template #icon>+ <CircumShare1 width="20" height="20" />+ </template>+ </ButtonCorner>+ <ButtonCorner :positionClasses="'w-7 h-7'"+ :textClasses="`${props.folder.attributes.name === props.stateFolderName ? 'text-violet-600' : 'hover:text-violet-600'} dark:hover:text-violet-500`"+ :colourClasses="'dark:hover:bg-neutral-800 hover:bg-gray-300'" :to="''"+ :label="'Open Folder'">+ <template #icon>+ <CircumFolderOn width="20" height="20" />+ </template>+ </ButtonCorner>+ </div>+ </section>+ <section class="flex flex-col sm:flex-row sm:justify-between w-full">+ <h3 class="text-neutral-500 w-full text-wrap truncate sm:text-nowrap">+ {{ props.folder.attributes.file_count }} Episode{{ props.folder.attributes.file_count !== 1 ? 's' : '' }}+ </h3>+ <h3 class="truncate text-nowrap sm:text-right text-neutral-500 w-full">+ <!-- some other folder statistic or data like number of seasons or if its popular or something -->+ </h3></section>- <aside class="flex justify-between items-center w-full pt-1">- <h3 class="text-left text-neutral-500 line-clamp-1">{{folder.attributes.file_count}} Episode{{folder.attributes.file_count !== 1 ? 's' : ''}}</h3>- <button class="hidden group-hover:flex space-x-1 folder-link">- <span class="flex hover:bg-orange-500 hover:stroke-none border-orange-500 border-2 rounded shadow px-2 space-x-1">- Watch- </span>- </button>- </aside></RouterLink></template>\ No newline at end of filediff --git a/resources/js/components/cards/RecordCard.vue b/resources/js/components/cards/RecordCard.vueindex 87a2ce6d..f0d9a359 100644--- a/resources/js/components/cards/RecordCard.vue+++ b/resources/js/components/cards/RecordCard.vue@@ -1,21 +1,66 @@<script setup>- import { toTimeSpan } from '../../service/util';+import ButtonCorner from '../inputs/ButtonCorner.vue';+import CircumShare1 from '~icons/circum/share-1';+import CircumPlay1 from '~icons/circum/play-1';- const { record } = defineProps(['record']);- const timeSpan = toTimeSpan((new Date(record.attributes.created_at.replace(' ', 'T'))))+import { toTimeSpan } from '../../service/util';+import { computed } from 'vue';++const props = defineProps(['record']);+const rawDate = new Date(props.record.attributes.created_at.replace(' ', 'T'));+const timeSpan = toTimeSpan(rawDate);++const videoLink = computed(() => {+ if(!props.record.relationships.video_id) return false;+ return (`/${encodeURIComponent(props.record.relationships.category_name)}/${encodeURIComponent(props.record.relationships.folder_name)}?video=${props.record.relationships.video_id}`);+})</script><template>- <div class="p-2 flex flex-wrap rounded-xl dark:bg-primary-dark-800 bg-primary-800 dark:text-white shadow-md w-full divide-y divide-gray-300 group">- <section class="flex justify-between items-baseline w-full">- <h2 class="text-xl text-left truncate">{{ record.relationships.video_name }}</h2>+++ <div+ class="text-left relative flex flex-col gap-4 lg:gap-2 sm:flex-row flex-wrap rounded-xl dark:bg-primary-dark-800/70 bg-primary-800 dark:hover:bg-primary-dark-600 hover:bg-gray-200 dark:text-white shadow p-3 w-full group cursor-pointer divide-gray-300 dark:divide-gray-400">+ <section class="flex justify-between gap-4 w-full">+ <h2 class="text-xl w-full truncate">{{ props.record.relationships.video_name }}</h2>+ <div class="flex justify-end gap-1">+ <ButtonCorner :positionClasses="'w-7 h-7'"+ :textClasses="'hover:text-neutral-900 dark:hover:text-violet-400'"+ :colourClasses="'dark:hover:bg-neutral-800 hover:bg-gray-300'"+ :label="'Share Folder'"+ @click.stop.prevent="$emit('clickAction', videoLink)">+ <template #icon>+ <CircumShare1 width="20" height="20" />+ </template>+ </ButtonCorner>+ <ButtonCorner v-if="videoLink" :positionClasses="'w-7 h-7'"+ :textClasses="`hover:text-violet-600 dark:hover:text-violet-500`"+ :colourClasses="'dark:hover:bg-neutral-800 hover:bg-gray-300'" :to="videoLink"+ :label="'Watch Video'">+ <template #icon>+ <CircumPlay1 width="20" height="20" />+ </template>+ </ButtonCorner>+ </div>+ </section>+ <section class="flex flex-col sm:flex-row sm:justify-between w-full">+ <h3 class="hidden lg:block text-neutral-500 w-full text-wrap truncate sm:text-nowrap">+ {{ props.record.relationships.folder_name }}+ </h3>+ <h3 class="hidden lg:block truncate text-right text-neutral-500 w-full line-clamp-2">+ {{ timeSpan }}+ </h3>+ <h3 class="lg:hidden text-neutral-500 w-full text-wrap truncate sm:text-nowrap">+ {{ props.record.relationships.folder_name }} · {{ timeSpan }}+ </h3>+ <h3 class="lg:hidden truncate sm:text-right text-neutral-500 w-full line-clamp-2">+ {{+ `${rawDate.toLocaleDateString('en-ca', {+ year: "numeric",+ month: '2-digit', day: '2-digit', hour: '2-digit', hour12: false, minute: '2-digit'+ })}`+ }}+ </h3></section>- <aside class="flex justify-between items-center w-full pt-1">- <h3 class="text-left text-neutral-500 truncate">{{ record.relationships.folder_name }}</h3>- <h3 class="text-right text-neutral-500 text-nowrap line-clamp-1 truncate">{{ timeSpan }}</h3>- <span class="hidden space-x-1">- <button class="hover:bg-orange-500 hover:stroke-none border-orange-500 border-2 rounded shadow px-2">Watch</button>- </span>- </aside></div></template>\ No newline at end of filediff --git a/resources/js/components/cards/RecordCardDetails.vue b/resources/js/components/cards/RecordCardDetails.vueindex 499c31dc..cf02af26 100644--- a/resources/js/components/cards/RecordCardDetails.vue+++ b/resources/js/components/cards/RecordCardDetails.vue@@ -1,6 +1,5 @@<script setup>import ButtonCorner from '../inputs/ButtonCorner.vue';-import CircumPlay1 from '~icons/circum/play-1';import { toTimeSpan } from '../../service/util';@@ -14,30 +13,30 @@ const timeSpan = toTimeSpan(rawDate);const videoLink = computed(() => {return (`/${encodeURIComponent(props.data.relationships.category_name)}/${encodeURIComponent(props.data.relationships.folder_name)}?video=${props.data.relationships.video_id}`);})-</script><template><button @click.stop.prevent="$emit('clickAction')"- class="text-left relative flex flex-col gap-2 sm:flex-row flex-wrap rounded-xl dark:bg-primary-dark-800 bg-primary-800 dark:hover:bg-neutral-700 hover:bg-slate-200 dark:text-white shadow p-3 w-full group cursor-pointer sm:divide-y divide-gray-300 dark:divide-gray-400">+ class="text-left relative flex flex-col gap-4 sm:flex-row flex-wrap rounded-xl dark:bg-primary-dark-800/70 bg-primary-800 dark:hover:bg-primary-dark-600 hover:bg-gray-200 dark:text-white shadow p-3 w-full group cursor-pointer divide-gray-300 dark:divide-neutral-400"><section class="flex justify-between gap-4 w-full"><h2 class="text-xl w-full truncate">{{ props.data.relationships.video_name }}</h2><div class="flex justify-end gap-1"><ButtonCorner :positionClasses="'w-7 h-7'"- :textClasses="'hover:text-indigo-600 dark:hover:text-indigo-400'"- :colourClasses="'dark:hover:bg-neutral-800 hover:bg-slate-300'" :to="videoLink">+ :textClasses="'hover:text-violet-600 dark:hover:text-violet-500'"+ :colourClasses="'dark:hover:bg-neutral-800 hover:bg-gray-300'" :to="videoLink"><template #icon><CircumPlay1 width="20" height="20"/></template></ButtonCorner><ButtonCorner :positionClasses="'w-7 h-7'" :textClasses="'text-rose-700'"- :colourClasses="'dark:hover:bg-neutral-800 hover:bg-slate-300'" @click.stop.prevent="$emit('clickAction')" />+ :colourClasses="'dark:hover:bg-neutral-800 hover:bg-gray-300'" @click.stop.prevent="$emit('clickAction')" /></div></section>- <section class="flex flex-col sm:flex-row sm:justify-between w-full pt-2">- <h3 class="text-lg text-neutral-500 w-full text-wrap truncate sm:text-nowrap">- {{ props.data.relationships.folder_name }} · {{ timeSpan }}</h3>- <h3 class="text-lg truncate sm:text-right text-neutral-500 w-full line-clamp-2">+ <section class="flex flex-col sm:flex-row sm:justify-between w-full">+ <h3 class="text-neutral-500 w-full text-wrap truncate sm:text-nowrap">+ {{ props.data.relationships.folder_name }} · {{ timeSpan }}+ </h3>+ <h3 class="truncate sm:text-right text-neutral-500 w-full line-clamp-2">{{`${rawDate.toLocaleDateString('en-ca', {year: "numeric",diff --git a/resources/js/components/cards/VideoCard.vue b/resources/js/components/cards/VideoCard.vueindex a549e7ed..baad4c04 100644--- a/resources/js/components/cards/VideoCard.vue+++ b/resources/js/components/cards/VideoCard.vue@@ -21,7 +21,7 @@ watch(props, handlePropsUpdate, {immediate: true});<template><div :class="{ 'ring-violet-600/70 ring-[0.125rem]': (props.currentID === props.video?.id) }"- class="flex flex-wrap flex-col sm:flex-row sm:flex-nowrap gap-x-8 gap-y-4 p-3 w-full shadow rounded-md ring-inset dark:bg-neutral-800 dark:hover:bg-indigo-900 bg-gray-100 hover:bg-violet-300 odd:bg-violet-100 hover:odd:bg-violet-300 dark:odd:bg-zinc-700 dark:hover:odd:bg-indigo-900"+ class="flex flex-wrap flex-col sm:flex-row sm:flex-nowrap gap-x-8 gap-y-4 p-3 w-full shadow rounded-md ring-inset dark:bg-primary-dark-800/70 dark:hover:bg-violet-700/70 bg-gray-100 hover:bg-violet-400/30 odd:bg-violet-100 dark:odd:bg-primary-dark-600":data-id="props.video?.id" :data-path="`../${props.video?.attributes.path}`" @click="handlePlay"><section class="flex justify-between gap-4 w-full items-start sm:items-center"><h3 class="w-full line-clamp-2 sm:line-clamp-1">@@ -39,14 +39,5 @@ watch(props, handlePropsUpdate, {immediate: true});{{ toFormattedDate(new Date(props.video?.attributes.date + ' GMT')) }}</h3></section>-- <!-- <td class="flex gap-12 w-full">- <p class="vid-row-title w-full xl:min-w-48 sm:max-w-1/2 sm:w-auto flex justify-between items-center gap-12 sm:gap-0"><span class="sm:hidden">Title: </span><span class="line-clamp-1">{{ metaData?.fields?.title }}</span></p>- <p class="vid-row-duration truncate hidden sm:block">{{ metaData?.fields?.duration }}</p>- </td>- <td class="flex gap-12 w-full sm:justify-end">- <p class="vid-row-title truncate hidden sm:block">{{ metaData?.fields?.views }}</p>- <p class="vid-row-date w-full xl:min-w-36 sm:max-w-1/3 sm:w-auto flex justify-between items-center gap-12 sm:gap-0"><span class="sm:hidden">Date: </span><span class="line-clamp-1">{{ toFormattedDate(new Date(props.video?.attributes.date + ' GMT')) }}</span></p>- </td> --></div></template>\ No newline at end of filediff --git a/resources/js/components/inputs/ButtonCorner.vue b/resources/js/components/inputs/ButtonCorner.vueindex 184ff880..4dfc9660 100644--- a/resources/js/components/inputs/ButtonCorner.vue+++ b/resources/js/components/inputs/ButtonCorner.vue@@ -4,14 +4,14 @@ const props = defineProps(['positionClasses', 'colourClasses', 'textClasses', 't</script><template>- <router-link v-if="props?.to" :aria-label="props?.label ?? 'Link'" :to="props?.to ?? '/'"+ <router-link v-if="props?.to" :aria-label="props?.label ?? 'Link'" :title="props?.label ?? 'Link'" :to="props?.to ?? '/'"class="flex items-center justify-center rounded-full":class="`${props?.positionClasses ?? 'absolute top-0 right-0 w-8 h-8 mt-5 mr-5'} ${props?.colourClasses ?? 'hover:bg-gray-50 hover:dark:bg-gray-700'} ${ props?.textClasses ?? 'text-gray-600 dark:text-gray-400 hover:text-gray-800 hover:dark:text-gray-200'}`"><slot name="icon"><IconDelete/></slot></router-link>- <button v-else :aria-label="props?.label ?? 'Close Modal'"+ <button v-else :aria-label="props?.label ?? 'Close Modal'" :title="props?.label ?? 'Close Modal'"class="flex items-center justify-center rounded-full":class="`${props?.positionClasses ?? 'absolute top-0 right-0 w-8 h-8 mt-5 mr-5'} ${props?.colourClasses ?? 'hover:bg-gray-50 hover:dark:bg-gray-700'} ${ props?.textClasses ?? 'text-gray-600 dark:text-gray-400 hover:text-gray-800 hover:dark:text-gray-200'}`"><slot name="icon">diff --git a/tailwind.config.js b/tailwind.config.jsindex ed9edf1e..7fa5ba21 100644--- a/tailwind.config.js+++ b/tailwind.config.js@@ -38,6 +38,8 @@ export default {950: '#FCF9F8',},'primary-dark': {+ 600: '#2a2a2d', // Card Hover+ 700: '#26262a', // Card 2800: '#27272a', // Card900: '#18181b', // Panel950: '#101016', // bg