Fix some bad photos changes
This commit is contained in:
parent
27075088ee
commit
4d24be2457
3 changed files with 11 additions and 14 deletions
|
|
@ -118,7 +118,7 @@
|
|||
</div>
|
||||
{/if}
|
||||
|
||||
{#if albums && albums.length > 0}
|
||||
<!-- {#if albums && albums.length > 0}
|
||||
<div class="albums-section">
|
||||
<h3 class="albums-title">This photo appears in:</h3>
|
||||
<div class="albums-list">
|
||||
|
|
@ -129,7 +129,7 @@
|
|||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
{/if} -->
|
||||
|
||||
{#if showBackButton && backHref && backLabel}
|
||||
<div class="card-footer">
|
||||
|
|
|
|||
|
|
@ -82,6 +82,13 @@ export const GET: RequestHandler = async (event) => {
|
|||
}
|
||||
})
|
||||
|
||||
// Sort photos by the actual date taken (from EXIF or fallback dates)
|
||||
photos.sort((a, b) => {
|
||||
const dateA = new Date(a.createdAt).getTime()
|
||||
const dateB = new Date(b.createdAt).getTime()
|
||||
return dateB - dateA // Descending order (newest first)
|
||||
})
|
||||
|
||||
// Apply pagination
|
||||
const totalItems = photos.length
|
||||
const paginatedItems = photos.slice(offset, offset + limit)
|
||||
|
|
|
|||
|
|
@ -410,18 +410,8 @@
|
|||
{exifData}
|
||||
createdAt={photo.createdAt}
|
||||
albums={photo.albums}
|
||||
backHref={fromAlbum
|
||||
? `/albums/${fromAlbum}`
|
||||
: photo.album
|
||||
? `/albums/${photo.album.slug}`
|
||||
: '/photos'}
|
||||
backLabel={(() => {
|
||||
if (fromAlbum && photo.albums) {
|
||||
const album = photo.albums.find((a) => a.slug === fromAlbum)
|
||||
return album ? `Back to ${album.title}` : 'Back to Photos'
|
||||
}
|
||||
return photo.album ? `Back to ${photo.album.title}` : 'Back to Photos'
|
||||
})()}
|
||||
backHref="/photos"
|
||||
backLabel="Back to Photos"
|
||||
showBackButton={true}
|
||||
/>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue