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

View File

@ -65,3 +65,6 @@ export const generateMetaForFocalLength = (
),
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}
type="text-only"
prefetch={false}
badged
/>)}
/>
: null;