The best way to control Claude Code, Codex and more from any computer or phone
Mirrored from https://github.com/Camo67/t3code.git
Synced Nov 21, 04:45 UTC
| 1 | import { usePreviewPanelInlineSize } from "../../hooks/usePreviewPanelInlineSize"; |
| 2 | import { RightPanelSheet } from "../RightPanelSheet"; |
| 3 | import { RightPanelTabs, type RightPanelTabsProps } from "../RightPanelTabs"; |
| 4 | |
| 5 | type ChatRightPanelProps = Omit<RightPanelTabsProps, "mode" | "inlineSize" | "maximized"> & { |
| 6 | readonly sheet: boolean; |
| 7 | readonly maximized: boolean; |
| 8 | readonly workspaceLayoutElement: HTMLElement | null; |
| 9 | readonly widthStorageKey: string; |
| 10 | readonly sheetAnimationDurationMs: number; |
| 11 | readonly onCloseSheet: () => void; |
| 12 | }; |
| 13 | |
| 14 | /** |
| 15 | * The right panel, inline beside the chat column or as a sheet on narrow |
| 16 | * layouts. Its width follows a resize drag every frame, so the width state |
| 17 | * lives here rather than in ChatView. |
| 18 | */ |
| 19 | export function ChatRightPanel(props: ChatRightPanelProps) { |
| 20 | const { |
| 21 | sheet, |
| 22 | workspaceLayoutElement, |
| 23 | widthStorageKey, |
| 24 | sheetAnimationDurationMs, |
| 25 | onCloseSheet, |
| 26 | maximized, |
| 27 | layoutControls, |
| 28 | ...tabs |
| 29 | } = props; |
| 30 | const inlineSize = usePreviewPanelInlineSize({ |
| 31 | container: workspaceLayoutElement, |
| 32 | widthStorageKey, |
| 33 | }); |
| 34 | if (!sheet) { |
| 35 | return <RightPanelTabs {...tabs} mode="inline" maximized={maximized} inlineSize={inlineSize} />; |
| 36 | } |
| 37 | return ( |
| 38 | <RightPanelSheet |
| 39 | animationDurationMs={sheetAnimationDurationMs} |
| 40 | open={tabs.open === true} |
| 41 | onClose={onCloseSheet} |
| 42 | > |
| 43 | <RightPanelTabs |
| 44 | {...tabs} |
| 45 | mode="sheet" |
| 46 | inlineSize={inlineSize} |
| 47 | layoutControls={layoutControls} |
| 48 | /> |
| 49 | </RightPanelSheet> |
| 50 | ); |
| 51 | } |