uimaxxer

Captain sidebar

A sidebar for one Captain that runs swarms. The questions that need you sit on top as a deck; answer one in place and your answer flies into its mission.

npx shadcn@latest add https://uimaxxer.com/r/captain-sidebar.json

Usage

import { CaptainSidebar } from "@/components/ui/captain-sidebar"

<CaptainSidebar
  captain={captain}
  missions={missions}
  queue={queue}
  budget={{ spent: 8.4, cap: 50 }}
  onResolve={(item, answer) => captain.answer(item.id, answer)}
/>

Props

PropTypeDefaultWhat it does
captain{ state, line?, since?, name? }The Captain's state and the one line it is saying.
missionsMission[]Swarms with their agents. Each mission's agents show as a tray of cells.
queueQueueItem[]Questions, approvals and conflicts waiting on you, dealt as a deck.
onResolve(item, answer) => voidRuns once the answer has landed in its mission, 260 ms after the tap.
historyHistoryItem[]Finished missions, folded by default.
budget{ spent, cap }Spend against the cap, with a menu to change the cap.
autonomy"ask" | "risk" | "full"How much the Captain may do without you.
selectedstring'captain', a mission id or a history id; that row is raised.
layout"auto" | "panel" | "rail" | "sheet""auto"A panel, the 56 px rail, or a bottom sheet on phones.
onMissionAction(id, action) => voidPause, resume, stop or add agents.

Keyboard

⌘J
Open the Captain
⌘K
Search
⌘\
Collapse
↑ ↓
Move between rows
← →
Fold a mission

Accessibility

  • A nav landmark with labelled sections; every row is a real button.
  • Arrow keys move through rows, Left and Right fold missions, and the deck's next card is a button.
  • A polite live region says what changed: new questions, finished missions, the Captain's state.
  • Swarms over 30 agents render only the rows in view.