A self-hosted media server and file management system
Vue ffmpegfile-serverjellyfinlaravelmediamedia-playermedia-servermediabrowsermediaservermusicmusic-librarymusic-playermusicplayerself-hostedvuejs
feat: add spotlight subtitle field
aminnausin4c1aadd74d9f
diff --git a/resources/js/service/home/useSpotlightItems.ts b/resources/js/service/home/useSpotlightItems.tsindex 4bf8e0de..3fa6c748 100644--- a/resources/js/service/home/useSpotlightItems.ts+++ b/resources/js/service/home/useSpotlightItems.ts@@ -1,21 +1,24 @@import type { FolderResource } from '@/contracts/media';-export type SpotlightItem = { folder: FolderResource; label: string };+export type SpotlightItem = { folder: FolderResource; label: string; subtitle?: string };-export function interleaveSpotlightItems(groups: { items: FolderResource[]; label: string }[], perGroup = 4): SpotlightItem[] {+export function interleaveSpotlightItems(+ groups: { items: FolderResource[]; label: string; buildSubtitle?: (folder: FolderResource) => string | undefined }[],+ perGroup = 4,+): SpotlightItem[] {const seen = new Set<number>();- const queues = groups.map(({ items, label }) => {+ const queues = groups.map(({ items, label, buildSubtitle }) => {const windowed = items.slice(0, perGroup);const deduped = windowed.filter((f) => (seen.has(f.id) ? false : (seen.add(f.id), true)));- return { label, items: deduped };+ return { label, items: deduped, buildSubtitle };});const result: SpotlightItem[] = [];const maxLen = Math.max(...queues.map((q) => q.items.length));for (let i = 0; i < maxLen; i++) {- for (const q of queues) if (q.items[i]) result.push({ folder: q.items[i], label: q.label });+ for (const q of queues) if (q.items[i]) result.push({ folder: q.items[i], label: q.label, subtitle: q.buildSubtitle?.(q.items[i]) });}return result;