Skip to content

A self-hosted media server and file management system

fix: can't sort folders by date columns

aminnausinea693f5b6f50
diff --git a/app/Http/Resources/FolderResource.php b/app/Http/Resources/FolderResource.php
index 5aded84a..4727cb66 100755
--- a/app/Http/Resources/FolderResource.php
+++ b/app/Http/Resources/FolderResource.php
@@ -25,7 +25,9 @@ class FolderResource extends JsonResource {
return VideoResource::collection($this->videos);
}),
'series' => new SeriesResource($this->series),
- 'created_at' => $this->created_at,
+ 'scanned_at' => $this->created_at,
+ 'created_at' => $this->series?->created_at ?? $this->created_at,
+ 'updated_at' => $this->series?->updated_at ?? $this->updated_at,
];
}
}
diff --git a/resources/js/components/cards/FolderCard.vue b/resources/js/components/cards/FolderCard.vue
index 30d37ba2..c8f85bae 100755
--- a/resources/js/components/cards/FolderCard.vue
+++ b/resources/js/components/cards/FolderCard.vue
@@ -51,14 +51,14 @@ const mediaType = computed(() => {
<img
:src="handleStorageURL(data.series?.thumbnail_url) ?? '/storage/thumbnails/default.webp'"
alt="Folder Thumbnail"
- class="hidden lg:block h-32 aspect-2/3 object-cover shadow-md"
+ class="aspect-2-3 hidden h-32 object-cover shadow-md lg:block"
loading="lazy"
/>
</template>
<template #trigger>
<RouterLink
:to="`/${data.path}`"
- class="text-left relative flex flex-col sm:flex-row flex-wrap rounded-lg sm:p-3 dark:bg-primary-dark-800/70 bg-primary-800 dark:hover:bg-primary-dark-600 hover:bg-gray-200 text-neutral-600 dark:text-neutral-400 shadow-sm w-full group cursor-pointer divide-gray-300 dark:divide-gray-400"
+ class="dark:bg-primary-dark-800/70 bg-primary-800 dark:hover:bg-primary-dark-600 group relative flex w-full cursor-pointer flex-col flex-wrap divide-gray-300 rounded-lg text-left text-neutral-600 shadow-sm hover:bg-gray-200 sm:flex-row sm:p-3 dark:divide-gray-400 dark:text-neutral-400"
@contextmenu="
(e: any) => {
setContextMenu(e, { items: contextMenuItems });
@@ -68,12 +68,15 @@ const mediaType = computed(() => {
<img
:src="handleStorageURL(data.series?.thumbnail_url) ?? '/storage/thumbnails/default.webp'"
alt="Folder Thumbnail"
- class="hidden xs:block lg:hidden max-h-16 sm:w-12 aspect-square object-cover shadow-md rounded-t-lg sm:rounded-xs sm:me-4"
+ class="xs:block hidden aspect-square max-h-16 rounded-t-lg object-cover shadow-md sm:me-4 sm:w-12 sm:rounded-xs lg:hidden"
loading="lazy"
/>
- <span class="w-full flex-1 text-left relative flex flex-col gap-4 lg:gap-2 sm:flex-row flex-wrap p-3 sm:p-0">
- <section class="flex justify-between gap-4 w-full items-center">
- <h3 class="w-full truncate text-gray-900 dark:text-white" :title="`${data.id}: ${props.data.series?.title ?? props.data.name}`">
+ <span class="relative flex w-full flex-1 flex-col flex-wrap gap-4 p-3 text-left sm:flex-row sm:p-0 lg:gap-2">
+ <section class="flex w-full items-center justify-between gap-4">
+ <h3
+ class="w-full truncate text-gray-900 dark:text-white"
+ :title="`${data.id}: ${props.data.series?.title ?? props.data.name}\nDate: ${props.data.created_at}`"
+ >
{{ props.data.series?.title ?? props.data.name }}
</h3>
<div class="flex justify-end gap-1">
@@ -101,11 +104,11 @@ const mediaType = computed(() => {
</ButtonCorner>
</div>
</section>
- <section class="flex flex-col sm:flex-row sm:justify-between w-full flex-wrap gap-2 text-sm">
- <h4 class="w-full text-wrap truncate sm:text-nowrap flex-1" :title="`${props.data.file_count} ${mediaType}${props.data.file_count !== 1 ? 's' : ''}`">
+ <section class="flex w-full flex-col flex-wrap gap-2 text-sm sm:flex-row sm:justify-between">
+ <h4 class="w-full flex-1 truncate text-wrap sm:text-nowrap" :title="`${props.data.file_count} ${mediaType}${props.data.file_count !== 1 ? 's' : ''}`">
{{ props.data.file_count }} {{ mediaType }}{{ props.data.file_count !== 1 ? 's' : '' }}
</h4>
- <h4 class="truncate text-nowrap sm:text-right w-fit lg:hidden xl:block">
+ <h4 class="w-fit truncate text-nowrap sm:text-right lg:hidden xl:block">
<!-- some other folder statistic or data like number of seasons or if its popular or something -->
{{ props.data.total_size ? formatFileSize(props.data.total_size) : '' }}
</h4>
@@ -113,7 +116,7 @@ const mediaType = computed(() => {
</span>
<section
v-if="props.data.series?.folder_tags?.length"
- class="flex gap-1 p-3 sm:p-0 pt-0 transition-all sm:max-h-0 md:group-hover:max-h-[26px] md:group-hover:pt-1 w-full overflow-clip flex-wrap group-hover:[overflow-clip-margin:4px]"
+ class="flex w-full flex-wrap gap-1 overflow-clip p-3 pt-0 transition-all group-hover:[overflow-clip-margin:4px] sm:max-h-0 sm:p-0 md:group-hover:max-h-[26px] md:group-hover:pt-1"
title="Tags"
>
<ChipTag
diff --git a/resources/js/components/panels/VideoSidebar.vue b/resources/js/components/panels/VideoSidebar.vue
index e151bd9a..7a4ae918 100755
--- a/resources/js/components/panels/VideoSidebar.vue
+++ b/resources/js/components/panels/VideoSidebar.vue
@@ -12,6 +12,7 @@ import { sortObject } from '@/service/sort/baseSort';
import ButtonClipboard from '@/components/pinesUI/ButtonClipboard.vue';
import ButtonText from '@/components/inputs/ButtonText.vue';
+import ButtonIcon from '@/components/inputs/ButtonIcon.vue';
import FolderCard from '@/components/cards/FolderCard.vue';
import RecordCard from '@/components/cards/RecordCard.vue';
import EditFolder from '@/components/forms/EditFolder.vue';
@@ -21,28 +22,27 @@ import useModal from '@/composables/useModal';
import ProiconsFilterCancel from '~icons/proicons/filter-cancel';
import ProiconsFilter from '~icons/proicons/filter';
-import ButtonIcon from '../inputs/ButtonIcon.vue';
const folderSortingOptions: GenericSortOption<FolderResource>[] = [
{
title: 'Title',
value: 'name',
- disabled: false,
},
{
title: 'Date Created',
value: 'created_at',
- disabled: false,
+ },
+ {
+ title: 'Date Updated',
+ value: 'updated_at',
},
{
title: 'Size',
value: 'total_size',
- disabled: false,
},
{
title: 'File Count',
value: 'file_count',
- disabled: false,
},
];
@@ -65,7 +65,7 @@ const { updateFolderData } = useContentStore();
const { selectedSideBar } = storeToRefs(useAppStore());
const sortedFolders = computed<FolderResource[]>(() => {
- return [...stateDirectory.value.folders].sort(sortObject<FolderResource>(folderSortKey.value, folderSortDir.value));
+ return [...stateDirectory.value.folders].sort(sortObject<FolderResource>(folderSortKey.value, folderSortDir.value, ['created_at', 'updated_at']));
});
const handleShare = (link: string) => {
diff --git a/resources/js/types/resources.ts b/resources/js/types/resources.ts
index 08e6fdc9..9e478adf 100644
--- a/resources/js/types/resources.ts
+++ b/resources/js/types/resources.ts
@@ -40,7 +40,9 @@ export interface FolderResource {
category_id: number;
videos?: VideoResource[];
series?: SeriesResource;
+ scanned_at?: string;
created_at?: string;
+ updated_at?: string;
last_scan: number;
}
export interface MetadataResource {