// Pure helpers for the public landing page, kept out of the Svelte component so // the per-language Telegram-channel link selection is unit-testable. import type { Locale } from './i18n/index.svelte'; /** * telegramChannelLink returns the t.me link for the locale's game channel, or null when it is * not configured. The channel usernames are build-time vars (VITE_TELEGRAM_GAME_CHANNEL_NAME_EN * / VITE_TELEGRAM_GAME_CHANNEL_NAME_RU) because the test and prod contours run different * channels; they are the same channels the connector posts to via TELEGRAM_GAME_CHANNEL_ID_* * (the id to post, the name to link). A leading "@" is tolerated. */ export function telegramChannelLink(locale: Locale): string | null { const raw = locale === 'ru' ? import.meta.env.VITE_TELEGRAM_GAME_CHANNEL_NAME_RU : import.meta.env.VITE_TELEGRAM_GAME_CHANNEL_NAME_EN; const name = (raw as string | undefined)?.trim().replace(/^@/, ''); return name ? `https://t.me/${name}` : null; }