diff --git a/packages/app/src/components/command-center.tsx b/packages/app/src/components/command-center.tsx index 4eb8d2f6d..306443af2 100644 --- a/packages/app/src/components/command-center.tsx +++ b/packages/app/src/components/command-center.tsx @@ -7,7 +7,7 @@ import { View, type PressableStateCallbackType, } from "react-native"; -import { memo, useCallback, useEffect, useRef, type ReactNode } from "react"; +import { memo, useCallback, useEffect, useMemo, useRef, type ReactNode } from "react"; import { Plus, Settings } from "lucide-react-native"; import { StyleSheet, useUnistyles } from "react-native-unistyles"; import { useCommandCenter } from "@/hooks/use-command-center"; @@ -107,6 +107,10 @@ function CommandCenterActionRow({ ) : action.icon === "settings" ? ( ) : null; + const titleStyle = useMemo( + () => [styles.title, { color: theme.colors.foreground }], + [theme.colors.foreground], + ); return ( {actionIcon ? {actionIcon} : null} - + {action.title} @@ -161,6 +165,43 @@ function CommandCenterAgentRow({ ); } +interface CommandCenterAgentRowContentProps { + agent: AggregatedAgent; +} + +function CommandCenterAgentRowContent({ agent }: CommandCenterAgentRowContentProps) { + const { theme } = useUnistyles(); + const titleStyle = useMemo( + () => [styles.title, { color: theme.colors.foreground }], + [theme.colors.foreground], + ); + const subtitleStyle = useMemo( + () => [styles.subtitle, { color: theme.colors.foregroundMuted }], + [theme.colors.foregroundMuted], + ); + return ( + + + + + + + + {agent.title || "New agent"} + + + {shortenPath(agent.cwd)} · {formatTimeAgo(agent.lastActivityAt)} + + + + + ); +} + export function CommandCenter() { const { theme } = useUnistyles(); const { open, inputRef, query, setQuery, activeIndex, items, handleClose, handleSelectItem } = @@ -207,24 +248,46 @@ export function CommandCenter() { } }, [activeIndex, open]); - if (isNative || !open) return null; - const actionItems = items.filter((item) => item.kind === "action"); const agentItems = items.filter((item) => item.kind === "agent"); + const panelStyle = useMemo( + () => [ + styles.panel, + { borderColor: theme.colors.border, backgroundColor: theme.colors.surface0 }, + ], + [theme.colors.border, theme.colors.surface0], + ); + const headerStyle = useMemo( + () => [styles.header, { borderBottomColor: theme.colors.border }], + [theme.colors.border], + ); + const inputStyle = useMemo( + () => [styles.input, { color: theme.colors.foreground }], + [theme.colors.foreground], + ); + const emptyTextStyle = useMemo( + () => [styles.emptyText, { color: theme.colors.foregroundMuted }], + [theme.colors.foregroundMuted], + ); + const sectionLabelStyle = useMemo( + () => [styles.sectionLabel, { color: theme.colors.foregroundMuted }], + [theme.colors.foregroundMuted], + ); + const sectionDividerStyle = useMemo( + () => [styles.sectionDivider, { backgroundColor: theme.colors.border }], + [theme.colors.border], + ); + + if (isNative || !open) return null; + return ( - - + + {items.length === 0 ? ( - - No matches - + No matches ) : ( <> {actionItems.length > 0 ? ( <> - - Actions - + Actions {actionItems.map((item, index) => ( 0 ? ( <> - {actionItems.length > 0 ? ( - - ) : null} - - Agents - + {actionItems.length > 0 ? : null} + Agents {agentItems.map((item, index) => { const rowIndex = actionItems.length + index; const agent = item.agent; @@ -292,31 +345,7 @@ export function CommandCenter() { rowRefs={rowRefs} onSelect={handleSelectItem} > - - - - - - - - {agent.title || "New agent"} - - - {shortenPath(agent.cwd)} · {formatTimeAgo(agent.lastActivityAt)} - - - - + ); })}