diff --git a/frontend/src/lib/components/AlbumPanel.svelte b/frontend/src/lib/components/AlbumPanel.svelte index 976c46b..e5ae80e 100644 --- a/frontend/src/lib/components/AlbumPanel.svelte +++ b/frontend/src/lib/components/AlbumPanel.svelte @@ -4,6 +4,7 @@ import Icon from './Icon.svelte'; import CoverPicker from './CoverPicker.svelte'; import Comments from './Comments.svelte'; + import PanelSection from './PanelSection.svelte'; import { albums } from '$lib/stores/albums.svelte'; import { auth } from '$lib/stores/auth.svelte'; import type { Album, Photo } from '$lib/types'; @@ -86,6 +87,18 @@ node.select(); } + function formatSize(bytes: number): string { + if (!bytes) return '—'; + const units = ['Б', 'КБ', 'МБ', 'ГБ']; + let v = bytes; + let i = 0; + while (v >= 1024 && i < units.length - 1) { + v /= 1024; + i++; + } + return `${i > 0 && v < 10 ? v.toFixed(1) : Math.round(v)} ${units[i]}`; + } + async function resetCover() { if (!album) return; try { @@ -102,76 +115,88 @@ {#if photoId} {#if photo} -
- {#if editingName} -
- -
- - -
-
- {#if nameError}

{nameError}

{/if} - {:else if canRename} - - {:else} -

{photo.original_filename}

- {/if} -
-
Автор{photo.uploader.name}
- {#if photo.taken_at} -
- Снято - {new Date(photo.taken_at).toLocaleString()} -
+
+
+ {#if editingName} +
+ +
+ + +
+
+ {#if nameError}

{nameError}

{/if} + {:else if canRename} + + {:else} +

{photo.original_filename}

{/if} -
- Размер - {photo.width}×{photo.height} -
-
- - Комментарии - + + +
+
Автор{photo.uploader.name}
+
Файл{formatSize(photo.size)}
+
Тип{photo.mime_type}
+
+ Разрешение + {photo.width}×{photo.height} +
+ {#if photo.taken_at} +
+ Снято + {new Date(photo.taken_at).toLocaleString()} +
+ {/if} + {#if photo.latitude != null && photo.longitude != null} +
+ Координаты + {photo.latitude.toFixed(5)}, {photo.longitude.toFixed(5)} +
+ {/if} +
+ Загружено + {new Date(photo.created_at).toLocaleString()} +
+
+
+ + -
+
{/if} {:else if album} -
-
- - Обложка - +
+
{#if album.cover_thumb_url} @@ -202,33 +227,35 @@ {/if}
{/if} -
+ -
+

{album.title}

{#if album.description}

{album.description}

{/if}

{album.photos_count ?? 0} фото · {album.members_count ?? 0} участников

{#if error}

{error}

{/if} -
+ - +
{#if picking} diff --git a/frontend/src/lib/components/PanelSection.svelte b/frontend/src/lib/components/PanelSection.svelte new file mode 100644 index 0000000..9c20767 --- /dev/null +++ b/frontend/src/lib/components/PanelSection.svelte @@ -0,0 +1,46 @@ + + +
+ + {#if isOpen} +
{@render children()}
+ {/if} +