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
25 changes: 13 additions & 12 deletions app/components/AppShell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { getActiveParent, NAV_ITEMS, NavChild, NavIcon } from '../navigation';
import { BLUE, BORDER, DISABLED, INK, MUTED, SELECTED } from '../theme';
import { spectrum } from '../spectrum';
import { getChangeBySlug } from '../upgrades/data/changes';
import { demoLabel } from '../demos/catalogue';
import { getUpgradeById } from '../upgrades/data/upgrades';
import { titleForPath } from '../navigation';

Expand Down Expand Up @@ -508,7 +509,7 @@ function GlobalBanner({ dismissed, onDismiss, className }: GlobalBannerProps) {
<Text as="span" variant="label.medium">New!</Text>
<Text as="span" variant="label.medium">EIP-8130: Native Account Abstraction</Text>
<span className="inline-block h-3.5 w-px bg-bds-gray-20"></span>
<Link href="/vibenet/demos/account" className="group flex items-center gap-1 no-underline">
<Link href="/demos/account" className="group flex items-center gap-1 no-underline">
<Text as="span" variant="label.medium" className="text-base-blue">Test on Vibenet</Text>
<AnimatedArrowIcon size={14} strokeWidth={2} className="text-base-blue transition-transform duration-200 ease-out group-hover:translate-x-[3px]" />
</Link>
Expand Down Expand Up @@ -630,20 +631,20 @@ export function AppShell({ children }: PropsWithChildren) {
/>
);
}
const demoMatch = pathname.match(/^\/demos\/(.+)$/);
if (demoMatch) {
const slug = demoMatch[1].split('/')[0];
return (
<Breadcrumb
parentLabel="Demos"
parentHref="/demos"
childLabel={demoLabel(slug)}
/>
);
}
if (pathname.startsWith('/vibenet') && pathname !== '/vibenet') {
let childLabel = title;
let middle: { label: string; href: string } | undefined;
const demosMatch = pathname.match(/^\/vibenet\/demos(?:\/(.+))?$/);
if (demosMatch) {
if (!demosMatch[1]) {
childLabel = 'Demos';
} else {
middle = { label: 'Demos', href: '/vibenet/demos' };
const segments = demosMatch[1].split('/');
const first = segments[0];
childLabel = first.charAt(0).toUpperCase() + first.slice(1);
}
}
const explorerDetailMatch = pathname.match(/^\/vibenet\/explorer\/(tx|block|address)\/(.+)$/);
if (explorerDetailMatch) {
middle = { label: 'Explorer', href: '/vibenet/explorer' };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { useCallback, useEffect, useRef, useState } from 'react';
import { animate, motion, useMotionValue, useTransform } from 'motion/react';

import { cn } from '../../../components/ui/cn';
import { cn } from '../../components/ui/cn';

type AnimatedAmountProps = {
text: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ReactNode } from 'react';

import { Text } from '../../../components/ui/Text';
import { Text } from '../../components/ui/Text';

type DemoHeaderProps = {
eyebrow?: string;
Expand All @@ -10,7 +10,9 @@ type DemoHeaderProps = {
};

export function DemoHeader({
eyebrow = 'Base Vibenet · Demo',
// Network-neutral default: demos run on whichever test network carries the
// feature they show. A demo names its own network by passing `eyebrow`.
eyebrow = 'Base · Demo',
title,
description,
actions,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { motion } from 'motion/react';

import { cn } from '../../../components/ui/cn';
import { cn } from '../../components/ui/cn';

export type DemoTabItem = {
value: string;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,19 @@ import Link from 'next/link';
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import { AnimatePresence, motion } from 'motion/react';

import { Button } from '../../../components/ui/Button';
import { Card } from '../../../components/ui/Card';
import { cn } from '../../../components/ui/cn';
import { AnimatedArrowIcon, CloseIcon } from '../../../components/ui/icons';
import { Modal } from '../../../components/ui/Modal';
import { Select } from '../../../components/ui/Select';
import { Text } from '../../../components/ui/Text';
import { Button } from '../../components/ui/Button';
import { Card } from '../../components/ui/Card';
import { cn } from '../../components/ui/cn';
import { AnimatedArrowIcon, CloseIcon } from '../../components/ui/icons';
import { Modal } from '../../components/ui/Modal';
import { Select } from '../../components/ui/Select';
import { Text } from '../../components/ui/Text';
import { toast } from 'sonner';
import { vibenetApi } from '../../library/client';
import { ACCOUNT_RPC_URL, VIBENET_EXPLORER_PATH } from '../../library/config';
import { vibenetApi } from '../../vibenet/library/client';
import { ACCOUNT_RPC_URL, VIBENET_EXPLORER_PATH } from '../../vibenet/library/config';
import { AnimatedAmount } from '../_components/AnimatedAmount';
import { DemoHeader } from '../_components/DemoHeader';
import { Spinner } from '../../../components/ui/Spinner';
import { Tabs } from '../../../components/ui/Tabs';
import { Spinner } from '../../components/ui/Spinner';
import { Tabs } from '../../components/ui/Tabs';
import { Stat } from '../_components/Stat';
import { ActivityLog } from './components/ActivityLog';
import { AppsView } from './components/AppsView';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import Link from 'next/link';
import { useEffect, useRef, useState } from 'react';
import { motion, useReducedMotion } from 'motion/react';

import { Button } from '../../../../components/ui/Button';
import { cn } from '../../../../components/ui/cn';
import { Text } from '../../../../components/ui/Text';
import { VIBENET_EXPLORER_PATH } from '../../../library/config';
import { Button } from '../../../components/ui/Button';
import { cn } from '../../../components/ui/cn';
import { Text } from '../../../components/ui/Text';
import { VIBENET_EXPLORER_PATH } from '../../../vibenet/library/config';
import { type ActivityEntry, type StoredAccount, formatTime } from '../library/model';
import { short } from '../shared';
import { AccountIdentity, Badge } from './primitives';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use client';

import { Button } from '../../../../components/ui/Button';
import { Card } from '../../../../components/ui/Card';
import { cn } from '../../../../components/ui/cn';
import { Text } from '../../../../components/ui/Text';
import { Button } from '../../../components/ui/Button';
import { Card } from '../../../components/ui/Card';
import { cn } from '../../../components/ui/cn';
import { Text } from '../../../components/ui/Text';
import type { DemoApp } from '../library/apps';
import type { DemoChain } from '../library/chains';
import { formatExpiry, type AppSessionKey, type AppSubAccount, type StoredAccount } from '../library/model';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import type { Address, Hex } from '@aa';
import Link from 'next/link';
import { AnimatePresence, motion } from 'motion/react';

import { Button } from '../../../../components/ui/Button';
import { Card } from '../../../../components/ui/Card';
import { cn } from '../../../../components/ui/cn';
import { CloseIcon } from '../../../../components/ui/icons';
import { Spinner } from '../../../../components/ui/Spinner';
import { Select } from '../../../../components/ui/Select';
import { Text } from '../../../../components/ui/Text';
import { VIBENET_EXPLORER_PATH } from '../../../library/config';
import { Button } from '../../../components/ui/Button';
import { Card } from '../../../components/ui/Card';
import { cn } from '../../../components/ui/cn';
import { CloseIcon } from '../../../components/ui/icons';
import { Spinner } from '../../../components/ui/Spinner';
import { Select } from '../../../components/ui/Select';
import { Text } from '../../../components/ui/Text';
import { VIBENET_EXPLORER_PATH } from '../../../vibenet/library/config';
import { AnimatedAmount } from '../../_components/AnimatedAmount';
import {
DEMO_CHAINS,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { ReactNode } from 'react';
import { AnimatePresence, motion } from 'motion/react';

import { cn } from '../../../../components/ui/cn';
import { Text } from '../../../../components/ui/Text';
import { cn } from '../../../components/ui/cn';
import { Text } from '../../../components/ui/Text';
import type { SignerKind } from '../library/model';
import { KIND_LABEL, short } from '../shared';

Expand Down
30 changes: 30 additions & 0 deletions app/demos/account/layout.tsx

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're making these changes, should we change the title to be 'EIP-8130 · Demos' to match the format of how the other subpages do their titles?

Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import type { Metadata } from 'next';
import type { ReactNode } from 'react';

import { MaintenanceBanner } from '../../vibenet/components/MaintenanceBanner';

// The account demo page is a client component; this passthrough layout carries
// its title/description.
//
// Title convention: a section root is "{Section} · Base Chain" and a page within
// a section is "{Page} · {Section}" — e.g. "Faucet · Vibenet". Spelled out in
// full rather than composed from a parent title.template, because the llms/agents
// generator resolves a template to its `default` and would publish the bare page
// title, disagreeing with what the browser renders.
export const metadata: Metadata = {
title: 'Native Account Abstraction · Demos',
description:
'Create native account abstraction accounts from in-browser keys, fund them from the faucet, and inspect balances on Vibenet.',
};

// This demo runs on Vibenet, so it carries Vibenet's maintenance notice — the
// demo is unusable while the devnet is down. Scoped here rather than to the
// /demos section, since other demos may run on other test networks.
export default function AccountDemoLayout({ children }: { children: ReactNode }) {
return (
<>
<MaintenanceBanner />
{children}
</>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
vibenetDevnetDeployment,
} from "@aa";

import { isAddress } from "../../../library/format";
import { isAddress } from "../../../vibenet/library/format";

/**
* Last-known-good vibenet EIP-8130 system contracts — a STATIC FALLBACK only.
Expand Down Expand Up @@ -94,7 +94,7 @@ export function deploymentFromContracts(
import {
ACCOUNT_BUNDLER_URL,
ACCOUNT_PAYER_URL,
} from "../../../library/config";
} from "../../../vibenet/library/config";

/**
* How EIP-8130 accounts execute on a given chain:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
parseUnits,
} from '@aa';

import { vibenetApi } from '../../../library/client';
import { vibenetApi } from '../../../vibenet/library/client';
import { BASE_SEPOLIA_USDC } from './chains';
import { SCOPE, scopeChips } from './model';
import { short } from '../shared';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Skeleton } from '../../../components/ui/Skeleton';
import { Skeleton } from '../../components/ui/Skeleton';

export default function Loading() {
return (
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import type { Address, Hex } from '@aa';

import type { AccountBalancesResponse } from '../../library/api-types';
import type { AccountBalancesResponse } from '../../vibenet/library/api-types';
import type { ActivityEntry, SignerKind, StoredAccount } from './library/model';

/** An in-browser signer key held in the demo wallet. */
Expand Down
44 changes: 44 additions & 0 deletions app/demos/catalogue.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { describe, expect, it } from 'vitest';

import { DEMOS, demoLabel } from './catalogue';

describe('demoLabel', () => {
it('uses the catalogue entry so the crumb matches the demo name', () => {
expect(demoLabel('account')).toBe('Account');
});

it('prefers shortTitle over title when both are set', () => {
const account = DEMOS.find((d) => d.href === '/demos/account');
expect(account?.title).toBe('Native Account Abstraction');
expect(demoLabel('account')).toBe(account?.shortTitle);
});

it('title-cases a multi-word slug that has no catalogue entry', () => {
// The regression this guards: the previous implementation only uppercased
// the first character, rendering "smart-wallet" as "Smart-wallet".
expect(demoLabel('smart-wallet')).toBe('Smart Wallet');
expect(demoLabel('paymaster-v2')).toBe('Paymaster V2');
});

it('handles a single-word unknown slug', () => {
expect(demoLabel('bridge')).toBe('Bridge');
});

it('does not emit stray spaces for awkward slugs', () => {
expect(demoLabel('a--b')).toBe('A B');
expect(demoLabel('-lead')).toBe('Lead');
});
});

describe('DEMOS', () => {
it('gives every entry a /demos/ href, so demoLabel can resolve it', () => {
for (const demo of DEMOS) {
expect(demo.href.startsWith('/demos/')).toBe(true);
}
});

it('has no duplicate hrefs', () => {
const hrefs = DEMOS.map((d) => d.href);
expect(new Set(hrefs).size).toBe(hrefs.length);
});
});
58 changes: 58 additions & 0 deletions app/demos/catalogue.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// The demo catalogue — one place to register a demo. The index page renders
// cards from it and the breadcrumb resolves its label from it, so the two can't
// drift. Plain data with no server-only imports, so client components (AppShell)
// can read it too.

export type DemoEntry = {
/** Route for the demo, e.g. `/demos/account`. */
href: string;
/** Short tag shown beside the title on the card, usually the spec or network. */
eyebrow: string;
/**
* Full name of the demo. Also the page title, which by convention reads
* `{title} · Demos` — set it in the demo's own layout metadata, since this
* catalogue is data and does not drive `<head>`.
*/
title: string;
/** Compact label for the breadcrumb; falls back to `title` when unset. */
shortTitle?: string;
summary: string;
points: string[];
available: boolean;
};

export const DEMOS: DemoEntry[] = [
{
href: '/demos/account',
eyebrow: 'EIP-8130',
title: 'Native Account Abstraction',
shortTitle: 'Account',
summary:
'Create portable account-abstraction accounts from in-browser keys, fund them from the faucet, and inspect balances across networks.',
points: [
'Smart & EOA accounts — deterministic addresses',
'K1 / P-256 / passkey signers',
'Live balances on Vibenet + Base Sepolia',
],
available: true,
},
];

/** `smart-wallet` -> `Smart Wallet`. Fallback for a route with no catalogue entry. */
function prettifySlug(slug: string): string {
return slug
.split('-')
.filter(Boolean)
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
.join(' ');
}

/**
* Breadcrumb label for the first path segment under /demos. Prefers the
* catalogue so the crumb matches the demo's real name, and degrades to a
* title-cased slug for anything not registered.
*/
export function demoLabel(slug: string): string {
const demo = DEMOS.find((entry) => entry.href === `/demos/${slug}`);
return demo?.shortTitle ?? demo?.title ?? prettifySlug(slug);
}
18 changes: 18 additions & 0 deletions app/demos/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { ReactNode } from 'react';

// Metadata lives on the routes themselves: app/demos/page.tsx for the index and
// app/demos/account/layout.tsx for the demo.

type DemosLayoutProps = {
children: ReactNode;
};

// Section chrome only. Demos run on whichever test network carries the feature
// they show, so nothing network-specific belongs here — a demo that depends on
// a particular network owns that concern (see app/demos/account/layout.tsx,
// which carries Vibenet's maintenance notice).
export default function DemosLayout({ children }: DemosLayoutProps) {
return (
<div className="mx-auto flex w-full max-w-5xl flex-1 flex-col">{children}</div>
);
}
2 changes: 1 addition & 1 deletion app/vibenet/demos/loading.tsx → app/demos/loading.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Skeleton } from '../../components/ui/Skeleton';
import { Skeleton } from '../components/ui/Skeleton';

export default function DemosLoading() {
return (
Expand Down
Loading
Loading