Files
immich-folio/lib/siteNav.server.ts
Ralksta ad8b09700b release: v0.19.0
Release v0.19.0. See the `## [0.19.0] — 2026-09-29` section of
[CHANGELOG.md](https://github.com/ralksta/immich-folio/blob/dev/CHANGELOG.md)
for the full list.

Highlights: client proofing links (#683), custom content pages (#738),
asset picker search (#740), concurrent-edit detection (#742), env-locked
settings (#739), an accessibility baseline (#741), three security fixes
with advisories (#737, #755, #759), and a pre-release quality pass
(#780–#797).

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: ralksta <ralksta@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Co-authored-by: Ralf <rohlenbo79@gmail.com>
Co-authored-by: Paul Thies <110185070+ImScheinox@users.noreply.github.com>
Co-authored-by: lancetm714 <108419425+lancetm714@users.noreply.github.com>
Co-authored-by: Lance Martin <lancetaylor95@gmail.com>
2026-09-29 22:50:30 +02:00

39 lines
1.4 KiB
TypeScript

/**
* Server-side loader for `siteNavLinks()` — fetches subpages, albums, pages
* and journal entries. Server only (pulls in `fs` via the services).
*
* Memoised per request with React's `cache()`: the root layout's header nav
* and the home page's hero nav both ask for it in one render, and the journal
* listing is shared with the journal pages (`lib/journal.server.ts`).
*/
import { cache } from 'react';
import { immich } from './immich';
import { getConfig } from './config';
import { listJournalEntriesForRequest } from './journal.server';
import { listPages } from './admin/pages-service';
import { resolveMenu } from './pages';
import { getServerDictionary } from './i18n/server';
import { siteNavLinks, type SiteNavLink } from './siteNav';
export const loadSiteNav = cache(async function loadSiteNav(): Promise<SiteNavLink[]> {
const [subpages, albums, journalEntries, pages] = await Promise.all([
immich.getSubpages(),
immich.getStandaloneAlbums(),
listJournalEntriesForRequest().catch(() => []),
listPages().catch(() => []),
]);
const config = getConfig();
return siteNavLinks(
{
menu: resolveMenu(config.nav, subpages, pages),
subpageAlbumCounts: new Map(subpages.map((sp) => [sp.slug, sp.albumCount])),
albums,
hasJournal: journalEntries.some((e) => !e.frontmatter.draft),
aboutEnabled: config.aboutEnabled,
map: config.map,
},
getServerDictionary(),
);
});