Code sits second in the rail and on a phone's tab bar: for members who have it, it is the everyday mode
3 files+12−110/3 viewed
| 108 | 108 | type Tab = { key: string; label: string; to: string; icon: ReactNode; badge?: { count: number; loud: boolean } }; | |
| 109 | 109 | ||
| 110 | 110 | /** | |
| 111 | − | * The tab bar along the bottom of a phone: Home, Chat, Agents, Code (Docs, | |
| 112 | − | * for a member without Code) and the Inbox, each with what is unread. It | |
| 111 | + | * The tab bar along the bottom of a phone: Home, Code (Docs, for a member | |
| 112 | + | * without Code), Chat, Agents and the Inbox, each with what is unread. It | |
| 113 | 113 | * steps aside while the keyboard is up and inside a conversation. | |
| 114 | 114 | */ | |
| 115 | 115 | export function MobileTabBar({ workspace, unread }: { workspace: Membership; unread: { inbox: number; chat: number; mentions: number } }) { | |
| ⋯ | |||
| 119 | 119 | const mode = modeOf(pathname, slug); | |
| 120 | 120 | const tabs: Tab[] = [ | |
| 121 | 121 | { key: "home", label: "Home", to: `/${slug}/-/home`, icon: <House size={21} /> }, | |
| 122 | + | code | |
| 123 | + | ? { key: "code", label: "Code", to: `/${slug}/-/projects`, icon: <Code2 size={21} /> } | |
| 124 | + | : { key: "docs", label: "Docs", to: `/${slug}/-/docs`, icon: <BookOpen size={21} /> }, | |
| 122 | 125 | { | |
| 123 | 126 | key: "chat", | |
| 124 | 127 | label: "Chat", | |
| ⋯ | |||
| 127 | 130 | badge: { count: unread.mentions > 0 ? unread.mentions : unread.chat, loud: unread.mentions > 0 }, | |
| 128 | 131 | }, | |
| 129 | 132 | { key: "agents", label: "Agents", to: `/${slug}/-/agents`, icon: <Sparkles size={21} /> }, | |
| 130 | − | code | |
| 131 | − | ? { key: "code", label: "Code", to: `/${slug}/-/projects`, icon: <Code2 size={21} /> } | |
| 132 | − | : { key: "docs", label: "Docs", to: `/${slug}/-/docs`, icon: <BookOpen size={21} /> }, | |
| 133 | 133 | { key: "inbox", label: "Inbox", to: "/inbox", icon: <Inbox size={21} />, badge: { count: unread.inbox, loud: true } }, | |
| 134 | 134 | ]; | |
| 135 | 135 | if (isConversation(pathname)) return null; | |
| 228 | 228 | ||
| 229 | 229 | /** | |
| 230 | 230 | * The rail down the left (docs/WORKSPACE.md, "Shell"): the workspace and | |
| 231 | − | * its switcher; Home, Chat, Docs, Agents, Code and the Inbox; then, at the | |
| 232 | − | * foot, the workspace itself, help and your account. The mode lit follows | |
| 233 | − | * the address. A member without Code access has no Code. | |
| 231 | + | * its switcher; Home, Code, Chat, Docs, Agents and the Inbox; then, at the | |
| 232 | + | * foot, the workspace itself, help and your account. Code sits second: for | |
| 233 | + | * those who have it, it is the everyday mode. The mode lit follows the | |
| 234 | + | * address. A member without Code access has no Code. | |
| 234 | 235 | */ | |
| 235 | 236 | export function Rail({ | |
| 236 | 237 | user, | |
| ⋯ | |||
| 251 | 252 | const code = hasCodeAccess(workspace); | |
| 252 | 253 | const modes: Mode[] = [ | |
| 253 | 254 | { key: "home", label: "Home", icon: <House size={19} /> }, | |
| 255 | + | ...(code ? [{ key: "code" as const, label: "Code", icon: <Code2 size={19} /> }] : []), | |
| 254 | 256 | { | |
| 255 | 257 | key: "chat", | |
| 256 | 258 | label: "Chat", | |
| ⋯ | |||
| 259 | 261 | }, | |
| 260 | 262 | { key: "docs", label: "Docs", icon: <BookOpen size={19} /> }, | |
| 261 | 263 | { key: "agents", label: "Agents", icon: <Sparkles size={19} /> }, | |
| 262 | − | ...(code ? [{ key: "code" as const, label: "Code", icon: <Code2 size={19} /> }] : []), | |
| 263 | 264 | { key: "inbox", label: "Inbox", icon: <Inbox size={19} />, badge: { count: unread.inbox, loud: true } }, | |
| 264 | 265 | ]; | |
| 265 | 266 | const workspaceMode: Mode = { key: "workspace", label: "Workspace", icon: <Building2 size={19} /> }; | |
| 168 | 168 | } | |
| 169 | 169 | ||
| 170 | 170 | /** | |
| 171 | − | * The rail's modes (docs/WORKSPACE.md, "Shell"). Home, Chat, Docs, Agents | |
| 172 | − | * and Code are where work happens; the Inbox spans them; Workspace is the | |
| 171 | + | * The rail's modes (docs/WORKSPACE.md, "Shell"). Home, Code, Chat, Docs | |
| 172 | + | * and Agents are where work happens; the Inbox spans them; Workspace is the | |
| 173 | 173 | * workspace itself: its people, money, policies and settings. `account` is | |
| 174 | 174 | * your own settings, under the avatar. Each has a sidebar of its own, or | |
| 175 | 175 | * none, and which one is lit follows the address. |