--- import type { StarlightRouteData } from '@astrojs/starlight/route-data' import { Icon } from '@astrojs/starlight/components' import LanguageSelect from 'virtual:starlight/components/LanguageSelect' import Search from 'virtual:starlight/components/Search' import SiteTitle from 'virtual:starlight/components/SiteTitle' import SocialIcons from 'virtual:starlight/components/SocialIcons' import ThemeSelect from 'virtual:starlight/components/ThemeSelect' import config from 'virtual:starlight/user-config' import MobileMenuToggle from 'starlight-theme-nova/components/MobileMenuToggle.astro' import options from 'virtual:starlight-theme-nova/user-config' const { hasSidebar } = Astro.locals.starlightRoute const nav = options.nav ?? [] const route = Astro.locals.starlightRoute function getI18nText( value: string | Record, route: StarlightRouteData, ): string { if (typeof value === 'string') { return value } const { lang, locale } = route if (value[lang]) { return value[lang] } if (config.defaultLocale.lang === lang || config.defaultLocale.locale === locale) { if (value.root) { return value.root } } if (locale && value[locale]) { return value[locale] } throw new Error(`Unable to find the translation for language "${lang}".`) } function navIcon(href: string) { if (href.includes('github.com/3252a8/remnawave-minishop')) { return 'github' } if (href.includes('gitlab.com/3252a8/remnawave-minishop')) { return 'gitlab' } if (href.includes('t.me/remnawave_minishop')) { return 'telegram' } return undefined } ---
{ !hasSidebar && nav.length > 0 && (
{nav.map((item) => { const href = getI18nText(item.href, route) const label = getI18nText(item.label, route) const icon = navIcon(href) return ( {icon && } {label} ) })}
) } { hasSidebar && (
) }