({ lang, env })
| 6 | env?: Record<string, any>; |
| 7 | }; |
| 8 | |
| 9 | /** |
| 10 | * The stack's environment, rendered as what it actually is: a config file. |
| 11 | * |
| 12 | * Was a `<dl>` with a floated `<dt>` and a fixed 18em column. Now composed |
| 13 | * from MockIDE's parts — the window chrome and the syntax-coloured body — but |
| 14 | * *not* `MockIDE.Body`, which types its content one `setTimeout` per |
| 15 | * character. That is right for a five-line marketing mock and wrong for forty |
| 16 | * environment variables, so the real content is rendered directly into the |
| 17 | * body element the library already styles. |
| 18 | * |
| 19 | * No disclosure wrapper: the page gives this its own section heading, and a |
| 20 | * `<details>` under a heading is a second click for something the heading has |
| 21 | * already promised. |
| 22 | */ |
| 23 | const EnvironmentVars: React.FC<EnvironmentVarsProps> = ({ lang, env }) => { |
| 24 | const t = useTranslations(lang); |
| 25 | const entries = Object.entries(env ?? {}); |
| 26 | |
| 27 | if (entries.length === 0) { |
| 28 | return ( |
| 29 | <p |
| 30 | className="subtle" |
| 31 | dangerouslySetInnerHTML={{ |
| 32 | __html: t("No environment variables defined."), |
| 33 | }} |
| 34 | /> |
| 35 | ); |
| 36 | } |
| 37 | |
| 38 | return ( |
| 39 | <MockIDE> |
| 40 | <MockIDE.Chrome filename=".env" thinking={false} /> |
| 41 | <pre className="pui-ide__body max-h-96 overflow-y-auto"> |
| 42 | {entries.map(([key, value]) => ( |
| 43 | <span key={key}> |
| 44 | <span className="pui-tok-key">{key}</span> |
nothing calls this directly
no test coverage detected