Files
zeekayandHanzo Dev a8808086f4 hanzo.build's shell is the library's default: the rail, a centred home, settings and catalogue pages
SessionRail draws its head in flow: the brand, which starts a new session,
over a bordered Search box, so a host no longer lays an overlay across the
rail and pads the rows down 92px. The account row reads name over org and
opens the account menu anchored to itself, above it on the open rail and
beside it on the collapsed one. The foot's Settings and Search icons are gone:
search is the head's, settings is a row of the menu. RailNotice is the
offer card over the account, RailBar the phone's header (menu, brand,
search), and every press in the drawer that leads somewhere closes it.

Home is a fresh pane: the mark and the question centred at $8, the composer
under them in one column.

@hanzo/ui/settings is a settings page — a 220px grouped nav from md up, a chip
row below it, a 760 column — and the parts every section is drawn from.
@hanzo/ui/catalog is a catalogue page — kinds as a tablist, Yours/Discover on
the one segmented control, one search and one Add — and its cards on the one
grid. It is its own subpath because that grid is a div: web-only, which the
product layer does not promise.

Every piece is in the gallery, documented under chat, settings and catalog,
unit-tested with axe, and measured by the consumer gate at 390 and 1280 in
both themes.

Co-authored-by: Hanzo Dev <[email protected]>
2026-09-27 15:08:56 -07:00

104 lines
3.9 KiB
TypeScript

import { useState } from 'react'
import { XStack, YStack } from '@hanzo/gui'
import { Box, Gauge, LifeBuoy, Settings, Slack, Wrench } from '@hanzogui/lucide-icons-2'
import { RailBar, RailNotice, SessionRail, type RailAccount, type RailSession } from '@hanzo/ui/chat'
const RECENTS: RailSession[] = [
{ id: 's1', title: 'Rolling update and bootstrap CD', status: 'running' },
{ id: 's2', title: 'Reset to 2025 version', status: 'done' },
{ id: 's3', title: 'fix all unfixed bugs, add tests', status: 'error' },
{ id: 's4', title: 'Enterprise/OSS feature audit', status: 'idle' },
]
/** The account, and its menu: who, the organization as a choice, the account's places, and signing out. */
function account(org: string, setOrg: (o: string) => void): RailAccount {
return {
name: 'Dave',
sub: org,
email: '[email protected]',
groups: [
{
label: 'Organization',
items: ['acme', 'zoo'].map((o) => ({ id: o, label: o, active: o === org, onPress: () => setOrg(o) })),
},
[
{ id: 'settings', label: 'Settings', icon: <Settings size={16} />, onPress: () => {} },
{ id: 'usage', label: 'Usage', icon: <Gauge size={16} />, onPress: () => {} },
{ id: 'help', label: 'Get help', icon: <LifeBuoy size={16} />, onPress: () => {} },
],
],
onSignOut: () => {},
signOutLabel: 'Log out',
}
}
/** The rail — the name and a search at the head, New, the surface's places, the recents with their status, a notice, and the account with its menu. Collapse is an explicit toggle the host keeps. */
export function Default() {
const [active, setActive] = useState<string | null>(null)
const [collapsed, setCollapsed] = useState(false)
const [org, setOrg] = useState('acme')
const [slack, setSlack] = useState(true)
return (
<XStack height={560}>
<SessionRail
brand="Hanzo Build"
onSearch={() => {}}
searchLabel="Search runs"
onNew={() => setActive(null)}
fresh={active === null}
links={[
{ id: 'artifacts', label: 'Artifacts', icon: <Box size={16} /> },
{ id: 'customize', label: 'Customize', icon: <Wrench size={16} /> },
]}
more={[{ id: 'projects', label: 'Projects', icon: <Box size={16} /> }]}
recents={RECENTS}
active={active}
onOpen={setActive}
onSort={() => {}}
notice={
slack ? (
<RailNotice icon={<Slack size={16} />} title="Try Hanzo in Slack" action="Set up" onAction={() => {}} onDismiss={() => setSlack(false)} />
) : undefined
}
account={account(org, setOrg)}
collapsed={collapsed}
onCollapse={setCollapsed}
label="Runs"
/>
</XStack>
)
}
/** On a phone — narrow the window below md: the column goes, the bar over the pane opens the same rail as a drawer (menu, name, search), and anything chosen in the drawer closes it. */
export function Phone() {
const [open, setOpen] = useState(false)
const [active, setActive] = useState<string | null>(null)
return (
<YStack width={390} height={560} borderWidth={1} borderColor="$borderColor">
<RailBar onMenu={() => setOpen(true)} menuLabel="Open runs" brand="Hanzo Build" onBrand={() => setActive(null)} onSearch={() => {}} searchLabel="Search runs" />
<SessionRail
brand="Hanzo Build"
onSearch={() => {}}
onNew={() => setActive(null)}
fresh={active === null}
recents={RECENTS}
active={active}
onOpen={setActive}
account={{ name: 'Sign in', onPress: () => {} }}
open={open}
onOpenChange={setOpen}
label="Runs"
/>
</YStack>
)
}
/** A notice — an offer, its one action, and a way to put it away. The host remembers the dismissal. */
export function Notice() {
return (
<YStack width={256}>
<RailNotice icon={<Slack size={16} />} title="Try Hanzo in Slack" action="Set up" onAction={() => {}} onDismiss={() => {}} />
</YStack>
)
}