Fix recipe/simulation spacing
This commit is contained in:
parent
cbb74059b3
commit
62f64a9cbb
@ -6,6 +6,7 @@ import {
|
|||||||
doesPhotoNeedBlurCompatibility,
|
doesPhotoNeedBlurCompatibility,
|
||||||
shouldShowCameraDataForPhoto,
|
shouldShowCameraDataForPhoto,
|
||||||
shouldShowExifDataForPhoto,
|
shouldShowExifDataForPhoto,
|
||||||
|
shouldShowFilmSimulationDataForPhoto,
|
||||||
shouldShowLensDataForPhoto,
|
shouldShowLensDataForPhoto,
|
||||||
shouldShowRecipeDataForPhoto,
|
shouldShowRecipeDataForPhoto,
|
||||||
titleForPhoto,
|
titleForPhoto,
|
||||||
@ -134,9 +135,11 @@ export default function PhotoLarge({
|
|||||||
|
|
||||||
const showCameraContent = showCamera && shouldShowCameraDataForPhoto(photo);
|
const showCameraContent = showCamera && shouldShowCameraDataForPhoto(photo);
|
||||||
const showLensContent = showLens && shouldShowLensDataForPhoto(photo);
|
const showLensContent = showLens && shouldShowLensDataForPhoto(photo);
|
||||||
|
const showTagsContent = tags.length > 0;
|
||||||
const showRecipeContent = showRecipe && shouldShowRecipeDataForPhoto(photo);
|
const showRecipeContent = showRecipe && shouldShowRecipeDataForPhoto(photo);
|
||||||
const showRecipeButton = shouldShowRecipeDataForPhoto(photo);
|
const showRecipeButton = shouldShowRecipeDataForPhoto(photo);
|
||||||
const showTagsContent = tags.length > 0;
|
const showSimulationContent = showSimulation &&
|
||||||
|
shouldShowFilmSimulationDataForPhoto(photo);
|
||||||
|
|
||||||
useVisible({ ref, onVisible });
|
useVisible({ ref, onVisible });
|
||||||
|
|
||||||
@ -153,6 +156,7 @@ export default function PhotoLarge({
|
|||||||
showLensContent ||
|
showLensContent ||
|
||||||
showTagsContent ||
|
showTagsContent ||
|
||||||
showRecipeContent ||
|
showRecipeContent ||
|
||||||
|
showSimulationContent ||
|
||||||
showExifContent;
|
showExifContent;
|
||||||
|
|
||||||
const hasNonDateContent =
|
const hasNonDateContent =
|
||||||
@ -358,9 +362,9 @@ export default function PhotoLarge({
|
|||||||
<li>{photo.isoFormatted}</li>
|
<li>{photo.isoFormatted}</li>
|
||||||
<li>{photo.exposureCompensationFormatted ?? '0ev'}</li>
|
<li>{photo.exposureCompensationFormatted ?? '0ev'}</li>
|
||||||
</ul>
|
</ul>
|
||||||
{(showSimulation || showRecipeButton) &&
|
{(showRecipeButton || showSimulationContent) &&
|
||||||
<div className="flex items-center gap-2 *:w-auto">
|
<div className="flex items-center gap-2 *:w-auto">
|
||||||
{showSimulation && photo.filmSimulation &&
|
{showSimulationContent && photo.filmSimulation &&
|
||||||
<PhotoFilmSimulation
|
<PhotoFilmSimulation
|
||||||
simulation={photo.filmSimulation}
|
simulation={photo.filmSimulation}
|
||||||
prefetch={prefetchRelatedLinks}
|
prefetch={prefetchRelatedLinks}
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
import { formatFocalLength } from '@/focal';
|
import { formatFocalLength } from '@/focal';
|
||||||
import { getNextImageUrlForRequest } from '@/platforms/next-image';
|
import { getNextImageUrlForRequest } from '@/platforms/next-image';
|
||||||
import { FilmSimulation } from '@/simulation';
|
import { FilmSimulation, photoHasFilmSimulationData } from '@/simulation';
|
||||||
import {
|
import {
|
||||||
HIGH_DENSITY_GRID,
|
HIGH_DENSITY_GRID,
|
||||||
IS_PREVIEW,
|
IS_PREVIEW,
|
||||||
SHOW_EXIF_DATA,
|
SHOW_EXIF_DATA,
|
||||||
|
SHOW_FILM_SIMULATIONS,
|
||||||
SHOW_LENSES,
|
SHOW_LENSES,
|
||||||
SHOW_RECIPES,
|
SHOW_RECIPES,
|
||||||
} from '@/app/config';
|
} from '@/app/config';
|
||||||
@ -258,7 +259,7 @@ export const descriptionForPhotoSet = (
|
|||||||
photoLabelForCount(explicitCount ?? photos.length, false),
|
photoLabelForCount(explicitCount ?? photos.length, false),
|
||||||
].join(' ');
|
].join(' ');
|
||||||
|
|
||||||
const sortPhotosByDate = (
|
const sortPhotosByDateNonDestructively = (
|
||||||
photos: Photo[],
|
photos: Photo[],
|
||||||
order: 'ASC' | 'DESC' = 'DESC',
|
order: 'ASC' | 'DESC' = 'DESC',
|
||||||
) =>
|
) =>
|
||||||
@ -276,7 +277,7 @@ export const dateRangeForPhotos = (
|
|||||||
let descriptionWithSpaces = '';
|
let descriptionWithSpaces = '';
|
||||||
|
|
||||||
if (explicitDateRange || photos.length > 0) {
|
if (explicitDateRange || photos.length > 0) {
|
||||||
const photosSorted = sortPhotosByDate(photos);
|
const photosSorted = sortPhotosByDateNonDestructively(photos);
|
||||||
start = formatDateFromPostgresString(
|
start = formatDateFromPostgresString(
|
||||||
explicitDateRange?.start ?? photosSorted[photos.length - 1].takenAtNaive,
|
explicitDateRange?.start ?? photosSorted[photos.length - 1].takenAtNaive,
|
||||||
'short',
|
'short',
|
||||||
@ -328,6 +329,11 @@ export const shouldShowRecipeDataForPhoto = (photo: Photo) =>
|
|||||||
SHOW_RECIPES &&
|
SHOW_RECIPES &&
|
||||||
photoHasRecipeData(photo);
|
photoHasRecipeData(photo);
|
||||||
|
|
||||||
|
export const shouldShowFilmSimulationDataForPhoto = (photo: Photo) =>
|
||||||
|
SHOW_EXIF_DATA &&
|
||||||
|
SHOW_FILM_SIMULATIONS &&
|
||||||
|
photoHasFilmSimulationData(photo);
|
||||||
|
|
||||||
export const shouldShowExifDataForPhoto = (photo: Photo) =>
|
export const shouldShowExifDataForPhoto = (photo: Photo) =>
|
||||||
SHOW_EXIF_DATA && photoHasExifData(photo);
|
SHOW_EXIF_DATA && photoHasExifData(photo);
|
||||||
|
|
||||||
|
|||||||
@ -79,3 +79,6 @@ export const generateMetaForFilmSimulation = (
|
|||||||
),
|
),
|
||||||
images: absolutePathForFilmSimulationImage(simulation),
|
images: absolutePathForFilmSimulationImage(simulation),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const photoHasFilmSimulationData = (photo: Photo) =>
|
||||||
|
Boolean(photo.filmSimulation);
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { useEffect, useState } from 'react';
|
|||||||
|
|
||||||
export default function useScrollDirection() {
|
export default function useScrollDirection() {
|
||||||
const [lastScrollY, setLastScrollY] = useState(0);
|
const [lastScrollY, setLastScrollY] = useState(0);
|
||||||
const [scrollDirection, setScrollDirection] = useState<'up' | 'down'>('up');
|
const [scrollDirection, setScrollDirection] = useState<'up' | 'down'>('down');
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleScroll = () => {
|
const handleScroll = () => {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user