({
session,
initialProjectPath = "",
onBack,
onProjectSettings,
className,
onStreamingChange,
})
| 32 | } |
| 33 | |
| 34 | export const ClaudeCodeSession: React.FC<ClaudeCodeSessionProps> = ({ |
| 35 | session, |
| 36 | initialProjectPath = "", |
| 37 | onBack, |
| 38 | onProjectSettings, |
| 39 | className, |
| 40 | onStreamingChange, |
| 41 | }) => { |
| 42 | const [projectPath, setProjectPath] = useState(initialProjectPath || session?.project_path || ""); |
| 43 | const [error, setError] = useState<string | null>(null); |
| 44 | const [copyPopoverOpen, setCopyPopoverOpen] = useState(false); |
| 45 | const [isFirstPrompt, setIsFirstPrompt] = useState(!session); |
| 46 | const [totalTokens, setTotalTokens] = useState(0); |
| 47 | const [claudeSessionId, setClaudeSessionId] = useState<string | null>(null); |
| 48 | const [showTimeline, setShowTimeline] = useState(false); |
| 49 | const [showSettings, setShowSettings] = useState(false); |
| 50 | const [showForkDialog, setShowForkDialog] = useState(false); |
| 51 | const [showSlashCommandsSettings, setShowSlashCommandsSettings] = useState(false); |
| 52 | const [forkCheckpointId, setForkCheckpointId] = useState<string | null>(null); |
| 53 | const [forkSessionName, setForkSessionName] = useState(""); |
| 54 | const [queuedPrompts, setQueuedPrompts] = useState<Array<{ id: string; prompt: string; model: "sonnet" | "opus" }>>([]); |
| 55 | const [showPreview, setShowPreview] = useState(false); |
| 56 | const [previewUrl, setPreviewUrl] = useState<string | null>(null); |
| 57 | const [isPreviewMaximized, setIsPreviewMaximized] = useState(false); |
| 58 | const promptInputRef = useRef<FloatingPromptInputRef>(null); |
| 59 | const processQueueTimeoutRef = useRef<NodeJS.Timeout | null>(null); |
| 60 | |
| 61 | // Use custom hooks |
| 62 | const { |
| 63 | messages, |
| 64 | rawJsonlOutput, |
| 65 | isStreaming, |
| 66 | currentSessionId: _currentSessionId, |
| 67 | clearMessages, |
| 68 | loadMessages |
| 69 | } = useClaudeMessages({ |
| 70 | onSessionInfo: (info) => { |
| 71 | setClaudeSessionId(info.sessionId); |
| 72 | }, |
| 73 | onTokenUpdate: setTotalTokens, |
| 74 | onStreamingChange |
| 75 | }); |
| 76 | |
| 77 | const { |
| 78 | checkpoints: _checkpoints, |
| 79 | timelineVersion, |
| 80 | loadCheckpoints, |
| 81 | createCheckpoint: _createCheckpoint, |
| 82 | restoreCheckpoint, |
| 83 | forkCheckpoint |
| 84 | } = useCheckpoints({ |
| 85 | sessionId: claudeSessionId, |
| 86 | projectId: session?.project_id || '', |
| 87 | projectPath: projectPath, |
| 88 | onToast: (message: string, type: 'success' | 'error') => { |
| 89 | console.log(`Toast: ${type} - ${message}`); |
| 90 | } |
| 91 | }); |
nothing calls this directly
no test coverage detected