feat: Add session management and global Claude terminal
Phase 1 - Accurate study status detection: - Add is_optimization_running() to check for active processes - Add get_accurate_study_status() with proper status logic - Status now: not_started, running, paused, completed - Add "paused" status styling (orange) to Home page Phase 2 - Global Claude terminal: - Create ClaudeTerminalContext for app-level state - Create GlobalClaudeTerminal floating component - Terminal persists across page navigation - Shows green indicator when connected - Remove inline terminal from Dashboard 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
import React from 'react';
|
||||
import { useClaudeTerminal } from '../context/ClaudeTerminalContext';
|
||||
import { ClaudeTerminal } from './ClaudeTerminal';
|
||||
import { Terminal } from 'lucide-react';
|
||||
|
||||
/**
|
||||
* GlobalClaudeTerminal - A floating terminal that persists across page navigation
|
||||
*
|
||||
* This component renders at the App level and maintains the Claude Code session
|
||||
* even when the user navigates between pages. It can be minimized to a floating
|
||||
* button or expanded to a side panel.
|
||||
*/
|
||||
export const GlobalClaudeTerminal: React.FC = () => {
|
||||
const { isOpen, setIsOpen, isExpanded, setIsExpanded, isConnected } = useClaudeTerminal();
|
||||
|
||||
// Floating button when terminal is closed
|
||||
if (!isOpen) {
|
||||
return (
|
||||
<button
|
||||
onClick={() => setIsOpen(true)}
|
||||
className={`fixed bottom-6 right-6 p-4 rounded-full shadow-lg transition-all z-50 ${
|
||||
isConnected
|
||||
? 'bg-green-600 hover:bg-green-500'
|
||||
: 'bg-primary-600 hover:bg-primary-500'
|
||||
}`}
|
||||
title={isConnected ? 'Claude Terminal (Connected)' : 'Open Claude Terminal'}
|
||||
>
|
||||
<Terminal className="w-6 h-6 text-white" />
|
||||
{isConnected && (
|
||||
<span className="absolute -top-1 -right-1 w-3 h-3 bg-green-400 rounded-full border-2 border-dark-900 animate-pulse" />
|
||||
)}
|
||||
</button>
|
||||
);
|
||||
}
|
||||
|
||||
// Terminal panel
|
||||
return (
|
||||
<div className={`fixed z-50 transition-all duration-200 ${
|
||||
isExpanded
|
||||
? 'inset-4'
|
||||
: 'bottom-6 right-6 w-[650px] h-[500px]'
|
||||
}`}>
|
||||
<ClaudeTerminal
|
||||
isExpanded={isExpanded}
|
||||
onToggleExpand={() => setIsExpanded(!isExpanded)}
|
||||
onClose={() => setIsOpen(false)}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user