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:
Antoine
2025-12-05 12:56:34 -05:00
parent fb2d06236a
commit 5c660ff270
8 changed files with 292 additions and 56 deletions

View File

@@ -0,0 +1,42 @@
import React, { createContext, useContext, useState, ReactNode } from 'react';
interface ClaudeTerminalContextType {
// Terminal visibility state
isOpen: boolean;
setIsOpen: (open: boolean) => void;
isExpanded: boolean;
setIsExpanded: (expanded: boolean) => void;
// Connection state (updated by the terminal component)
isConnected: boolean;
setIsConnected: (connected: boolean) => void;
}
const ClaudeTerminalContext = createContext<ClaudeTerminalContextType | undefined>(undefined);
export const ClaudeTerminalProvider: React.FC<{ children: ReactNode }> = ({ children }) => {
const [isOpen, setIsOpen] = useState(false);
const [isExpanded, setIsExpanded] = useState(false);
const [isConnected, setIsConnected] = useState(false);
return (
<ClaudeTerminalContext.Provider value={{
isOpen,
setIsOpen,
isExpanded,
setIsExpanded,
isConnected,
setIsConnected
}}>
{children}
</ClaudeTerminalContext.Provider>
);
};
export const useClaudeTerminal = () => {
const context = useContext(ClaudeTerminalContext);
if (context === undefined) {
throw new Error('useClaudeTerminal must be used within a ClaudeTerminalProvider');
}
return context;
};