-
Notifications
You must be signed in to change notification settings - Fork 8
refactor(demos): promote the account demo to a top-level /demos section #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2a02f86
refactor(demos): promote the account demo to a top-level /demos section
montycheese 4d96e35
chore(demos): regenerate agent index for the /demos routes
montycheese 735a509
refactor(demos): make the section network-neutral
montycheese 9294110
chore(demos): regenerate agent index for the network-neutral description
montycheese f0706b8
refactor(demos): resolve breadcrumb labels from a shared demo catalogue
montycheese 496cdd6
fix(metadata): follow the {Page} · {Section} title convention
montycheese ddfeaaf
chore: regenerate agent index for the corrected page titles
montycheese File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 4 additions & 4 deletions
8
...net/demos/account/components/AppsView.tsx → app/demos/account/components/AppsView.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...t/demos/account/components/primitives.tsx → app/demos/account/components/primitives.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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} | ||
| </> | ||
| ); | ||
| } |
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
app/vibenet/demos/account/loading.tsx → app/demos/account/loading.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?