Sort focal lengths numerically

This commit is contained in:
Sam Becker 2025-03-29 13:48:27 -05:00
parent 348e4db25c
commit 35b61a79af
3 changed files with 6 additions and 1 deletions

View File

@ -14,6 +14,7 @@ import {
} from '@/app/config'; } from '@/app/config';
import { sortTagsByCount } from '@/tag'; import { sortTagsByCount } from '@/tag';
import { sortCategoriesByCount } from '@/category'; import { sortCategoriesByCount } from '@/category';
import { sortFocalLengths } from '@/focal';
export const getDataForCategories = () => [ export const getDataForCategories = () => [
getUniqueCameras() getUniqueCameras()
@ -39,7 +40,7 @@ export const getDataForCategories = () => [
: [], : [],
SHOW_FOCAL_LENGTHS SHOW_FOCAL_LENGTHS
? getUniqueFocalLengths() ? getUniqueFocalLengths()
.then(sortCategoriesByCount) .then(sortFocalLengths)
.catch(() => []) .catch(() => [])
: [], : [],
] as const; ] as const;

View File

@ -65,3 +65,6 @@ export const generateMetaForFocalLength = (
), ),
images: absolutePathForFocalLengthImage(focal), images: absolutePathForFocalLengthImage(focal),
}); });
export const sortFocalLengths = (focalLengths: FocalLengths) =>
focalLengths.sort((a, b) => a.focal - b.focal);

View File

@ -223,6 +223,7 @@ export default function PhotoGridSidebar({
countOnHover={count} countOnHover={count}
type="text-only" type="text-only"
prefetch={false} prefetch={false}
badged
/>)} />)}
/> />
: null; : null;