--- import { resolvePublicApiBaseUrl } from '../lib/api/client'; import { terminalConfig } from '../lib/config/terminal'; import { getI18n, SUPPORTED_LOCALES } from '../lib/i18n'; import ThemeToggle from './interactive/ThemeToggle.svelte'; import type { SiteSettings } from '../lib/types'; interface Props { siteName?: string; siteSettings?: SiteSettings; } const { siteName = Astro.props.siteSettings?.siteShortName || terminalConfig.branding?.shortName || 'Termi' } = Astro.props; const { locale, t, buildLocaleUrl } = getI18n(Astro); const aiEnabled = Boolean(Astro.props.siteSettings?.ai?.enabled); const musicEnabled = Astro.props.siteSettings?.musicEnabled ?? true; const configuredMusicPlaylist = Astro.props.siteSettings?.musicPlaylist ?? []; const musicPlaylist = (musicEnabled ? configuredMusicPlaylist : []).filter( (item) => item?.title?.trim() && item?.url?.trim() ); const musicPlaylistPayload = JSON.stringify(musicPlaylist); const publicApiBaseUrl = resolvePublicApiBaseUrl(Astro.url); const hasMusicPlaylist = musicPlaylist.length > 0; const currentMusicTrack = hasMusicPlaylist ? musicPlaylist[0] : null; const navItems = [ { icon: 'fa-file-code', text: t('nav.articles'), href: '/articles' }, { icon: 'fa-folder', text: t('nav.categories'), href: '/categories' }, { icon: 'fa-tags', text: t('nav.tags'), href: '/tags' }, { icon: 'fa-stream', text: t('nav.timeline'), href: '/timeline' }, { icon: 'fa-star', text: t('nav.reviews'), href: '/reviews' }, { icon: 'fa-link', text: t('nav.friends'), href: '/friends' }, { icon: 'fa-user-secret', text: t('nav.about'), href: '/about' }, ...(aiEnabled ? [{ icon: 'fa-robot', text: t('nav.ask'), href: '/ask' }] : []), ]; const mobileDockItems = [ { icon: 'fa-house', text: t('common.home'), href: '/' }, { icon: 'fa-file-code', text: t('nav.articles'), href: '/articles' }, ...(aiEnabled ? [{ icon: 'fa-robot', text: t('nav.ask'), href: '/ask' }] : [{ icon: 'fa-folder', text: t('nav.categories'), href: '/categories' }]), { icon: 'fa-user-secret', text: t('nav.about'), href: '/about' }, ]; const localeLinks = SUPPORTED_LOCALES.map((item) => ({ locale: item, href: buildLocaleUrl(item), label: t(`common.languages.${item}`), shortLabel: item === 'zh-CN' ? '中' : 'EN', })); const currentPath = Astro.url.pathname; const currentNavLabel = navItems.find((item) => currentPath === item.href || (item.href !== '/' && currentPath.startsWith(item.href))) ?.text || t('header.navigation'); ---
{t('header.shellLabel')} {siteName}
{mobileDockItems.map((item) => { const isActive = currentPath === item.href || (item.href !== '/' && currentPath.startsWith(item.href)); return ( {item.text} ); })}