Vercel/src/admin/insights/AdminAppInsights.tsx
2026-01-30 21:13:34 -06:00

70 lines
1.8 KiB
TypeScript

import {
getPhotosMeta,
getUniqueCameras,
getUniqueFilms,
getUniqueFocalLengths,
getUniqueLenses,
getUniqueRecipes,
getUniqueTags,
getPhotosInNeedOfUpdateCount,
} from '@/photo/query';
import AdminAppInsightsClient from './AdminAppInsightsClient';
import { getAllInsights, getGitHubMetaForCurrentApp } from '.';
import { APP_CONFIGURATION, USED_DEPRECATED_ENV_VARS } from '@/app/config';
export default async function AdminAppInsights() {
const [
{ count: photosCount, dateRange },
{ count: photosCountHidden },
photosCountNeedSync,
{ count: photosCountPortrait },
codeMeta,
cameras,
lenses,
tags,
recipes,
films,
focalLengths,
] = await Promise.all([
getPhotosMeta({ hidden: 'include' }),
getPhotosMeta({ hidden: 'only' }),
getPhotosInNeedOfUpdateCount(),
getPhotosMeta({ maximumAspectRatio: 0.9 }),
getGitHubMetaForCurrentApp(),
getUniqueCameras(),
getUniqueLenses(),
getUniqueTags(),
getUniqueRecipes(),
getUniqueFilms(),
getUniqueFocalLengths(),
]);
return (
<AdminAppInsightsClient
codeMeta={codeMeta}
nextVersion={APP_CONFIGURATION.nextVersion}
reactVersion={APP_CONFIGURATION.reactVersion}
nodeVersion={APP_CONFIGURATION.nodeVersion}
insights={getAllInsights({
codeMeta,
photosCount,
photosCountNeedSync,
photosCountPortrait,
})}
usedDeprecatedEnvVars={USED_DEPRECATED_ENV_VARS}
photoStats={{
photosCount,
photosCountHidden,
photosCountNeedSync,
camerasCount: cameras.length,
lensesCount: lenses.length,
tagsCount: tags.length,
recipesCount: recipes.length,
filmsCount: films.length,
focalLengthsCount: focalLengths.length,
dateRange,
}}
/>
);
}