Revert photo date range in grid sidebar
This commit is contained in:
parent
775e7adde1
commit
aab36e2679
@ -1,7 +1,6 @@
|
||||
import {
|
||||
getPhotosCached,
|
||||
getPhotosCountCached,
|
||||
getPhotosDateRangeCached,
|
||||
getUniqueCamerasCached,
|
||||
getUniqueFilmSimulationsCached,
|
||||
getUniqueTagsCached,
|
||||
@ -33,14 +32,12 @@ export default async function GridPage({ searchParams }: PaginationParams) {
|
||||
const [
|
||||
photos,
|
||||
photosCount,
|
||||
photosDateRange,
|
||||
tags,
|
||||
cameras,
|
||||
simulations,
|
||||
] = await Promise.all([
|
||||
getPhotosCached({ limit }),
|
||||
getPhotosCountCached(),
|
||||
getPhotosDateRangeCached(),
|
||||
getUniqueTagsCached(),
|
||||
getUniqueCamerasCached(),
|
||||
SHOW_FILM_SIMULATIONS ? getUniqueFilmSimulationsCached() : [],
|
||||
@ -60,7 +57,6 @@ export default async function GridPage({ searchParams }: PaginationParams) {
|
||||
cameras,
|
||||
simulations,
|
||||
photosCount,
|
||||
photosDateRange,
|
||||
}} />
|
||||
</div>}
|
||||
sideHiddenOnMobile
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
import {
|
||||
getPhotosCached,
|
||||
getPhotosCountCached,
|
||||
getPhotosDateRangeCached,
|
||||
getUniqueCamerasCached,
|
||||
getUniqueFilmSimulationsCached,
|
||||
getUniqueTagsCached,
|
||||
@ -24,13 +23,11 @@ export async function generateMetadata(): Promise<Metadata> {
|
||||
export default async function SetsPage() {
|
||||
const [
|
||||
photosCount,
|
||||
photosDateRange,
|
||||
tags,
|
||||
cameras,
|
||||
simulations,
|
||||
] = await Promise.all([
|
||||
getPhotosCountCached(),
|
||||
getPhotosDateRangeCached(),
|
||||
getUniqueTagsCached(),
|
||||
getUniqueCamerasCached(),
|
||||
SHOW_FILM_SIMULATIONS ? getUniqueFilmSimulationsCached() : [],
|
||||
@ -49,7 +46,6 @@ export default async function SetsPage() {
|
||||
cameras,
|
||||
simulations,
|
||||
photosCount,
|
||||
photosDateRange,
|
||||
}} />
|
||||
</div>
|
||||
</InfoBlock>}
|
||||
|
||||
@ -76,12 +76,16 @@ export default function PhotoGridSidebar({
|
||||
/>
|
||||
</div>)}
|
||||
/>}
|
||||
{photosCount > 0 && <HeaderList
|
||||
title={photoQuantityText(photosCount, false)}
|
||||
items={start === end
|
||||
? [start]
|
||||
: [`${end} –`, start]}
|
||||
/>}
|
||||
{photosCount > 0 && start
|
||||
? <HeaderList
|
||||
title={photoQuantityText(photosCount, false)}
|
||||
items={start === end
|
||||
? [start]
|
||||
: [`${end} –`, start]}
|
||||
/>
|
||||
: <HeaderList
|
||||
items={[photoQuantityText(photosCount, false)]}
|
||||
/>}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@ -197,19 +197,25 @@ export const dateRangeForPhotos = (
|
||||
photos: Photo[] = [],
|
||||
explicitDateRange?: PhotoDateRange,
|
||||
) => {
|
||||
const photosSorted = sortPhotosByDate(photos);
|
||||
let start = '';
|
||||
let end = '';
|
||||
let description = '';
|
||||
|
||||
if (explicitDateRange || photos.length >= 0) {
|
||||
const photosSorted = sortPhotosByDate(photos);
|
||||
start = formatDateFromPostgresString(
|
||||
explicitDateRange?.start ?? photosSorted[photos.length - 1].takenAtNaive,
|
||||
true,
|
||||
);
|
||||
end = formatDateFromPostgresString(
|
||||
explicitDateRange?.end ?? photosSorted[0].takenAtNaive,
|
||||
true
|
||||
);
|
||||
description = start === end
|
||||
? start
|
||||
: `${start}–${end}`;
|
||||
}
|
||||
|
||||
const start = formatDateFromPostgresString(
|
||||
explicitDateRange?.start ?? photosSorted[photos.length - 1].takenAtNaive,
|
||||
true,
|
||||
);
|
||||
const end = formatDateFromPostgresString(
|
||||
explicitDateRange?.end ?? photosSorted[0].takenAtNaive,
|
||||
true
|
||||
);
|
||||
const description = start === end
|
||||
? start
|
||||
: `${start}–${end}`;
|
||||
return { start, end, description };
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user