diff --git a/src/lib/components/admin/MediaDetailsModal.svelte b/src/lib/components/admin/MediaDetailsModal.svelte index fd14cae..bfc792c 100644 --- a/src/lib/components/admin/MediaDetailsModal.svelte +++ b/src/lib/components/admin/MediaDetailsModal.svelte @@ -9,8 +9,11 @@ import CloseButton from '$components/icons/CloseButton.svelte' import FileIcon from '$components/icons/FileIcon.svelte' import CopyIcon from '$components/icons/CopyIcon.svelte' + import MediaMetadataPanel from './MediaMetadataPanel.svelte' + import MediaUsageList from './MediaUsageList.svelte' import { authenticatedFetch } from '$lib/admin-auth' import { toast } from '$lib/stores/toast' + import { formatFileSize, getFileType } from '$lib/utils/mediaHelpers' import type { Media } from '@prisma/client' interface Props { @@ -45,15 +48,11 @@ let loadingAlbums = $state(false) let showAlbumSelector = $state(false) - // EXIF toggle state - let showExif = $state(false) - // Initialize form when media changes $effect(() => { if (media) { description = media.description || '' isPhotography = media.isPhotography || false - showExif = false loadUsage() // Only load albums for images if (media.mimeType?.startsWith('image/')) { @@ -204,21 +203,6 @@ } } - function formatFileSize(bytes: number): string { - if (bytes === 0) return '0 Bytes' - const k = 1024 - const sizes = ['Bytes', 'KB', 'MB', 'GB'] - const i = Math.floor(Math.log(bytes) / Math.log(k)) - return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i] - } - - function getFileType(mimeType: string): string { - if (mimeType.startsWith('image/')) return 'Image' - if (mimeType.startsWith('video/')) return 'Video' - if (mimeType.startsWith('audio/')) return 'Audio' - if (mimeType.includes('pdf')) return 'PDF' - return 'File' - } {#if media} @@ -262,120 +246,8 @@
This media file is not currently used in any content.
- {/if} -