Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,27 @@ jobs:
npx --no-install nirium-verify-evm "$GITHUB_WORKSPACE/base/fixtures/payai-ok.json" --no-sig | tail -1 | grep -q "RESULT: VALID"
if tar -tzf "$RUNNER_TEMP"/nirium-base-*.tgz | grep -E -i "test|example|evidence|fixture|market|demo"; then echo "unexpected files in the package"; exit 1; fi

demo:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24
- name: Install (the demo uses the package from ../../base, this commit's code)
run: |
(cd base && npm ci --no-audit --no-fund)
(cd apps/demo && npm ci --no-audit --no-fund)
- name: Explorer logic, the CID path and the drawing (14 tests, no network)
working-directory: apps/demo
run: npm test
- name: Build (type check and browser bundle)
working-directory: apps/demo
env:
NEXT_TELEMETRY_DISABLED: "1"
run: npx next build

market-image:
runs-on: ubuntu-latest
timeout-minutes: 15
Expand Down
4 changes: 4 additions & 0 deletions apps/demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
.next/
next-env.d.ts
*.tsbuildinfo
19 changes: 19 additions & 0 deletions apps/demo/app/Logo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// The Nirium N, from nirium.xyz/branding-nirium/svg/icon.svg (one stroke, three dots for payment,
// audit and agent rails). Gold on nirium.xyz; here in Base blue, from light to dark. Decorative here: the link around it carries the name.
export function Logo() {
return (
<svg viewBox="0 0 100 100" aria-hidden="true" focusable="false">
<defs>
<linearGradient id="chainColor" x1="0" y1="0" x2="100" y2="100" gradientUnits="userSpaceOnUse">
<stop offset="0" stopColor="#4C8DFF" />
<stop offset="0.5" stopColor="#0052FF" />
<stop offset="1" stopColor="#003ECB" />
</linearGradient>
</defs>
<path d="M25,85 L25,15 L75,85 L75,15" fill="none" stroke="url(#chainColor)" strokeWidth="14" strokeLinecap="round" strokeLinejoin="round" />
<circle cx="25" cy="15" r="7" fill="var(--dot)" />
<circle cx="50" cy="50" r="7" fill="var(--dot)" />
<circle cx="75" cy="85" r="7" fill="var(--dot)" />
</svg>
);
}
62 changes: 62 additions & 0 deletions apps/demo/app/Prefs.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
"use client";
// Language and theme, kept in the visitor's own localStorage (never sent anywhere), and the chrome
// every page shares: the status bar, the header with the N, and the footer.
import { createContext, useContext, useEffect, useState } from "react";
import Link from "next/link";
import { STRINGS, type Lang, type Strings } from "@/lib/i18n.ts";
import { Logo } from "./Logo";

type Theme = "light" | "dark";
const Ctx = createContext<{ lang: Lang; t: Strings }>({ lang: "en", t: STRINGS.en });
export const usePrefs = () => useContext(Ctx);

export function Prefs({ children }: { children: React.ReactNode }) {
const [lang, setLang] = useState<Lang>("en");
const [theme, setTheme] = useState<Theme>("dark");
useEffect(() => {
const l = localStorage.getItem("nirium-demo-lang");
setLang(l === "es" || l === "en" ? l : navigator.language.startsWith("es") ? "es" : "en");
setTheme(document.documentElement.dataset.theme === "light" ? "light" : "dark");
}, []);
useEffect(() => { document.documentElement.lang = lang; }, [lang]);
const pickLang = (l: Lang) => { setLang(l); localStorage.setItem("nirium-demo-lang", l); };
const pickTheme = (th: Theme) => { setTheme(th); document.documentElement.dataset.theme = th; localStorage.setItem("nirium-demo-theme", th); };
const t = STRINGS[lang];
const facts: [string, string][] = [
[t.status.checks, t.status.checksValue],
[t.status.stored, t.status.storedValue],
[t.status.networks, "Base Sepolia · Base mainnet"],
[t.status.library, t.status.libraryValue],
];
return (
<Ctx.Provider value={{ lang, t }}>
<a className="sr" href="#main">{t.skip}</a>
<dl className="status" aria-label={t.status.label}>
<div><span className="dot" aria-hidden="true" /><dt>{t.status.demo}</dt><dd>{t.status.demoValue}</dd></div>
{facts.map(([k, v]) => <div key={k}><dt>{k}</dt><dd>{v}</dd></div>)}
</dl>
<header className="bar">
<Link className="brand" href="/">
<Logo /><b>NIRIUM</b> <span className="chip">Base</span><span className="sr">, {t.home}</span>
</Link>
<div className="toggles">
<a className="allchains" href="https://nirium.xyz/chains">{t.allChains}</a>
<div role="group" aria-label={t.langLabel}>
{(["en", "es"] as const).map((l) => (
<button key={l} type="button" lang={l} aria-pressed={lang === l} onClick={() => pickLang(l)}>{l.toUpperCase()}</button>
))}
</div>
<button type="button" className="theme" aria-label={theme === "dark" ? t.toLight : t.toDark} title={theme === "dark" ? t.toLight : t.toDark} onClick={() => pickTheme(theme === "dark" ? "light" : "dark")}>
<svg viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round">
{theme === "dark"
? <><circle cx="12" cy="12" r="4" /><path d="M12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M4.9 19.1l1.4-1.4M17.7 6.3l1.4-1.4" /></>
: <path d="M21 12.8A9 9 0 1 1 11.2 3a7 7 0 0 0 9.8 9.8z" />}
</svg>
</button>
</div>
</header>
<div id="main">{children}</div>
<footer className="foot">{t.footer}</footer>
</Ctx.Provider>
);
}
Loading