mirror of
https://github.com/bitbaum/substrata.git
synced 2026-12-03 15:27:57 +01:00
refactor(portal): two shells, one map, inquire on gaps (#49)
Public chrome is Map / News / Ask. Sidebar exists only on the signed-in desk. Atlas and world are two views of the same corpus. Thin pages get Inquire, which writes the existing contributions inbox — it does not publish. Nav lists live in config/site-nav.ts.
This commit is contained in:
19 files changed
+651
-1017
No files matched your search
+172
-150
@@ -1,22 +1,29 @@
|
||||
import Link from 'next/link';
|
||||
import { Page, Shell, SectionHeader } from '@/components/portal/Shell';
|
||||
import { WorldPanel } from '@/components/portal/WorldPanel';
|
||||
import { TECHNOLOGIES } from '@/config/substrata-taxonomy';
|
||||
import { atlasData } from '@/lib/atlas';
|
||||
import { bottleneckHref, marketHref } from '@/lib/links';
|
||||
import { BOTTLENECKS } from '@/lib/bottlenecks';
|
||||
|
||||
export const metadata = {
|
||||
title: 'Chain atlas',
|
||||
title: 'Map',
|
||||
description:
|
||||
'Explore the materials, machines, people and permissions behind technological progress, with evidence beside each claim.',
|
||||
'One map, two views: the chain from producer to technology, and the countries those rows sit in.',
|
||||
};
|
||||
|
||||
export default async function AtlasPage({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<{ topic?: string; chain?: string }>;
|
||||
searchParams: Promise<{ topic?: string; chain?: string; view?: string; country?: string }>;
|
||||
}) {
|
||||
const { topic: requested, chain: requestedChain } = await searchParams;
|
||||
const {
|
||||
topic: requested,
|
||||
chain: requestedChain,
|
||||
view: requestedView,
|
||||
country,
|
||||
} = await searchParams;
|
||||
const view = requestedView === 'world' ? 'world' : 'chain';
|
||||
const topic = TECHNOLOGIES.find((t) => t.id === requested)?.id ?? '';
|
||||
const stages = atlasData(topic);
|
||||
const chain =
|
||||
@@ -26,160 +33,175 @@ export default async function AtlasPage({
|
||||
<Shell currentPath="atlas">
|
||||
<Page>
|
||||
<SectionHeader
|
||||
title="Follow the physical world behind progress"
|
||||
lede="Technology depends on materials, machines, energy, expertise and permission. Explore where the research places each constraint, then inspect the companies and sources behind it."
|
||||
title="The map"
|
||||
lede="Two views of the same corpus. Chain is producer to technology. World is the countries those rows sit in. Paint is coverage, not importance."
|
||||
action={
|
||||
<Link href="/api/research/export" className="text-accent underline">
|
||||
Download the data
|
||||
</Link>
|
||||
}
|
||||
/>
|
||||
<form action="/atlas" className="research-search">
|
||||
<label htmlFor="atlas-topic">Explore a technology</label>
|
||||
<select name="topic" id="atlas-topic" defaultValue={topic}>
|
||||
<option value="">All technologies</option>
|
||||
{TECHNOLOGIES.map((t) => (
|
||||
<option key={t.id} value={t.id}>
|
||||
{t.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<button type="submit">Explore</button>
|
||||
</form>
|
||||
<section className="atlas-overview">
|
||||
<h2 className="font-heading text-2xl font-semibold">From producer to technology</h2>
|
||||
<p className="my-3 max-w-prose text-sm text-fg-secondary">
|
||||
Trace one bottleneck through the corpus. Each line has a declared meaning, and every
|
||||
producer’s source status stays visible.
|
||||
</p>
|
||||
<form action="/atlas" className="research-search">
|
||||
<input type="hidden" name="topic" value={topic} />
|
||||
<label htmlFor="chain-choice">Bottleneck</label>
|
||||
<select id="chain-choice" name="chain" defaultValue={chain.slug}>
|
||||
{BOTTLENECKS.map((b) => (
|
||||
<option key={b.slug} value={b.slug}>
|
||||
{b.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<button type="submit">Draw chain</button>
|
||||
</form>
|
||||
<div
|
||||
className="my-6 overflow-x-auto"
|
||||
tabIndex={0}
|
||||
aria-label="Chain diagram, scroll horizontally on a small screen"
|
||||
>
|
||||
{/* Native SVG is downloadable, has no scripts and carries the same corpus identifiers as the page. */}
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
<img
|
||||
src={`/api/research/diagram?slug=${chain.slug}`}
|
||||
alt={`Research relationships for ${chain.name}; ${chain.producers.length} producer rows, ${chain.counts.sourced} sourced. Full evidence is linked below.`}
|
||||
className="min-w-3xl w-full"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-wrap gap-5 text-sm text-accent">
|
||||
<Link href={bottleneckHref(chain.slug)}>Read the full evidence →</Link>
|
||||
<a href={`/api/research/diagram?slug=${chain.slug}&download=1`} download>
|
||||
Download SVG figure
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
<figure className="atlas-overview">
|
||||
<figcaption>
|
||||
<strong>Coverage across the system</strong>
|
||||
<p>
|
||||
Bar length counts mapped bottlenecks; the sourced count is shown beside it. This is a
|
||||
coverage chart, not a measurement of capacity or importance.
|
||||
</p>
|
||||
</figcaption>
|
||||
<div className="atlas-bars">
|
||||
{stages.map((s) => (
|
||||
<a href={`#stage-${s.id}`} key={s.id}>
|
||||
<span>{s.name}</span>
|
||||
<meter
|
||||
min={0}
|
||||
max={Math.max(1, ...stages.map((s) => s.total))}
|
||||
value={s.total}
|
||||
aria-label={`${s.name}: ${s.total} mapped bottlenecks`}
|
||||
/>
|
||||
<span>
|
||||
{s.total} mapped · {s.sourced} sourced
|
||||
</span>
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</figure>
|
||||
<p className="my-8 max-w-prose text-sm text-fg-secondary">
|
||||
The map groups records by research stage. It does not assert that every stage feeds the
|
||||
next, or that a listed producer supplies another company. Open a record to check the
|
||||
specific relationship.{' '}
|
||||
<Link href="/data" className="text-accent underline">
|
||||
Read the data method
|
||||
<nav className="map-views" aria-label="Map view">
|
||||
<Link href="/atlas" aria-current={view === 'chain' ? 'page' : undefined}>
|
||||
Chain
|
||||
</Link>
|
||||
.
|
||||
</p>
|
||||
<div className="atlas-stages">
|
||||
{stages.map((s, i) => (
|
||||
<section key={s.id} id={`stage-${s.id}`}>
|
||||
<header>
|
||||
<span className="research-kicker">
|
||||
{String(i + 1).padStart(2, '0')} / {s.total} mapped
|
||||
</span>
|
||||
<h2>{s.name}</h2>
|
||||
<p>{s.consumes}</p>
|
||||
</header>
|
||||
{s.rows.length === 0 ? (
|
||||
<p className="text-sm text-fg-secondary">
|
||||
No bottlenecks mapped for this selection. This is a research gap.
|
||||
</p>
|
||||
) : (
|
||||
<details className="atlas-records">
|
||||
<summary>Explore {s.total} bottlenecks</summary>
|
||||
<ul>
|
||||
{s.rows.map((b) => (
|
||||
<li key={b.slug}>
|
||||
<Link className="atlas-node" href={bottleneckHref(b.slug)}>
|
||||
<span>{b.name}</span>
|
||||
<small>
|
||||
{b.state} · assessment {b.binding}/12
|
||||
</small>
|
||||
</Link>
|
||||
<p>{b.plain}</p>
|
||||
<details>
|
||||
<summary>Evidence and organisations ({b.producers.length})</summary>
|
||||
<p className="my-2 text-xs">
|
||||
Score is an analyst judgement dated {b.judgedOn}. {b.rationale}
|
||||
</p>
|
||||
<ul>
|
||||
{b.producers.map((p) => (
|
||||
<li key={`${b.slug}-${p.name}`}>
|
||||
<Link href={marketHref(p.name)}>{p.name}</Link> · {p.verification}
|
||||
{p.source && (
|
||||
<>
|
||||
{' '}
|
||||
·{' '}
|
||||
<a href={p.source} rel="noreferrer">
|
||||
Primary source ↗
|
||||
</a>
|
||||
</>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
{b.producers.length === 0 && (
|
||||
<Link href={bottleneckHref(b.slug)}>
|
||||
Open the bottleneck’s evidence
|
||||
</Link>
|
||||
)}
|
||||
</details>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</details>
|
||||
)}
|
||||
<Link href="/atlas?view=world" aria-current={view === 'world' ? 'page' : undefined}>
|
||||
World
|
||||
</Link>
|
||||
</nav>
|
||||
{view === 'world' ? (
|
||||
<WorldPanel country={country} />
|
||||
) : (
|
||||
<>
|
||||
<form action="/atlas" className="research-search">
|
||||
<label htmlFor="atlas-topic">Explore a technology</label>
|
||||
<select name="topic" id="atlas-topic" defaultValue={topic}>
|
||||
<option value="">All technologies</option>
|
||||
{TECHNOLOGIES.map((t) => (
|
||||
<option key={t.id} value={t.id}>
|
||||
{t.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<button type="submit">Explore</button>
|
||||
</form>
|
||||
<section className="atlas-overview">
|
||||
<h2 className="font-heading text-2xl font-semibold">From producer to technology</h2>
|
||||
<p className="my-3 max-w-prose text-sm text-fg-secondary">
|
||||
Trace one bottleneck through the corpus. Each line has a declared meaning, and every
|
||||
producer’s source status stays visible.
|
||||
</p>
|
||||
<form action="/atlas" className="research-search">
|
||||
<input type="hidden" name="topic" value={topic} />
|
||||
<label htmlFor="chain-choice">Bottleneck</label>
|
||||
<select id="chain-choice" name="chain" defaultValue={chain.slug}>
|
||||
{BOTTLENECKS.map((b) => (
|
||||
<option key={b.slug} value={b.slug}>
|
||||
{b.name}
|
||||
</option>
|
||||
))}
|
||||
</select>
|
||||
<button type="submit">Draw chain</button>
|
||||
</form>
|
||||
<div
|
||||
className="my-6 overflow-x-auto"
|
||||
tabIndex={0}
|
||||
aria-label="Chain diagram, scroll horizontally on a small screen"
|
||||
>
|
||||
{/* Native SVG is downloadable, has no scripts and carries the same corpus identifiers as the page. */}
|
||||
{/* eslint-disable-next-line @next/next/no-img-element */}
|
||||
<img
|
||||
src={`/api/research/diagram?slug=${chain.slug}`}
|
||||
alt={`Research relationships for ${chain.name}; ${chain.producers.length} producer rows, ${chain.counts.sourced} sourced. Full evidence is linked below.`}
|
||||
className="min-w-3xl w-full"
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-wrap gap-5 text-sm text-accent">
|
||||
<Link href={bottleneckHref(chain.slug)}>Read the full evidence →</Link>
|
||||
<a href={`/api/research/diagram?slug=${chain.slug}&download=1`} download>
|
||||
Download SVG figure
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
))}
|
||||
</div>
|
||||
<figure className="atlas-overview">
|
||||
<figcaption>
|
||||
<strong>Coverage across the system</strong>
|
||||
<p>
|
||||
Bar length counts mapped bottlenecks; the sourced count is shown beside it. This
|
||||
is a coverage chart, not a measurement of capacity or importance.
|
||||
</p>
|
||||
</figcaption>
|
||||
<div className="atlas-bars">
|
||||
{stages.map((s) => (
|
||||
<a href={`#stage-${s.id}`} key={s.id}>
|
||||
<span>{s.name}</span>
|
||||
<meter
|
||||
min={0}
|
||||
max={Math.max(1, ...stages.map((s) => s.total))}
|
||||
value={s.total}
|
||||
aria-label={`${s.name}: ${s.total} mapped bottlenecks`}
|
||||
/>
|
||||
<span>
|
||||
{s.total} mapped · {s.sourced} sourced
|
||||
</span>
|
||||
</a>
|
||||
))}
|
||||
</div>
|
||||
</figure>
|
||||
<p className="my-8 max-w-prose text-sm text-fg-secondary">
|
||||
The map groups records by research stage. It does not assert that every stage feeds
|
||||
the next, or that a listed producer supplies another company. Open a record to check
|
||||
the specific relationship.{' '}
|
||||
<Link href="/data" className="text-accent underline">
|
||||
Read the data method
|
||||
</Link>
|
||||
.
|
||||
</p>
|
||||
<div className="atlas-stages">
|
||||
{stages.map((s, i) => (
|
||||
<section key={s.id} id={`stage-${s.id}`}>
|
||||
<header>
|
||||
<span className="research-kicker">
|
||||
{String(i + 1).padStart(2, '0')} / {s.total} mapped
|
||||
</span>
|
||||
<h2>{s.name}</h2>
|
||||
<p>{s.consumes}</p>
|
||||
</header>
|
||||
{s.rows.length === 0 ? (
|
||||
<p className="text-sm text-fg-secondary">
|
||||
No bottlenecks mapped for this selection. This is a research gap.
|
||||
</p>
|
||||
) : (
|
||||
<details className="atlas-records">
|
||||
<summary>Explore {s.total} bottlenecks</summary>
|
||||
<ul>
|
||||
{s.rows.map((b) => (
|
||||
<li key={b.slug}>
|
||||
<Link className="atlas-node" href={bottleneckHref(b.slug)}>
|
||||
<span>{b.name}</span>
|
||||
<small>
|
||||
{b.state} · assessment {b.binding}/12
|
||||
</small>
|
||||
</Link>
|
||||
<p>{b.plain}</p>
|
||||
<details>
|
||||
<summary>Evidence and organisations ({b.producers.length})</summary>
|
||||
<p className="my-2 text-xs">
|
||||
Score is an analyst judgement dated {b.judgedOn}. {b.rationale}
|
||||
</p>
|
||||
<ul>
|
||||
{b.producers.map((p) => (
|
||||
<li key={`${b.slug}-${p.name}`}>
|
||||
<Link href={marketHref(p.name)}>{p.name}</Link> ·{' '}
|
||||
{p.verification}
|
||||
{p.source && (
|
||||
<>
|
||||
{' '}
|
||||
·{' '}
|
||||
<a href={p.source} rel="noreferrer">
|
||||
Primary source ↗
|
||||
</a>
|
||||
</>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
{b.producers.length === 0 && (
|
||||
<Link href={bottleneckHref(b.slug)}>
|
||||
Open the bottleneck’s evidence
|
||||
</Link>
|
||||
)}
|
||||
</details>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</details>
|
||||
)}
|
||||
</section>
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
)}
|
||||
</Page>
|
||||
</Shell>
|
||||
);
|
||||
|
||||
@@ -20,6 +20,7 @@ import { capitalHref, marketHref, policyHref, scienceHref } from '@/lib/links';
|
||||
import { correctionUrl } from '@/lib/site';
|
||||
import { EventList } from '@/components/portal/EventList';
|
||||
import { Empty, Heading, Page, Shell } from '@/components/portal/Shell';
|
||||
import { Inquire } from '@/components/portal/Inquire';
|
||||
import { SeverityBar, Status, rowLabel } from '@/components/portal/Status';
|
||||
|
||||
interface RouteParams {
|
||||
@@ -145,6 +146,9 @@ export default async function BottleneckPage({ params }: RouteParams) {
|
||||
Report an error on GitHub
|
||||
</a>
|
||||
</div>
|
||||
<div className="mt-4">
|
||||
<Inquire topic={b.name} />
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<section className="mb-12">
|
||||
@@ -495,6 +499,7 @@ export default async function BottleneckPage({ params }: RouteParams) {
|
||||
<Empty
|
||||
what="Nothing recorded for this one yet."
|
||||
next="Events are added when a source is read and accepted by hand."
|
||||
topic={b.name}
|
||||
/>
|
||||
) : (
|
||||
<EventList events={b.events} showBottlenecks={false} />
|
||||
|
||||
@@ -79,6 +79,78 @@ html[data-theme='light'] {
|
||||
.site-header {
|
||||
border-top: 0;
|
||||
}
|
||||
.public-nav {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
}
|
||||
.public-nav-link {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 2.75rem;
|
||||
padding: 0 0.85rem;
|
||||
font-size: 0.8rem;
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
color: var(--color-fg-secondary);
|
||||
}
|
||||
.public-nav-link[aria-current='page'],
|
||||
.public-nav-link:hover {
|
||||
color: var(--color-fg-primary);
|
||||
}
|
||||
.map-views {
|
||||
display: flex;
|
||||
gap: 0;
|
||||
margin: 0 0 2rem;
|
||||
border-bottom: 1px solid var(--color-border-subtle);
|
||||
}
|
||||
.map-views a {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 2.75rem;
|
||||
padding: 0 1rem;
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
font-size: 0.75rem;
|
||||
color: var(--color-fg-tertiary);
|
||||
border-bottom: 2px solid transparent;
|
||||
margin-bottom: -1px;
|
||||
}
|
||||
.map-views a[aria-current='page'] {
|
||||
color: var(--color-fg-primary);
|
||||
border-bottom-color: var(--color-fg-primary);
|
||||
}
|
||||
.inquire-open {
|
||||
min-height: 2.75rem;
|
||||
padding: 0 0.2rem;
|
||||
font-size: 0.85rem;
|
||||
color: var(--color-fg-secondary);
|
||||
text-decoration: underline;
|
||||
text-underline-offset: 0.25em;
|
||||
cursor: pointer;
|
||||
background: none;
|
||||
border: 0;
|
||||
}
|
||||
.inquire-form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 0.6rem;
|
||||
margin-top: 1rem;
|
||||
max-width: 36rem;
|
||||
text-align: left;
|
||||
}
|
||||
.inquire-form textarea,
|
||||
.inquire-form input {
|
||||
border: 1px solid var(--color-border-strong);
|
||||
padding: 0.8rem;
|
||||
background: var(--color-surface-page);
|
||||
color: var(--color-fg-primary);
|
||||
}
|
||||
.inquire-note,
|
||||
.inquire-receipt {
|
||||
font-size: 0.8rem;
|
||||
color: var(--color-fg-tertiary);
|
||||
}
|
||||
.desk-shell {
|
||||
display: grid;
|
||||
min-height: 100vh;
|
||||
|
||||
+3
-23
@@ -19,7 +19,6 @@ import { EventList } from '@/components/portal/EventList';
|
||||
import { Empty, Heading, Page, Shell } from '@/components/portal/Shell';
|
||||
import { SeverityBar, Status, rowLabel } from '@/components/portal/Status';
|
||||
import { bottleneckHref, policyHref } from '@/lib/links';
|
||||
import { developmentProfile } from '@/lib/development';
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: { absolute: `${COMPANY.name} — the bottlenecks between here and much faster technology` },
|
||||
@@ -36,9 +35,7 @@ const WINDOW_DAYS = 30;
|
||||
* worst right now, and where do I start — and nothing else. Everything below
|
||||
* the fold is a route into a section rather than an essay.
|
||||
*/
|
||||
export default async function TodayPage() {
|
||||
const { profile } = await developmentProfile();
|
||||
const latestChange = profile?.changelog[0];
|
||||
export default function TodayPage() {
|
||||
const totals = portalTotals();
|
||||
const markets = marketTotals();
|
||||
const policy = policyTotals();
|
||||
@@ -103,29 +100,12 @@ export default async function TodayPage() {
|
||||
</p>
|
||||
<div className="mt-6 flex flex-wrap items-center gap-3">
|
||||
<Link href="/atlas" className="research-button">
|
||||
Explore the atlas
|
||||
</Link>
|
||||
<Link href="/world" className="research-button-ghost">
|
||||
World map
|
||||
Open the map
|
||||
</Link>
|
||||
<Link href="/chat" className="research-button-ghost">
|
||||
Ask Substrata
|
||||
</Link>
|
||||
<Link
|
||||
href="/changelog"
|
||||
className="text-sm text-fg-secondary underline-offset-4 hover:text-fg-primary hover:underline"
|
||||
>
|
||||
Changelog
|
||||
Ask
|
||||
</Link>
|
||||
</div>
|
||||
{latestChange && (
|
||||
<p className="mt-5 max-w-xl text-sm text-fg-tertiary">
|
||||
<Link href="/changelog" className="text-fg-secondary hover:text-fg-primary">
|
||||
{latestChange.date} · {latestChange.done.slice(0, 140)}
|
||||
{latestChange.done.length > 140 ? '…' : ''}
|
||||
</Link>
|
||||
</p>
|
||||
)}
|
||||
</header>
|
||||
{featured && (
|
||||
<figure className="hero-chain">
|
||||
|
||||
+7
-135
@@ -1,141 +1,13 @@
|
||||
import Link from 'next/link';
|
||||
import type { Metadata } from 'next';
|
||||
import { INSTRUMENTS, JURISDICTION_LABEL } from '@/config/substrata-policy';
|
||||
import { EVENTS } from '@/config/substrata-events';
|
||||
import { WORLD_PATHS } from '@/config/world-paths';
|
||||
import { WorldMap } from '@/components/portal/WorldMap';
|
||||
import { Page, SectionHeader, Shell } from '@/components/portal/Shell';
|
||||
import { EU_MEMBERS, factFor } from '@/lib/geo';
|
||||
import { MARKET_PARTICIPANTS } from '@/lib/participants';
|
||||
import { marketHref, policyHref } from '@/lib/links';
|
||||
import { redirect } from 'next/navigation';
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'World',
|
||||
description:
|
||||
'Every country on one map. Open a country to see recorded policy, organisations, events and materials — and the gaps.',
|
||||
};
|
||||
|
||||
export default async function WorldPage({
|
||||
/** Geography is a view of the map, not a second product. */
|
||||
export default async function WorldRedirect({
|
||||
searchParams,
|
||||
}: {
|
||||
searchParams: Promise<{ country?: string }>;
|
||||
}) {
|
||||
const { country: raw } = await searchParams;
|
||||
const selected = typeof raw === 'string' ? raw.toLowerCase() : '';
|
||||
const path = WORLD_PATHS.find((p) => p.iso2 === selected);
|
||||
const fact = selected ? factFor(selected) : null;
|
||||
const eu = selected && (EU_MEMBERS as readonly string[]).includes(selected);
|
||||
const instruments = INSTRUMENTS.filter(
|
||||
(i) => i.jurisdiction === selected || (eu && i.jurisdiction === 'eu'),
|
||||
);
|
||||
const orgs = MARKET_PARTICIPANTS.filter((p) =>
|
||||
p.jurisdictions.some((j) => j.toLowerCase() === selected),
|
||||
).slice(0, 12);
|
||||
const events = EVENTS.filter((e) =>
|
||||
e.jurisdictions.some((j) => j.toLowerCase() === selected || (eu && j.toLowerCase() === 'eu')),
|
||||
).slice(0, 8);
|
||||
|
||||
return (
|
||||
<Shell currentPath="world">
|
||||
<Page>
|
||||
<SectionHeader
|
||||
title="The physical world, as recorded"
|
||||
lede="Paint is coverage, not importance. A pale country is one we have not yet written down. Click any country. EU rules also colour every member state."
|
||||
/>
|
||||
<div className="world-layout">
|
||||
<WorldMap selected={selected || undefined} />
|
||||
<aside className="world-panel">
|
||||
{selected && (path || fact) ? (
|
||||
<>
|
||||
<p className="research-kicker">{selected.toUpperCase()}</p>
|
||||
<h2>{path?.name ?? fact?.name ?? selected.toUpperCase()}</h2>
|
||||
{fact?.hasRecord ? (
|
||||
<dl className="world-stats">
|
||||
<div>
|
||||
<dt>Rules</dt>
|
||||
<dd>{fact.instruments}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Organisations</dt>
|
||||
<dd>{fact.organisations}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Events</dt>
|
||||
<dd>{fact.events}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Material rows</dt>
|
||||
<dd>{fact.materials}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
) : (
|
||||
<p>No policy, organisation, event or material row is recorded here yet.</p>
|
||||
)}
|
||||
{eu && (
|
||||
<p className="mt-3 text-sm text-fg-tertiary">
|
||||
EU instruments are included because this state is a member. That is membership,
|
||||
not a claim that every EU rule binds this country the same way.
|
||||
</p>
|
||||
)}
|
||||
{fact?.policyHref && (
|
||||
<p className="mt-4">
|
||||
<Link href={fact.policyHref} className="text-accent">
|
||||
{JURISDICTION_LABEL[selected as keyof typeof JURISDICTION_LABEL] ??
|
||||
'Jurisdiction'}{' '}
|
||||
policy page →
|
||||
</Link>
|
||||
</p>
|
||||
)}
|
||||
{eu && !fact?.policyHref && (
|
||||
<p className="mt-4">
|
||||
<Link href={policyHref('eu')} className="text-accent">
|
||||
EU policy page →
|
||||
</Link>
|
||||
</p>
|
||||
)}
|
||||
{orgs.length > 0 && (
|
||||
<section className="mt-6">
|
||||
<h3>Organisations</h3>
|
||||
<ul>
|
||||
{orgs.map((org) => (
|
||||
<li key={org.slug}>
|
||||
<Link href={marketHref(org.slug)}>{org.name}</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
)}
|
||||
{instruments.length > 0 && (
|
||||
<section className="mt-6">
|
||||
<h3>Rules</h3>
|
||||
<ul>
|
||||
{instruments.map((instrument) => (
|
||||
<li key={instrument.id}>
|
||||
<Link href={policyHref(instrument.jurisdiction)}>{instrument.title}</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
)}
|
||||
{events.length > 0 && (
|
||||
<section className="mt-6">
|
||||
<h3>Recent events</h3>
|
||||
<ul>
|
||||
{events.map((event) => (
|
||||
<li key={event.id}>
|
||||
<span className="font-mono text-xs">{event.date}</span> {event.headline}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<p>Choose a country. Grey means we have not recorded a row there yet.</p>
|
||||
)}
|
||||
</aside>
|
||||
</div>
|
||||
</Page>
|
||||
</Shell>
|
||||
);
|
||||
const { country } = await searchParams;
|
||||
const query = new URLSearchParams({ view: 'world' });
|
||||
if (country) query.set('country', country);
|
||||
redirect(`/atlas?${query.toString()}`);
|
||||
}
|
||||
@@ -58,12 +58,6 @@ export async function AccountMenu() {
|
||||
<Link href="/account" className="account-menu-link">
|
||||
Desk
|
||||
</Link>
|
||||
<Link href="/chat" className="account-menu-link">
|
||||
Ask
|
||||
</Link>
|
||||
<Link href="/changelog" className="account-menu-link">
|
||||
Changelog
|
||||
</Link>
|
||||
<ThemeToggle />
|
||||
<form
|
||||
action={async () => {
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
import Link from 'next/link';
|
||||
|
||||
const ITEMS = [
|
||||
{ href: '/account', label: 'Desk' },
|
||||
{ href: '/chat', label: 'Ask' },
|
||||
{ href: '/world', label: 'World' },
|
||||
{ href: '/atlas', label: 'Atlas' },
|
||||
{ href: '/events', label: 'News' },
|
||||
{ href: '/changelog', label: 'Log' },
|
||||
{ href: '/roadmap', label: 'Roadmap' },
|
||||
] as const;
|
||||
|
||||
export function DeskSidebar({ currentPath }: { currentPath: string }) {
|
||||
const current = currentPath === '' ? '/' : `/${currentPath}`;
|
||||
return (
|
||||
<nav className="desk-sidebar" aria-label="Desk">
|
||||
<ul>
|
||||
{ITEMS.map((item) => (
|
||||
<li key={item.href}>
|
||||
<Link
|
||||
href={item.href}
|
||||
aria-current={current === item.href ? 'page' : undefined}
|
||||
className="desk-sidebar-link"
|
||||
>
|
||||
{item.label}
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
|
||||
/**
|
||||
* The way a gap becomes a row: send what you know, or ask us to look.
|
||||
* Posts to the existing contributions inbox. Nothing is published from here.
|
||||
*/
|
||||
export function Inquire({ topic }: { topic: string }) {
|
||||
const [open, setOpen] = useState(false);
|
||||
const [message, setMessage] = useState('');
|
||||
const [replyTo, setReplyTo] = useState('');
|
||||
const [busy, setBusy] = useState(false);
|
||||
const [receipt, setReceipt] = useState('');
|
||||
const [error, setError] = useState('');
|
||||
|
||||
async function send(event: React.FormEvent) {
|
||||
event.preventDefault();
|
||||
setBusy(true);
|
||||
setError('');
|
||||
try {
|
||||
const response = await fetch('/api/contributions', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
message,
|
||||
topic,
|
||||
replyTo,
|
||||
consent: true,
|
||||
}),
|
||||
});
|
||||
const result = await response.json();
|
||||
if (!response.ok) throw new Error(result.error || 'Could not send.');
|
||||
setReceipt(result.data.receipt);
|
||||
setMessage('');
|
||||
} catch (e) {
|
||||
setError(e instanceof Error ? e.message : 'Could not send. Please retry.');
|
||||
} finally {
|
||||
setBusy(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (receipt) {
|
||||
return (
|
||||
<p className="inquire-receipt" role="status">
|
||||
Received. Reference {receipt}. Nothing is published until a reviewer reads it.
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
if (!open) {
|
||||
return (
|
||||
<button type="button" className="inquire-open" onClick={() => setOpen(true)}>
|
||||
Know something, or want us to look?
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<form onSubmit={send} className="inquire-form">
|
||||
<label htmlFor="inquire-message">What should be on this page?</label>
|
||||
<textarea
|
||||
id="inquire-message"
|
||||
required
|
||||
minLength={10}
|
||||
maxLength={12000}
|
||||
rows={4}
|
||||
value={message}
|
||||
onChange={(e) => setMessage(e.target.value)}
|
||||
placeholder="A source, a correction, or a question to research."
|
||||
/>
|
||||
<label htmlFor="inquire-email">Email if you want a reply (optional)</label>
|
||||
<input
|
||||
id="inquire-email"
|
||||
type="email"
|
||||
value={replyTo}
|
||||
onChange={(e) => setReplyTo(e.target.value)}
|
||||
/>
|
||||
<p className="inquire-note">Sending this notifies the research inbox. It does not publish.</p>
|
||||
{error && <p role="alert">{error}</p>}
|
||||
<button type="submit" disabled={busy} className="research-button">
|
||||
{busy ? 'Sending…' : 'Send'}
|
||||
</button>
|
||||
</form>
|
||||
);
|
||||
}
|
||||
@@ -1,168 +0,0 @@
|
||||
/**
|
||||
* The navigation: grouped panels on a wide screen, a disclosure list on a
|
||||
* narrow one, and no JavaScript in either.
|
||||
*
|
||||
* A menu that only opens on hover is unusable by keyboard and invisible to a
|
||||
* phone, so this one opens on `group-hover` AND on `focus-within`, which
|
||||
* means tabbing into a group opens it and tabbing out closes it. On a phone
|
||||
* there is no hover at all, so the same data renders inside a `<details>`
|
||||
* element that the browser opens on tap.
|
||||
*
|
||||
* Both halves render from `config/site-nav.ts`, so a destination is added in
|
||||
* one place and appears in both.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import Link from 'next/link';
|
||||
|
||||
import { NAV_ACTION, type NavGroup } from '@/config/site-nav';
|
||||
|
||||
function ItemLink({
|
||||
item,
|
||||
onDark = false,
|
||||
}: {
|
||||
item: { label: string; href: string; blurb: string; badge?: string };
|
||||
onDark?: boolean;
|
||||
}) {
|
||||
return (
|
||||
<Link
|
||||
href={item.href}
|
||||
className={[
|
||||
'block rounded-md px-3 py-2 transition-colors',
|
||||
onDark ? 'hover:bg-surface-page' : 'hover:bg-surface-raised',
|
||||
].join(' ')}
|
||||
>
|
||||
<span className="flex items-baseline gap-2">
|
||||
<span className="font-medium text-fg-primary">{item.label}</span>
|
||||
{item.badge && (
|
||||
<span className="font-mono text-xs tabular-nums text-fg-muted">{item.badge}</span>
|
||||
)}
|
||||
</span>
|
||||
<span className="mt-0.5 block text-xs leading-snug text-fg-tertiary">{item.blurb}</span>
|
||||
</Link>
|
||||
);
|
||||
}
|
||||
|
||||
/** Wide screens: a row of groups, each opening a panel below it. */
|
||||
function WideNav({ groups, currentGroup }: { groups: NavGroup[]; currentGroup?: string }) {
|
||||
return (
|
||||
<nav aria-label="Sections" className="hidden items-center gap-1 lg:flex">
|
||||
{groups.map((group) => (
|
||||
<div key={group.id} className="group/nav relative">
|
||||
<button
|
||||
type="button"
|
||||
aria-expanded="false"
|
||||
className={[
|
||||
'inline-flex min-h-11 items-center gap-1.5 rounded px-3 font-mono text-xs uppercase tracking-caps transition-colors',
|
||||
currentGroup === group.id
|
||||
? 'text-fg-primary'
|
||||
: 'text-fg-tertiary hover:text-fg-primary',
|
||||
'group-hover/nav:text-fg-primary group-focus-within/nav:text-fg-primary',
|
||||
].join(' ')}
|
||||
>
|
||||
{group.label}
|
||||
<span aria-hidden className="text-[0.6rem] opacity-60">
|
||||
▾
|
||||
</span>
|
||||
</button>
|
||||
|
||||
{/* The panel. Invisible rather than absent, so focus can reach it. */}
|
||||
<div
|
||||
className={[
|
||||
'invisible absolute left-0 top-full z-40 w-[34rem] opacity-0 transition-opacity duration-100',
|
||||
'group-hover/nav:visible group-hover/nav:opacity-100',
|
||||
'group-focus-within/nav:visible group-focus-within/nav:opacity-100',
|
||||
].join(' ')}
|
||||
>
|
||||
<div className="mt-1 overflow-hidden rounded-lg border border-strong bg-surface-page shadow-lg">
|
||||
<p className="border-b border-subtle px-4 py-2.5 text-xs leading-snug text-fg-tertiary">
|
||||
{group.blurb}
|
||||
</p>
|
||||
<div className="grid grid-cols-2 gap-1 p-2">
|
||||
{group.items.map((item) => (
|
||||
<ItemLink key={item.href} item={item} />
|
||||
))}
|
||||
</div>
|
||||
{group.feature && (
|
||||
<Link
|
||||
href={group.feature.href}
|
||||
className="flex items-baseline justify-between gap-4 border-t border-subtle bg-surface-raised px-4 py-3 transition-colors hover:bg-surface-page"
|
||||
>
|
||||
<span>
|
||||
<span className="font-medium text-accent">{group.feature.label}</span>
|
||||
<span className="mt-0.5 block text-xs leading-snug text-fg-tertiary">
|
||||
{group.feature.blurb}
|
||||
</span>
|
||||
</span>
|
||||
<span aria-hidden className="text-accent">
|
||||
→
|
||||
</span>
|
||||
</Link>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
|
||||
const MOBILE_ACTIONS = [
|
||||
{ href: '/search', label: 'Search' },
|
||||
{ href: '/chat', label: 'Ask' },
|
||||
{ href: '/changelog', label: 'Log' },
|
||||
{ href: '/world', label: 'World' },
|
||||
{ href: '/account', label: 'Desk' },
|
||||
{ href: NAV_ACTION.href, label: NAV_ACTION.label },
|
||||
] as const;
|
||||
|
||||
/** Narrow screens: one disclosure holding every group. */
|
||||
function NarrowNav({ groups }: { groups: NavGroup[] }) {
|
||||
return (
|
||||
<details className="site-menu lg:hidden [&[open]_.chev]:rotate-180">
|
||||
<summary className="inline-flex min-h-11 cursor-pointer list-none items-center gap-2 px-2 font-mono text-xs uppercase tracking-caps text-fg-tertiary">
|
||||
Menu
|
||||
<span aria-hidden className="chev text-[0.6rem] transition-transform">
|
||||
▾
|
||||
</span>
|
||||
</summary>
|
||||
<div className="absolute inset-x-0 z-40 mt-2 max-h-[80vh] overflow-y-auto border-y border-strong bg-surface-page px-4 py-4 shadow-lg sm:px-6">
|
||||
<nav aria-label="Quick actions" className="mb-3 grid grid-cols-2 gap-2">
|
||||
{MOBILE_ACTIONS.map((action) => (
|
||||
<Link
|
||||
key={action.href}
|
||||
href={action.href}
|
||||
className={
|
||||
action.href === NAV_ACTION.href
|
||||
? 'flex min-h-11 items-center justify-center rounded-md bg-accent text-sm font-medium text-surface-page'
|
||||
: 'flex min-h-11 items-center justify-center rounded-md border border-strong text-sm font-medium text-fg-primary'
|
||||
}
|
||||
>
|
||||
{action.label}
|
||||
</Link>
|
||||
))}
|
||||
</nav>
|
||||
{groups.map((group) => (
|
||||
<section key={group.id} className="border-b border-subtle py-3 last:border-0">
|
||||
<h2 className="font-mono text-xs uppercase tracking-caps text-fg-tertiary">
|
||||
{group.label}
|
||||
</h2>
|
||||
<div className="mt-1 grid gap-0.5 sm:grid-cols-2">
|
||||
{group.items.map((item) => (
|
||||
<ItemLink key={item.href} item={item} onDark />
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
))}
|
||||
</div>
|
||||
</details>
|
||||
);
|
||||
}
|
||||
|
||||
export function Megamenu({ groups, currentGroup }: { groups: NavGroup[]; currentGroup?: string }) {
|
||||
return <WideNav groups={groups} currentGroup={currentGroup} />;
|
||||
}
|
||||
|
||||
export function MobileMenu({ groups }: { groups: NavGroup[] }) {
|
||||
return <NarrowNav groups={groups} />;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import Link from 'next/link';
|
||||
import { PUBLIC_NAV } from '@/config/site-nav';
|
||||
|
||||
export function PublicNav({ currentPath }: { currentPath: string }) {
|
||||
const current = currentPath === '' ? '/' : `/${currentPath}`;
|
||||
return (
|
||||
<nav aria-label="Primary" className="public-nav">
|
||||
{PUBLIC_NAV.map((item) => {
|
||||
const active = current === item.href || current.startsWith(`${item.href}/`);
|
||||
return (
|
||||
<Link
|
||||
key={item.href}
|
||||
href={item.href}
|
||||
aria-current={active ? 'page' : undefined}
|
||||
className="public-nav-link"
|
||||
>
|
||||
{item.label}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
+83
-198
@@ -1,112 +1,52 @@
|
||||
/**
|
||||
* The portal's chrome: a masthead with the section navigation, and a footer
|
||||
* carrying everything that is not a section.
|
||||
* Two shells, from one config.
|
||||
*
|
||||
* Six sections, because that is how the material actually divides: what
|
||||
* changed (Today), what is constrained (Bottlenecks), who makes it (Markets),
|
||||
* what the rules do (Policy), what would remove it (Science), and the
|
||||
* open questions (Research). About holds the method, the glossary and the
|
||||
* disclosures.
|
||||
* Public pages: wordmark, three links, search, account. Footer is a legal
|
||||
* line plus three destinations. No sidebar.
|
||||
*
|
||||
* Desk (/account, /review): sidebar from DESK_NAV, no public megamenu, no
|
||||
* sitemap footer. That is the only place a sidebar belongs.
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import Link from 'next/link';
|
||||
|
||||
import { siteChrome } from '@/config/site-content';
|
||||
import { NAV_ACTION, navGroups } from '@/config/site-nav';
|
||||
import { CALLS } from '@/config/substrata-calls';
|
||||
import { CAPITAL_PROVIDERS } from '@/config/substrata-capital';
|
||||
import { EVENTS } from '@/config/substrata-events';
|
||||
import { INSTRUMENTS } from '@/config/substrata-policy';
|
||||
import { SCIENCE } from '@/config/substrata-science';
|
||||
import { BOTTLENECKS, portalTotals } from '@/lib/bottlenecks';
|
||||
import { learnCount, noteCount } from '@/lib/notes';
|
||||
import { MARKET_PARTICIPANTS } from '@/lib/participants';
|
||||
import { DESK_NAV, FOOTER_NAV } from '@/config/site-nav';
|
||||
import { currentSession, isReviewer } from '@/lib/auth';
|
||||
import { SITE, correctionUrl } from '@/lib/site';
|
||||
import { currentSession } from '@/lib/auth';
|
||||
import { AccountMenu } from './AccountMenu';
|
||||
import { DeskSidebar } from './DeskSidebar';
|
||||
import { Inquire } from './Inquire';
|
||||
import { Mark, SearchIcon } from './Mark';
|
||||
import { Megamenu, MobileMenu } from './Megamenu';
|
||||
import { PublicNav } from './PublicNav';
|
||||
|
||||
/**
|
||||
* Which menu group a page belongs to, so the right one reads as current.
|
||||
* Pages pass their own id; anything unrecognised simply highlights nothing.
|
||||
*/
|
||||
export const GROUP_FOR_PATH: Record<string, string> = {
|
||||
'': 'latest',
|
||||
events: 'latest',
|
||||
notes: 'latest',
|
||||
atlas: 'map',
|
||||
world: 'map',
|
||||
search: 'map',
|
||||
talent: 'map',
|
||||
data: 'about',
|
||||
development: 'about',
|
||||
roadmap: 'about',
|
||||
changelog: 'latest',
|
||||
chat: 'join',
|
||||
account: 'join',
|
||||
bottlenecks: 'map',
|
||||
markets: 'map',
|
||||
policy: 'map',
|
||||
science: 'map',
|
||||
capital: 'map',
|
||||
about: 'about',
|
||||
thesis: 'about',
|
||||
research: 'about',
|
||||
calls: 'about',
|
||||
learn: 'about',
|
||||
join: 'join',
|
||||
};
|
||||
const DESK_PATHS = new Set(['account', 'review']);
|
||||
|
||||
const FOOTER_GROUPS = [
|
||||
{
|
||||
label: 'The map',
|
||||
links: [
|
||||
{ href: '/bottlenecks', label: 'Bottlenecks' },
|
||||
{ href: '/markets', label: 'Markets' },
|
||||
{ href: '/policy', label: 'Policy' },
|
||||
{ href: '/science', label: 'Science' },
|
||||
{ href: '/capital', label: 'Capital' },
|
||||
{ href: '/atlas', label: 'Chain atlas' },
|
||||
{ href: '/world', label: 'World map' },
|
||||
{ href: '/talent', label: 'Talent & expertise' },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Latest',
|
||||
links: [
|
||||
{ href: '/', label: 'Today' },
|
||||
{ href: '/events', label: 'Events' },
|
||||
{ href: '/notes', label: 'Blog & development notes' },
|
||||
{ href: '/changelog', label: 'Changelog' },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'About',
|
||||
links: [
|
||||
{ href: '/learn', label: 'Learn' },
|
||||
{ href: '/about', label: 'What this is' },
|
||||
{ href: '/thesis', label: 'What we think' },
|
||||
{ href: '/calls', label: 'Calls' },
|
||||
{ href: '/research', label: 'Open questions' },
|
||||
{ href: '/join', label: 'Join' },
|
||||
{ href: '/roadmap', label: 'Roadmap' },
|
||||
{ href: '/development', label: 'Development & vision' },
|
||||
],
|
||||
},
|
||||
{
|
||||
label: 'Open',
|
||||
links: [
|
||||
{ href: '/api/map', label: 'The map as JSON' },
|
||||
{ href: SITE.repo, label: 'Source on GitHub' },
|
||||
{ href: '/data', label: 'Data quality & exports' },
|
||||
{ href: '/chat', label: 'Ask Substrata' },
|
||||
{ href: '/account', label: 'Your research desk' },
|
||||
],
|
||||
},
|
||||
] as const;
|
||||
export function DeskSidebar({
|
||||
currentPath,
|
||||
items,
|
||||
}: {
|
||||
currentPath: string;
|
||||
items: typeof DESK_NAV;
|
||||
}) {
|
||||
const current = currentPath === '' ? '/' : `/${currentPath}`;
|
||||
return (
|
||||
<nav className="desk-sidebar" aria-label="Desk">
|
||||
<ul>
|
||||
{items.map((item) => (
|
||||
<li key={item.href}>
|
||||
<Link
|
||||
href={item.href}
|
||||
aria-current={current === item.href ? 'page' : undefined}
|
||||
className="desk-sidebar-link"
|
||||
>
|
||||
{item.label}
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
);
|
||||
}
|
||||
|
||||
export async function Shell({
|
||||
currentPath,
|
||||
@@ -115,29 +55,19 @@ export async function Shell({
|
||||
currentPath: string;
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
const session = await currentSession();
|
||||
const signedIn = Boolean(session?.actorId);
|
||||
const chrome = siteChrome();
|
||||
const totals = portalTotals();
|
||||
const groups = navGroups({
|
||||
bottlenecks: totals.bottlenecks,
|
||||
organisations: MARKET_PARTICIPANTS.length,
|
||||
rules: INSTRUMENTS.length,
|
||||
solutions: SCIENCE.length,
|
||||
events: EVENTS.length,
|
||||
notes: noteCount(),
|
||||
calls: CALLS.length,
|
||||
capital: CAPITAL_PROVIDERS.length,
|
||||
learn: learnCount(),
|
||||
bindingNow: BOTTLENECKS.filter((b) => b.horizon === 'now').length,
|
||||
});
|
||||
const session = await currentSession();
|
||||
const desk = DESK_PATHS.has(currentPath) && Boolean(session?.actorId);
|
||||
const deskItems = DESK_NAV.filter(
|
||||
(item) => item.href !== '/review' || isReviewer(session?.actorId),
|
||||
);
|
||||
|
||||
return (
|
||||
<div className={signedIn ? 'desk-shell' : 'flex min-h-screen flex-col bg-surface-page'}>
|
||||
<div className={desk ? 'desk-shell' : 'flex min-h-screen flex-col bg-surface-page'}>
|
||||
<header className="site-header sticky top-0 z-30 border-b border-subtle bg-surface-page/95 backdrop-blur">
|
||||
<div className="relative mx-auto flex max-w-shell items-center gap-3 px-4 py-2.5 sm:px-6 lg:gap-4 lg:px-8">
|
||||
<div className="relative mx-auto flex max-w-shell items-center gap-4 px-4 py-2.5 sm:px-6 lg:px-8">
|
||||
<Link
|
||||
href="/"
|
||||
href={desk ? '/account' : '/'}
|
||||
className="inline-flex shrink-0 items-center gap-2 rounded focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent"
|
||||
>
|
||||
<Mark className="h-7 w-7 text-fg-primary" />
|
||||
@@ -145,9 +75,9 @@ export async function Shell({
|
||||
{chrome.name}
|
||||
</span>
|
||||
</Link>
|
||||
<Megamenu groups={groups} currentGroup={GROUP_FOR_PATH[currentPath]} />
|
||||
{!desk && <PublicNav currentPath={currentPath} />}
|
||||
<div className="ml-auto flex items-center gap-1 sm:gap-2">
|
||||
<form action="/search" className="site-search hidden lg:flex">
|
||||
<form action="/search" className="site-search hidden md:flex">
|
||||
<label className="sr-only" htmlFor="header-search">
|
||||
Search the research
|
||||
</label>
|
||||
@@ -155,100 +85,59 @@ export async function Shell({
|
||||
id="header-search"
|
||||
name="q"
|
||||
type="search"
|
||||
placeholder="Try ASML or EUV"
|
||||
placeholder="ASML, EUV, quartz"
|
||||
maxLength={200}
|
||||
/>
|
||||
<button type="submit">Search</button>
|
||||
</form>
|
||||
<Link
|
||||
href="/search"
|
||||
className="inline-flex h-11 w-11 items-center justify-center rounded-md text-fg-secondary hover:text-fg-primary lg:hidden"
|
||||
className="inline-flex h-11 w-11 items-center justify-center text-fg-secondary hover:text-fg-primary md:hidden"
|
||||
aria-label="Search the research"
|
||||
>
|
||||
<SearchIcon className="h-5 w-5" />
|
||||
</Link>
|
||||
<Link href="/changelog" className="site-action hidden lg:inline-flex">
|
||||
Log
|
||||
</Link>
|
||||
<Link href="/chat" className="site-action hidden lg:inline-flex">
|
||||
Ask
|
||||
</Link>
|
||||
<Link href={NAV_ACTION.href} className="site-join hidden lg:inline-flex">
|
||||
{NAV_ACTION.label}
|
||||
</Link>
|
||||
<AccountMenu />
|
||||
<MobileMenu groups={groups} />
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
{signedIn && <DeskSidebar currentPath={currentPath} />}
|
||||
{desk && <DeskSidebar currentPath={currentPath} items={deskItems} />}
|
||||
<main className="flex-1">{children}</main>
|
||||
<footer className="site-footer mt-16 border-t border-subtle">
|
||||
<div className="mx-auto max-w-shell px-4 py-10 sm:px-6 lg:px-8">
|
||||
<div className="mb-10 max-w-xl">
|
||||
<p className="inline-flex items-center gap-2 font-heading text-lg font-semibold tracking-display text-fg-primary">
|
||||
<Mark className="h-6 w-6 text-accent" />
|
||||
{chrome.name}
|
||||
</p>
|
||||
<p className="mt-2 text-sm leading-relaxed text-fg-secondary">{chrome.tagline}</p>
|
||||
</div>
|
||||
<div className="grid grid-cols-2 gap-8 lg:grid-cols-4">
|
||||
{FOOTER_GROUPS.map((group) => (
|
||||
<nav key={group.label} aria-label={group.label}>
|
||||
<h2 className="font-mono text-xs uppercase tracking-caps text-fg-tertiary">
|
||||
{group.label}
|
||||
</h2>
|
||||
<ul className="mt-2 space-y-1">
|
||||
{group.links.map((link) => (
|
||||
<li key={link.href}>
|
||||
{link.href.startsWith('/') ? (
|
||||
<Link
|
||||
href={link.href}
|
||||
className="text-sm text-fg-secondary hover:text-fg-primary"
|
||||
>
|
||||
{link.label}
|
||||
</Link>
|
||||
) : (
|
||||
<a
|
||||
href={link.href}
|
||||
className="text-sm text-fg-secondary hover:text-fg-primary"
|
||||
>
|
||||
{link.label}
|
||||
</a>
|
||||
)}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</nav>
|
||||
))}
|
||||
</div>
|
||||
<div className="mt-10 border-t border-subtle pt-6">
|
||||
<a
|
||||
href={correctionUrl('Substrata')}
|
||||
className="font-mono text-xs uppercase tracking-caps text-fg-tertiary hover:text-fg-primary"
|
||||
>
|
||||
Report an error on GitHub
|
||||
</a>
|
||||
<p className="mt-3 max-w-prose text-xs leading-relaxed text-fg-muted">
|
||||
{chrome.footerNote}
|
||||
</p>
|
||||
</div>
|
||||
<footer className="site-footer mt-auto border-t border-subtle">
|
||||
<div className="mx-auto flex max-w-shell flex-col gap-4 px-4 py-6 sm:px-6 lg:flex-row lg:items-center lg:justify-between lg:px-8">
|
||||
<p className="max-w-xl text-xs leading-relaxed text-fg-muted">{chrome.footerNote}</p>
|
||||
{!desk && (
|
||||
<nav aria-label="Footer" className="flex flex-wrap gap-x-5 gap-y-2 text-sm">
|
||||
{FOOTER_NAV.map((item) => (
|
||||
<Link
|
||||
key={item.href}
|
||||
href={item.href}
|
||||
className="text-fg-secondary hover:text-fg-primary"
|
||||
>
|
||||
{item.label}
|
||||
</Link>
|
||||
))}
|
||||
<a href={SITE.repo} className="text-fg-secondary hover:text-fg-primary">
|
||||
Source
|
||||
</a>
|
||||
<a
|
||||
href={correctionUrl('Substrata')}
|
||||
className="text-fg-secondary hover:text-fg-primary"
|
||||
>
|
||||
Correction
|
||||
</a>
|
||||
</nav>
|
||||
)}
|
||||
</div>
|
||||
</footer>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** Page width and vertical rhythm, shared by every portal page. */
|
||||
export function Page({ children }: { children: React.ReactNode }) {
|
||||
return <div className="mx-auto max-w-shell px-4 py-10 sm:px-6 sm:py-12 lg:px-8">{children}</div>;
|
||||
}
|
||||
|
||||
/**
|
||||
* The top of a section: what it is in one plain sentence, then the numbers.
|
||||
* Every section opens the same way, so a reader who has understood one
|
||||
* understands the shape of the rest.
|
||||
*/
|
||||
export function SectionHeader({
|
||||
title,
|
||||
lede,
|
||||
@@ -270,7 +159,7 @@ export function SectionHeader({
|
||||
</div>
|
||||
<p className="mt-3 max-w-2xl text-base leading-relaxed text-fg-secondary">{lede}</p>
|
||||
{stats && stats.length > 0 && (
|
||||
<dl className="mt-6 grid grid-cols-2 gap-px overflow-hidden rounded-lg border border-subtle bg-border-subtle lg:grid-cols-4">
|
||||
<dl className="mt-6 grid grid-cols-2 gap-px overflow-hidden border border-subtle bg-border-subtle lg:grid-cols-4">
|
||||
{stats.map((stat) => (
|
||||
<div key={stat.label} className="bg-surface-raised px-4 py-3 sm:px-5">
|
||||
<dt className="font-mono text-xs uppercase tracking-caps text-fg-tertiary">
|
||||
@@ -290,7 +179,6 @@ export function SectionHeader({
|
||||
);
|
||||
}
|
||||
|
||||
/** A section heading inside a page: a mono index and a serif title. */
|
||||
export function Heading({
|
||||
index,
|
||||
title,
|
||||
@@ -311,10 +199,6 @@ export function Heading({
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* What a column of jargon means, folded away. Open it once and the table
|
||||
* stops being a private language; leave it closed and the table is unchanged.
|
||||
*/
|
||||
export function Legend({ items }: { items: { term: string; detail: string }[] }) {
|
||||
return (
|
||||
<details className="mt-3 text-sm">
|
||||
@@ -335,12 +219,9 @@ export function Legend({ items }: { items: { term: string; detail: string }[] })
|
||||
);
|
||||
}
|
||||
|
||||
/** A row of filter chips with a label. Used by every section list. */
|
||||
export function FilterRow({ label, children }: { label: string; children: React.ReactNode }) {
|
||||
return (
|
||||
<div className="flex flex-col gap-2 sm:flex-row sm:items-center">
|
||||
{/* The label sits above the chips on a phone: side by side, a wrapping
|
||||
chip row slides under a fixed-width label and collides with it. */}
|
||||
<span className="font-mono text-xs uppercase tracking-caps text-fg-tertiary sm:mr-1 sm:w-20 sm:shrink-0">
|
||||
{label}
|
||||
</span>
|
||||
@@ -349,12 +230,16 @@ export function FilterRow({ label, children }: { label: string; children: React.
|
||||
);
|
||||
}
|
||||
|
||||
/** An honest empty state: says what is missing and what would fill it. */
|
||||
export function Empty({ what, next }: { what: string; next?: string }) {
|
||||
export function Empty({ what, next, topic }: { what: string; next?: string; topic?: string }) {
|
||||
return (
|
||||
<div className="rounded-lg border border-dashed border-strong px-5 py-8 text-center">
|
||||
<div className="border border-dashed border-strong px-5 py-8 text-center">
|
||||
<p className="text-sm text-fg-secondary">{what}</p>
|
||||
{next && <p className="mt-1 text-xs text-fg-muted">{next}</p>}
|
||||
{topic && (
|
||||
<div className="mt-4">
|
||||
<Inquire topic={topic} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -22,7 +22,7 @@ export function WorldMap({ selected }: { selected?: string }) {
|
||||
const fact = country.iso2 ? facts.get(country.iso2) : undefined;
|
||||
const w = weight(fact);
|
||||
const active = selected && country.iso2 === selected;
|
||||
const href = country.iso2 ? `/world?country=${country.iso2}` : undefined;
|
||||
const href = country.iso2 ? `/atlas?view=world&country=${country.iso2}` : undefined;
|
||||
const node = (
|
||||
<path
|
||||
d={country.d}
|
||||
|
||||
@@ -0,0 +1,121 @@
|
||||
import Link from 'next/link';
|
||||
import { INSTRUMENTS } from '@/config/substrata-policy';
|
||||
import { EVENTS } from '@/config/substrata-events';
|
||||
import { WORLD_PATHS } from '@/config/world-paths';
|
||||
import { WorldMap } from './WorldMap';
|
||||
import { Inquire } from './Inquire';
|
||||
import { EU_MEMBERS, factFor } from '@/lib/geo';
|
||||
import { MARKET_PARTICIPANTS } from '@/lib/participants';
|
||||
import { marketHref, policyHref } from '@/lib/links';
|
||||
|
||||
export function WorldPanel({ country }: { country?: string }) {
|
||||
const selected = country?.toLowerCase() ?? '';
|
||||
const path = WORLD_PATHS.find((p) => p.iso2 === selected);
|
||||
const fact = selected ? factFor(selected) : null;
|
||||
const eu = selected && (EU_MEMBERS as readonly string[]).includes(selected);
|
||||
const instruments = INSTRUMENTS.filter(
|
||||
(i) => i.jurisdiction === selected || (eu && i.jurisdiction === 'eu'),
|
||||
);
|
||||
const orgs = MARKET_PARTICIPANTS.filter((p) =>
|
||||
p.jurisdictions.some((j) => j.toLowerCase() === selected),
|
||||
).slice(0, 12);
|
||||
const events = EVENTS.filter((e) =>
|
||||
e.jurisdictions.some((j) => j.toLowerCase() === selected || (eu && j.toLowerCase() === 'eu')),
|
||||
).slice(0, 8);
|
||||
|
||||
return (
|
||||
<div className="world-layout">
|
||||
<WorldMap selected={selected || undefined} />
|
||||
<aside className="world-panel">
|
||||
{selected && (path || fact) ? (
|
||||
<>
|
||||
<p className="research-kicker">{selected.toUpperCase()}</p>
|
||||
<h2>{path?.name ?? fact?.name ?? selected.toUpperCase()}</h2>
|
||||
{fact?.hasRecord ? (
|
||||
<dl className="world-stats">
|
||||
<div>
|
||||
<dt>Rules</dt>
|
||||
<dd>{fact.instruments}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Organisations</dt>
|
||||
<dd>{fact.organisations}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Events</dt>
|
||||
<dd>{fact.events}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Material rows</dt>
|
||||
<dd>{fact.materials}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
) : (
|
||||
<>
|
||||
<p>No policy, organisation, event or material row is recorded here yet.</p>
|
||||
<Inquire topic={`country:${selected}`} />
|
||||
</>
|
||||
)}
|
||||
{eu && (
|
||||
<p className="mt-3 text-sm text-fg-tertiary">
|
||||
EU instruments are included because this state is a member.
|
||||
</p>
|
||||
)}
|
||||
{fact?.policyHref && (
|
||||
<p className="mt-4">
|
||||
<Link href={fact.policyHref} className="text-accent">
|
||||
Policy page →
|
||||
</Link>
|
||||
</p>
|
||||
)}
|
||||
{eu && !fact?.policyHref && (
|
||||
<p className="mt-4">
|
||||
<Link href={policyHref('eu')} className="text-accent">
|
||||
EU policy page →
|
||||
</Link>
|
||||
</p>
|
||||
)}
|
||||
{orgs.length > 0 && (
|
||||
<section className="mt-6">
|
||||
<h3>Organisations</h3>
|
||||
<ul>
|
||||
{orgs.map((org) => (
|
||||
<li key={org.slug}>
|
||||
<Link href={marketHref(org.slug)}>{org.name}</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
)}
|
||||
{instruments.length > 0 && (
|
||||
<section className="mt-6">
|
||||
<h3>Rules</h3>
|
||||
<ul>
|
||||
{instruments.map((instrument) => (
|
||||
<li key={instrument.id}>
|
||||
<Link href={policyHref(instrument.jurisdiction)}>{instrument.title}</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
)}
|
||||
{events.length > 0 && (
|
||||
<section className="mt-6">
|
||||
<h3>Recent events</h3>
|
||||
<ul>
|
||||
{events.map((event) => (
|
||||
<li key={event.id}>
|
||||
<span className="font-mono text-xs">{event.date}</span> {event.headline}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
)}
|
||||
</>
|
||||
) : (
|
||||
<p>Choose a country. Grey means we have not recorded a row there yet.</p>
|
||||
)}
|
||||
</aside>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
+31
-195
@@ -1,209 +1,45 @@
|
||||
/**
|
||||
* The navigation, as data.
|
||||
* Chrome, as data. Two shells, two lists.
|
||||
*
|
||||
* Seven flat items was too many to hold, and two of them — Science and
|
||||
* Research — were indistinguishable from the label alone. The fix is not
|
||||
* fewer destinations but fewer decisions: three groups that answer three
|
||||
* different questions, and one action.
|
||||
* Public: a SpaceX-thin bar. Four jobs — read the map, see what changed, ask,
|
||||
* sign in. Everything else is a page the map or the footer can reach.
|
||||
*
|
||||
* The map — what is constrained, who holds it, what governs it, what fixes it
|
||||
* Latest — what changed, and what we have written about it
|
||||
* About — how this is made, what the words mean, what we think
|
||||
* Join — the way in, kept out of the groups because it is a different verb
|
||||
* Desk: the signed-in app. Sidebar only here. Public megamenus do not follow
|
||||
* a reader into their dashboard.
|
||||
*
|
||||
* Every item carries a one-line blurb that renders in the menu. That is the
|
||||
* information hierarchy: a reader chooses from descriptions, not from nouns
|
||||
* they have to guess at.
|
||||
*
|
||||
* Created: 2026-09-15
|
||||
* Created: 2026-09-15. Split into public vs desk 2026-09-16.
|
||||
*/
|
||||
|
||||
export interface NavItem {
|
||||
export interface NavLink {
|
||||
label: string;
|
||||
href: string;
|
||||
/** Shown under the label in the menu. Say what the reader will find, not what it is called. */
|
||||
blurb: string;
|
||||
/** Rendered as a small count or status next to the label. */
|
||||
badge?: string;
|
||||
}
|
||||
|
||||
export interface NavGroup {
|
||||
id: string;
|
||||
label: string;
|
||||
/** One line describing the group, shown at the top of its panel. */
|
||||
blurb: string;
|
||||
items: NavItem[];
|
||||
/** The one thing worth pointing at inside this group. */
|
||||
feature?: { label: string; href: string; blurb: string };
|
||||
}
|
||||
/** Header on every public page. Order is the information hierarchy. */
|
||||
export const PUBLIC_NAV: readonly NavLink[] = [
|
||||
{ label: 'Map', href: '/atlas' },
|
||||
{ label: 'News', href: '/events' },
|
||||
{ label: 'Ask', href: '/chat' },
|
||||
];
|
||||
|
||||
export function navGroups(counts: {
|
||||
bottlenecks: number;
|
||||
organisations: number;
|
||||
rules: number;
|
||||
solutions: number;
|
||||
events: number;
|
||||
notes: number;
|
||||
calls: number;
|
||||
capital: number;
|
||||
learn: number;
|
||||
bindingNow: number;
|
||||
}): NavGroup[] {
|
||||
return [
|
||||
{
|
||||
id: 'map',
|
||||
label: 'The map',
|
||||
blurb: 'Everything standing between here and faster technology, and who holds it.',
|
||||
items: [
|
||||
{
|
||||
label: 'World map',
|
||||
href: '/world',
|
||||
blurb: 'Every country: recorded policy, organisations, events and gaps.',
|
||||
},
|
||||
{
|
||||
label: 'Chain atlas',
|
||||
href: '/atlas',
|
||||
blurb: 'See the stages, bottlenecks, companies and evidence together.',
|
||||
},
|
||||
{
|
||||
label: 'Talent',
|
||||
href: '/talent',
|
||||
blurb: 'The expertise chains need, and how to contribute yours.',
|
||||
},
|
||||
{
|
||||
label: 'Bottlenecks',
|
||||
href: '/bottlenecks',
|
||||
blurb: 'What has to exist first, and how hard each one is holding things up.',
|
||||
badge: String(counts.bottlenecks),
|
||||
},
|
||||
{
|
||||
label: 'Markets',
|
||||
href: '/markets',
|
||||
blurb: 'The organisations that make the constrained things, and how replaceable each is.',
|
||||
badge: String(counts.organisations),
|
||||
},
|
||||
{
|
||||
label: 'Policy',
|
||||
href: '/policy',
|
||||
blurb: 'Rules that slow or speed building, and who publicly asked for them.',
|
||||
badge: String(counts.rules),
|
||||
},
|
||||
{
|
||||
label: 'Science',
|
||||
href: '/science',
|
||||
blurb: 'What would remove a bottleneck, and how far off it is.',
|
||||
badge: String(counts.solutions),
|
||||
},
|
||||
{
|
||||
label: 'Capital',
|
||||
href: '/capital',
|
||||
blurb: 'Who could fund relief — and where money is not the constraint.',
|
||||
badge: String(counts.capital),
|
||||
},
|
||||
],
|
||||
feature: {
|
||||
label: `${counts.bindingNow} binding right now`,
|
||||
href: '/bottlenecks?horizon=now',
|
||||
blurb: 'The constraints judged to be holding things up today, worst first.',
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'latest',
|
||||
label: 'Latest',
|
||||
blurb: 'What changed, and what we make of it.',
|
||||
items: [
|
||||
{
|
||||
label: 'Today',
|
||||
href: '/',
|
||||
blurb: 'The last thirty days in one screen.',
|
||||
},
|
||||
{
|
||||
label: 'Events',
|
||||
href: '/events',
|
||||
blurb: 'Every dated change to a bottleneck, with the sentence from its source.',
|
||||
badge: String(counts.events),
|
||||
},
|
||||
{
|
||||
label: 'Blog & notes',
|
||||
href: '/notes',
|
||||
blurb: 'Written pieces: what the map implies, and what we got wrong.',
|
||||
badge: String(counts.notes),
|
||||
},
|
||||
{
|
||||
label: 'Changelog',
|
||||
href: '/changelog',
|
||||
blurb: 'What shipped, from the canonical development record.',
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: 'about',
|
||||
label: 'About',
|
||||
blurb: 'How this is made, and what the words mean.',
|
||||
items: [
|
||||
{
|
||||
label: 'Roadmap & vision',
|
||||
href: '/development',
|
||||
blurb: 'Where Substrata is heading, and what is being built.',
|
||||
},
|
||||
{
|
||||
label: 'Data quality',
|
||||
href: '/data',
|
||||
blurb: 'Evidence, uncertainty, dates and reproducible exports.',
|
||||
},
|
||||
{
|
||||
label: 'Learn',
|
||||
href: '/learn',
|
||||
blurb: 'What the words mean and how to read the tables. No prior knowledge needed.',
|
||||
badge: String(counts.learn),
|
||||
},
|
||||
{
|
||||
label: 'What this is',
|
||||
href: '/about',
|
||||
blurb: 'The project, the method, and what it deliberately is not.',
|
||||
},
|
||||
{
|
||||
label: 'What we think',
|
||||
href: '/thesis',
|
||||
blurb: 'Six claims, each with what would show it is wrong.',
|
||||
},
|
||||
{
|
||||
label: 'Calls',
|
||||
href: '/calls',
|
||||
blurb: 'Dated predictions with what would settle them, scored in public.',
|
||||
badge: String(counts.calls),
|
||||
},
|
||||
{
|
||||
label: 'Open questions',
|
||||
href: '/research',
|
||||
blurb: 'The research programme: what we are trying to answer, and how.',
|
||||
},
|
||||
{
|
||||
label: 'Data and API',
|
||||
href: '/api/map',
|
||||
blurb: 'The whole map as JSON, for anyone building on it.',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
}
|
||||
/** Sidebar on /account and /review only. */
|
||||
export const DESK_NAV: readonly NavLink[] = [
|
||||
{ label: 'Desk', href: '/account' },
|
||||
{ label: 'Ask', href: '/chat' },
|
||||
{ label: 'Map', href: '/atlas' },
|
||||
{ label: 'News', href: '/events' },
|
||||
{ label: 'Inbox', href: '/review' },
|
||||
];
|
||||
|
||||
/** The action, kept out of the groups. */
|
||||
export const NAV_ACTION = {
|
||||
label: 'Join',
|
||||
href: '/join',
|
||||
blurb: 'Contribute what you know to an open research project.',
|
||||
} as const;
|
||||
/** Sparse footer. Not a sitemap. */
|
||||
export const FOOTER_NAV: readonly NavLink[] = [
|
||||
{ label: 'About', href: '/about' },
|
||||
{ label: 'Changelog', href: '/changelog' },
|
||||
{ label: 'Roadmap', href: '/roadmap' },
|
||||
];
|
||||
|
||||
/** Flat list of every internal path the navigation points at, for the route test. */
|
||||
export function navPaths(groups: NavGroup[]): string[] {
|
||||
return [
|
||||
...groups.flatMap((group) => [
|
||||
...group.items.map((item) => item.href),
|
||||
...(group.feature ? [group.feature.href] : []),
|
||||
]),
|
||||
NAV_ACTION.href,
|
||||
]
|
||||
.filter((href) => href.startsWith('/'))
|
||||
.map((href) => href.split(/[?#]/)[0]);
|
||||
export function navPaths(): string[] {
|
||||
return [...PUBLIC_NAV, ...DESK_NAV, ...FOOTER_NAV]
|
||||
.map((item) => item.href.split(/[?#]/)[0])
|
||||
.filter((href, i, all) => all.indexOf(href) === i);
|
||||
}
|
||||
+35
-42
@@ -1,67 +1,60 @@
|
||||
# Substrata implementation ledger
|
||||
|
||||
Started 2026-09-16. Status: beta, visual and desk work in flight on `feat/desk-map-theme`.
|
||||
Started 2026-09-16. Status: quiet-chrome in flight.
|
||||
|
||||
## What this site is for
|
||||
|
||||
A go-to research service on the physical chokepoints of faster technology.
|
||||
It should keep itself current, be checkable, and be a pleasure to read on a
|
||||
train. George reads it; the corpus and the assistant do the gathering.
|
||||
George reads it; the corpus and the assistant do the gathering. It should
|
||||
look and work like Loki/OrangeCat where they already solved a problem:
|
||||
OrangeCat OIDC, `@bitbaum/ai-kit` for answers and web reads, `listkit` for
|
||||
filters, `bip-kit` for notes. Markup stays in this repo.
|
||||
|
||||
## Canonical records
|
||||
## Chrome (first principle)
|
||||
|
||||
Roadmap and changelog are **Loki** (`goals` + `dev_log`), rendered at
|
||||
`/roadmap` and `/changelog`. Do not author a second copy in TypeScript.
|
||||
This file is the agent handoff, not the public roadmap.
|
||||
A reader is doing one of two jobs.
|
||||
|
||||
1. **Public** — read the research. SpaceX-thin bar: Map, News, Ask, search,
|
||||
account. Footer is legal + About / Changelog / Roadmap / Source. No
|
||||
sidebar. No megamenu. No sitemap.
|
||||
2. **Desk** (`/account`, `/review`) — operate. Sidebar from `DESK_NAV`. No
|
||||
public megamenu. No fat footer.
|
||||
|
||||
Header + footer + sidebar on the same page is a bug. Sidebar on the homepage
|
||||
is a bug.
|
||||
|
||||
Atlas and World are one map with two views (`/atlas`, `/atlas?view=world`).
|
||||
`/world` redirects. Geography and chain are projections of the same corpus.
|
||||
|
||||
## Do not reinvent
|
||||
|
||||
| Need | Already exists | Do not |
|
||||
| --- | --- | --- |
|
||||
| Auth for a studio app | OrangeCat OIDC, same contract as Solon/Heidi (`STACK.md`) | Extract an auth npm package. `SHARED.md`: auth/sessions must not be centralized. Markup is not shareable. |
|
||||
| Blog / changelog / roadmap rendering | `bip-kit` | A second markdown pipeline |
|
||||
| AI answers + page reader | `@bitbaum/ai-kit` | A second model client |
|
||||
| Auth | OrangeCat OIDC (`STACK.md`) | An auth npm package |
|
||||
| AI answers + page reader | `@bitbaum/ai-kit` (`lib/chat.ts`, `scripts/research/*`) | A second model client |
|
||||
| Filters | `listkit` | A second URL codec |
|
||||
| Site as data | `sitekit` | A second section schema |
|
||||
| Artist sites (Annushka, s-ink / sinktattoo) | Their own sites | Changelog, roadmap, vision. They are not tech products. Leftover Astra files were discarded 2026-09-16. |
|
||||
| Notes | `bip-kit` | A second markdown pipeline |
|
||||
| Nav lists | `config/site-nav.ts` | Hardcoded links in Shell |
|
||||
|
||||
The account **desk UI** stays in this repo. Share the OrangeCat OIDC *decision*,
|
||||
assert it locally. If a second studio app needs the same desk, extract
|
||||
behaviour then, not markup.
|
||||
## Gaps a stranger can fill
|
||||
|
||||
## Now building
|
||||
`Inquire` posts to `/api/contributions` (existing inbox, rate-limited, not
|
||||
published). Use it wherever a row is thin or empty. GitHub correction remains
|
||||
for sourced errors.
|
||||
|
||||
1. **Visible changelog** — header “Log”, homepage teaser, timeline layout. Was
|
||||
buried in Latest and looked like a single blob.
|
||||
2. **Desk** — Grok-like signed-in shell: left sidebar, avatar dropdown, saved
|
||||
technologies, news on those rails, Ask. OrangeCat sign-in, not a new IdP.
|
||||
3. **SpaceX-like visual system** — geometric sans, black/white, dark / light /
|
||||
auto (`prefers-color-scheme` + stored override). No serif journal look.
|
||||
4. **World map** — `/world`, every country, paint = recorded coverage. Policy,
|
||||
organisations, events, materials. EU rules colour member states.
|
||||
5. **Self-updating corpus** — dated events already are the newsfeed. Next:
|
||||
box timer for `pnpm research:sweep` (and later sourced promotion), so the
|
||||
map moves without a session. Do not auto-publish unsourced rows.
|
||||
## Self-updating
|
||||
|
||||
## Acceptance
|
||||
|
||||
- `/changelog` reachable in one click from the header on desktop and from the
|
||||
mobile menu.
|
||||
- Signed-out: avatar menu offers OrangeCat sign-in and theme.
|
||||
- Signed-in: sidebar + desk with followed technologies.
|
||||
- `/world` paints countries we have records for; a country with nothing says so.
|
||||
- Theme auto/dark/light survives reload without a flash.
|
||||
- Annushka and s-ink have no changelog/roadmap leftovers.
|
||||
Dated events are the newsfeed. Next: a box timer for `pnpm research:sweep`.
|
||||
Do not auto-publish unsourced rows.
|
||||
|
||||
## Work log
|
||||
|
||||
### 2026-09-16 (later)
|
||||
### 2026-09-16 (quiet chrome)
|
||||
|
||||
- Discarded uncommitted changelog/roadmap files on Annushka and s-ink.
|
||||
- Started `feat/desk-map-theme`: tokens, theme boot, avatar menu, desk
|
||||
sidebar, world map, changelog in the header, desk dashboard.
|
||||
- Auth stays OrangeCat OIDC. No new GitHub package.
|
||||
- Public nav is three links from `PUBLIC_NAV`. Desk sidebar only on account
|
||||
and review. Footer is four destinations, not a sitemap.
|
||||
- Map: Chain | World on `/atlas`. Inquire on thin bottleneck and country pages.
|
||||
|
||||
### 2026-09-16 (earlier)
|
||||
|
||||
See git history for PRs #43–#47 (atlas, accounts, coverage, visual chrome).
|
||||
PRs #43–#48: atlas, accounts, coverage, visual chrome, world map, desk, theme.
|
||||
@@ -138,6 +138,7 @@ export const ROUTES = [
|
||||
'/talent',
|
||||
'/chat',
|
||||
'/account',
|
||||
'/review',
|
||||
'/data',
|
||||
'/development',
|
||||
'/roadmap',
|
||||
|
||||
+6
-16
@@ -3,7 +3,7 @@ import assert from 'node:assert/strict';
|
||||
import { WORLD_PATHS } from '../config/world-paths';
|
||||
import { EU_MEMBERS, countryFacts } from '../lib/geo';
|
||||
import { ROUTES } from '../lib/links';
|
||||
import { navGroups } from '../config/site-nav';
|
||||
import { FOOTER_NAV, PUBLIC_NAV, navPaths } from '../config/site-nav';
|
||||
|
||||
test('the world atlas has ISO codes for the jurisdictions we actually record', () => {
|
||||
const iso = new Set(WORLD_PATHS.map((p) => p.iso2).filter(Boolean));
|
||||
@@ -33,20 +33,10 @@ test('country facts count real instruments onto China and the EU members', () =>
|
||||
assert.ok(facts.get('cn')?.hasRecord);
|
||||
});
|
||||
|
||||
test('the world map is a first-class route and a nav destination', () => {
|
||||
test('the map is the public geography destination, changelog lives in the footer', () => {
|
||||
assert.ok((ROUTES as readonly string[]).includes('/atlas'));
|
||||
assert.ok((ROUTES as readonly string[]).includes('/world'));
|
||||
const groups = navGroups({
|
||||
bottlenecks: 1,
|
||||
organisations: 1,
|
||||
rules: 1,
|
||||
solutions: 1,
|
||||
events: 1,
|
||||
notes: 1,
|
||||
calls: 1,
|
||||
capital: 1,
|
||||
learn: 1,
|
||||
bindingNow: 1,
|
||||
});
|
||||
assert.ok(groups.some((g) => g.items.some((i) => i.href === '/world')));
|
||||
assert.ok(groups.some((g) => g.items.some((i) => i.href === '/changelog')));
|
||||
assert.ok(PUBLIC_NAV.some((item) => item.href === '/atlas'));
|
||||
assert.ok(FOOTER_NAV.some((item) => item.href === '/changelog'));
|
||||
assert.ok(navPaths().includes('/atlas'));
|
||||
});
|
||||
+2
-14
@@ -29,7 +29,7 @@ import {
|
||||
hasPolicyPage,
|
||||
} from '../config/substrata-policy';
|
||||
import { SCIENCE } from '../config/substrata-science';
|
||||
import { navGroups, navPaths } from '../config/site-nav';
|
||||
import { navPaths } from '../config/site-nav';
|
||||
import { sitePages } from '../config/site-content';
|
||||
import { BOTTLENECKS } from '../lib/bottlenecks';
|
||||
import {
|
||||
@@ -144,20 +144,8 @@ test('every link the data can generate resolves to a page that exists', () => {
|
||||
});
|
||||
|
||||
test('every navigation destination resolves, including the new sections', () => {
|
||||
const groups = navGroups({
|
||||
bottlenecks: 1,
|
||||
organisations: 1,
|
||||
rules: 1,
|
||||
solutions: 1,
|
||||
events: 1,
|
||||
notes: 1,
|
||||
calls: 1,
|
||||
capital: 1,
|
||||
learn: 1,
|
||||
bindingNow: 1,
|
||||
});
|
||||
const documents = new Set(sitePages().map((p) => `/${p.path}`));
|
||||
for (const href of navPaths(groups)) {
|
||||
for (const href of navPaths()) {
|
||||
if (documents.has(href)) continue;
|
||||
const problem = resolves(href);
|
||||
assert.equal(problem, null, `navigation: ${href} — ${problem}`);
|
||||
|
||||
+3
-37
@@ -21,7 +21,7 @@ import {
|
||||
} from '../config/substrata-taxonomy';
|
||||
import { BOTTLENECKS } from '../lib/bottlenecks';
|
||||
import { MARKET_PARTICIPANTS, marketTotals, participantBySlug } from '../lib/participants';
|
||||
import { navGroups, navPaths } from '../config/site-nav';
|
||||
import { navPaths } from '../config/site-nav';
|
||||
import { sitePages } from '../config/site-content';
|
||||
|
||||
const UNIVERSE = new Set<string>([
|
||||
@@ -160,45 +160,11 @@ test('every science entry relieves a real bottleneck and sits on the scale', ()
|
||||
|
||||
test('every navigation entry resolves to a route that exists', () => {
|
||||
const documents = new Set(sitePages().map((p) => p.path));
|
||||
const routes = new Set([
|
||||
'',
|
||||
'bottlenecks',
|
||||
'markets',
|
||||
'policy',
|
||||
'science',
|
||||
'research',
|
||||
'events',
|
||||
'notes',
|
||||
'join',
|
||||
'calls',
|
||||
'capital',
|
||||
'learn',
|
||||
'api/map',
|
||||
]);
|
||||
const groups = navGroups({
|
||||
bottlenecks: 1,
|
||||
organisations: 1,
|
||||
rules: 1,
|
||||
solutions: 1,
|
||||
events: 1,
|
||||
notes: 1,
|
||||
calls: 1,
|
||||
capital: 1,
|
||||
learn: 1,
|
||||
bindingNow: 1,
|
||||
});
|
||||
for (const href of navPaths(groups)) {
|
||||
for (const href of navPaths()) {
|
||||
const path = href.replace(/^\//, '');
|
||||
assert.ok(
|
||||
documents.has(path) || routes.has(path) || existsSync(`app/${path}/page.tsx`),
|
||||
documents.has(path) || existsSync(`app/${path}/page.tsx`),
|
||||
`navigation points at a missing route: ${href}`,
|
||||
);
|
||||
}
|
||||
// Every group and item has a blurb: the menu explains itself or it is not a menu.
|
||||
for (const group of groups) {
|
||||
assert.ok(group.blurb.length > 20, `${group.id}: no blurb`);
|
||||
for (const item of group.items) {
|
||||
assert.ok(item.blurb.length > 20, `${group.id}/${item.label}: no blurb`);
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user