Files
immich-folio/components/SubpageNav.tsx
Ralksta a3a6319c29 release: v0.16.0
See CHANGELOG.md for the full v0.16.0 entry.

---------

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>
2026-09-22 14:12:13 +02:00

52 lines
1.5 KiB
TypeScript

/**
* SubpageNav — server component that renders navigation links
* for all subpages and standalone albums in the header.
*/
import { NavLink } from './NavLink';
import { immich } from '@/lib/immich';
import { getConfig } from '@/lib/config';
import { listJournalEntries } from '@/lib/admin/journal-service';
import { getServerDictionary } from '@/lib/i18n/server';
export async function SubpageNav() {
const [subpages, standaloneAlbums, journalEntries] = await Promise.all([
immich.getSubpages(),
immich.getStandaloneAlbums(),
listJournalEntries().catch(() => []),
]);
// EXPERIMENTAL: external nav links from settings.yaml, appended after the
// internal entries. Sanitised to http(s) in getConfig().
const navLinks = getConfig().navLinks;
const t = getServerDictionary();
const hasPublicJournal = journalEntries.some((e) => !e.frontmatter.draft);
return (
<>
{subpages.map((sp) => (
<NavLink key={sp.slug} href={`/${sp.slug}`}>
{sp.name}
</NavLink>
))}
{hasPublicJournal && <NavLink href="/journal">{t.nav.journal}</NavLink>}
{standaloneAlbums.map((album) => (
<NavLink key={album.id} href={`/${album.slug}`}>
{album.albumName}
</NavLink>
))}
{navLinks.map((link) => (
<a
key={link.url}
href={link.url}
className="header__nav-link header__nav-link--external"
target="_blank"
rel="noopener noreferrer"
>
{link.label}
</a>
))}
</>
);
}