SPB Git forge
3commits 1branches 0releases
417.0 KBsize
maindefault branch
10 days agolast push
TypeScript 66.5% Python 30.9% JavaScript 1.4% CSS 0.7%
2.1 KB · 43 lines tsx
Raw Blame History
1import type { Metadata } from 'next';2import { LazyGlobe } from '@/components/globe/lazy-globe';3import { api, safe } from '@/lib/api';4import { fmtInt, num } from '@/lib/format';5import { SITE_URL } from '@/lib/site';67export const revalidate = 300;89/** "16,000+" from the live count of objects with element sets — never a hardcoded figure. */10async function trackedCount(): Promise<string | null> {11  const home = await safe(api.home());12  const n = num(home?.data.stats.with_elements);13  if (!n || n < 1000) return null;14  return `${fmtInt(Math.floor(n / 1000) * 1000)}+`;15}1617export async function generateMetadata(): Promise<Metadata> {18  const count = await trackedCount();19  const title = count ? `Explore orbit — live 3D globe of ${count} tracked satellites` : 'Explore orbit — live 3D globe of tracked satellites';20  const description = count21    ? `Interactive 3D globe of ${count} satellites and objects with current element sets, propagated with SGP4 every 30 seconds. Filter by orbit class and mission type, search any satellite and follow it live.`22    : 'Interactive 3D globe of every satellite with a current element set, propagated with SGP4 every 30 seconds. Filter by orbit class and mission type, search any satellite and follow it live.';23  return {24    title,25    description,26    alternates: { canonical: '/explore' },27    openGraph: { title, description, url: `${SITE_URL}/explore`, type: 'website' },28    twitter: { card: 'summary_large_image', title, description },29  };30}3132export default async function ExplorePage({ searchParams }: { searchParams: Promise<Record<string, string | string[] | undefined>> }) {33  const sp = await searchParams;34  const raw = Array.isArray(sp.focus) ? sp.focus[0] : sp.focus;35  const focus = raw && /^\d{1,9}$/.test(raw) ? Number(raw) : null;36  return (37    <div className="relative w-full h-[calc(100dvh-var(--header-h)-var(--tabbar-h)-env(safe-area-inset-bottom,0px))] md:h-[calc(100dvh-var(--header-h))]">38      <h1 className="sr-only">Explore orbit — live 3D globe</h1>39      <LazyGlobe variant="full" initialFocus={focus} />40    </div>41  );42}43