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>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{#if albums && albums.length > 0}
|
<!-- {#if albums && albums.length > 0}
|
||||||
<div class="albums-section">
|
<div class="albums-section">
|
||||||
<h3 class="albums-title">This photo appears in:</h3>
|
<h3 class="albums-title">This photo appears in:</h3>
|
||||||
<div class="albums-list">
|
<div class="albums-list">
|
||||||
|
|
@ -129,7 +129,7 @@
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if} -->
|
||||||
|
|
||||||
{#if showBackButton && backHref && backLabel}
|
{#if showBackButton && backHref && backLabel}
|
||||||
<div class="card-footer">
|
<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
|
// Apply pagination
|
||||||
const totalItems = photos.length
|
const totalItems = photos.length
|
||||||
const paginatedItems = photos.slice(offset, offset + limit)
|
const paginatedItems = photos.slice(offset, offset + limit)
|
||||||
|
|
|
||||||
|
|
@ -410,18 +410,8 @@
|
||||||
{exifData}
|
{exifData}
|
||||||
createdAt={photo.createdAt}
|
createdAt={photo.createdAt}
|
||||||
albums={photo.albums}
|
albums={photo.albums}
|
||||||
backHref={fromAlbum
|
backHref="/photos"
|
||||||
? `/albums/${fromAlbum}`
|
backLabel="Back to Photos"
|
||||||
: 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'
|
|
||||||
})()}
|
|
||||||
showBackButton={true}
|
showBackButton={true}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue