diff --git a/src/admin/AdminInfoPage.tsx b/src/admin/AdminInfoPage.tsx new file mode 100644 index 00000000..0af159ee --- /dev/null +++ b/src/admin/AdminInfoPage.tsx @@ -0,0 +1,30 @@ +import Container from '@/components/Container'; +import SiteGrid from '@/components/SiteGrid'; +import { ReactNode } from 'react'; + +export default function AdminInfoPage({ + title, + accessory, + children, +}: { + title: string + accessory?: ReactNode + children: ReactNode +}) { + return ( + +
+
+ {title} +
+ {accessory} +
+ + {children} + + } + /> + ); +} diff --git a/src/admin/AdminNavClient.tsx b/src/admin/AdminNavClient.tsx index 2a20a336..80c77cb7 100644 --- a/src/admin/AdminNavClient.tsx +++ b/src/admin/AdminNavClient.tsx @@ -7,10 +7,10 @@ import SiteGrid from '@/components/SiteGrid'; import Spinner from '@/components/Spinner'; import { PATH_ADMIN_CONFIGURATION, - PATH_ADMIN_INFO, + PATH_ADMIN_INSIGHTS, checkPathPrefix, isPathAdminConfiguration, - isPathAdminInfo, + isPathAdminInsights, isPathTopLevelAdmin, } from '@/site/paths'; import { useAppState } from '@/state/AppState'; @@ -91,8 +91,8 @@ export default function AdminNavClient({ } diff --git a/src/app/admin/configuration/page.tsx b/src/app/admin/configuration/page.tsx index ecb28453..a2a99905 100644 --- a/src/app/admin/configuration/page.tsx +++ b/src/app/admin/configuration/page.tsx @@ -1,27 +1,14 @@ import ClearCacheButton from '@/admin/ClearCacheButton'; -import GitHubForkStatusBadge from '@/admin/github/GitHubForkStatusBadge'; -import Container from '@/components/Container'; -import SiteGrid from '@/components/SiteGrid'; -import { IS_DEVELOPMENT, IS_VERCEL_GIT_PROVIDER_GITHUB } from '@/site/config'; import SiteChecklist from '@/site/SiteChecklist'; +import AdminInfoPage from '@/admin/AdminInfoPage'; -export default async function AdminConfigurationPage() { +export default function AdminConfigurationPage() { return ( - -
-
- App Configuration -
- {(IS_VERCEL_GIT_PROVIDER_GITHUB || IS_DEVELOPMENT) && - } - -
- - - - } - /> + } + > + + ); } diff --git a/src/app/admin/info/page.tsx b/src/app/admin/info/page.tsx deleted file mode 100644 index cea4e815..00000000 --- a/src/app/admin/info/page.tsx +++ /dev/null @@ -1,3 +0,0 @@ -export default function AdminInfoPage() { - return
Admin Info
; -} diff --git a/src/app/admin/insights/page.tsx b/src/app/admin/insights/page.tsx new file mode 100644 index 00000000..cd0cc31a --- /dev/null +++ b/src/app/admin/insights/page.tsx @@ -0,0 +1,28 @@ +import AdminInfoPage from '@/admin/AdminInfoPage'; +import GitHubForkStatusBadge from '@/admin/github/GitHubForkStatusBadge'; +import { dateRangeForPhotos } from '@/photo'; +import { getPhotosMetaCached } from '@/photo/cache'; +import { IS_DEVELOPMENT, IS_VERCEL_GIT_PROVIDER_GITHUB } from '@/site/config'; + +export default async function AdminInsightsPage() { + const { count, dateRange } = await getPhotosMetaCached(); + + const { start, end } = dateRangeForPhotos(undefined, dateRange); + + return } + > +
+
+ {count} photos +
+ + {start === end + ? start + : <>{end} – {start}} + +
+
; +} diff --git a/src/components/cmdk/CommandKClient.tsx b/src/components/cmdk/CommandKClient.tsx index 63da9be9..75b3abe0 100644 --- a/src/components/cmdk/CommandKClient.tsx +++ b/src/components/cmdk/CommandKClient.tsx @@ -12,6 +12,7 @@ import { import { PATH_ADMIN_BASELINE, PATH_ADMIN_CONFIGURATION, + PATH_ADMIN_INSIGHTS, PATH_ADMIN_PHOTOS, PATH_ADMIN_TAGS, PATH_ADMIN_UPLOADS, @@ -320,6 +321,10 @@ export default function CommandKClient({ label: 'App Config', annotation: , path: PATH_ADMIN_CONFIGURATION, + }, { + label: 'App Insights', + annotation: , + path: PATH_ADMIN_INSIGHTS, }, { label: selectedPhotoIds === undefined ? 'Select Multiple Photos' diff --git a/src/site/paths.ts b/src/site/paths.ts index 1b1e1748..50834d5e 100644 --- a/src/site/paths.ts +++ b/src/site/paths.ts @@ -39,7 +39,7 @@ export const PATH_ADMIN_OUTDATED = `${PATH_ADMIN}/outdated`; export const PATH_ADMIN_UPLOADS = `${PATH_ADMIN}/uploads`; export const PATH_ADMIN_TAGS = `${PATH_ADMIN}/tags`; export const PATH_ADMIN_CONFIGURATION = `${PATH_ADMIN}/configuration`; -export const PATH_ADMIN_INFO = `${PATH_ADMIN}/info`; +export const PATH_ADMIN_INSIGHTS = `${PATH_ADMIN}/insights`; export const PATH_ADMIN_BASELINE = `${PATH_ADMIN}/baseline`; // Debug paths @@ -214,8 +214,8 @@ export const isPathTopLevelAdmin = (pathname?: string) => export const isPathAdminConfiguration = (pathname?: string) => checkPathPrefix(pathname, PATH_ADMIN_CONFIGURATION); -export const isPathAdminInfo = (pathname?: string) => - checkPathPrefix(pathname, PATH_ADMIN_INFO); +export const isPathAdminInsights = (pathname?: string) => + checkPathPrefix(pathname, PATH_ADMIN_INSIGHTS); export const isPathProtected = (pathname?: string) => checkPathPrefix(pathname, PATH_ADMIN) ||