53 lines
1.1 KiB
TypeScript
53 lines
1.1 KiB
TypeScript
import {
|
|
getUniqueCameras,
|
|
getUniqueFilmSimulations,
|
|
getUniqueFocalLengths,
|
|
getUniqueLenses,
|
|
getUniqueRecipes,
|
|
getUniqueTags,
|
|
} from '@/photo/db/query';
|
|
import {
|
|
SHOW_FILM_SIMULATIONS,
|
|
SHOW_FOCAL_LENGTHS,
|
|
SHOW_LENSES,
|
|
SHOW_RECIPES,
|
|
SHOW_CAMERAS,
|
|
SHOW_TAGS,
|
|
} from '@/app/config';
|
|
import { sortTagsByCount } from '@/tag';
|
|
import { sortCategoriesByCount } from '@/category';
|
|
import { sortFocalLengths } from '@/focal';
|
|
|
|
export const getDataForCategories = () => [
|
|
SHOW_CAMERAS
|
|
? getUniqueCameras()
|
|
.then(sortCategoriesByCount)
|
|
.catch(() => [])
|
|
: [],
|
|
SHOW_LENSES
|
|
? getUniqueLenses()
|
|
.then(sortCategoriesByCount)
|
|
.catch(() => [])
|
|
: [],
|
|
SHOW_TAGS
|
|
? getUniqueTags()
|
|
.then(sortTagsByCount)
|
|
.catch(() => [])
|
|
: [],
|
|
SHOW_RECIPES
|
|
? getUniqueRecipes()
|
|
.then(sortCategoriesByCount)
|
|
.catch(() => [])
|
|
: [],
|
|
SHOW_FILM_SIMULATIONS
|
|
? getUniqueFilmSimulations()
|
|
.then(sortCategoriesByCount)
|
|
.catch(() => [])
|
|
: [],
|
|
SHOW_FOCAL_LENGTHS
|
|
? getUniqueFocalLengths()
|
|
.then(sortFocalLengths)
|
|
.catch(() => [])
|
|
: [],
|
|
] as const;
|