74c8afd0e0
Implements a visual badge that displays the count of active work items (queued + currently processing) in the worker service. The badge appears next to the claude-mem logo and updates in real-time via SSE. Features: - Shows count of pending messages + active SDK generators - Only displays when queueDepth > 0 - Subtle pulse animation for visual feedback - Theme-aware styling Backend changes: - Added getTotalActiveWork() method to SessionManager - Updated worker-service to broadcast queueDepth via SSE - Enhanced processing status API endpoint Frontend changes: - Updated Header component to display queue bubble - Enhanced useSSE hook to track queueDepth state - Added CSS styling with pulse animation Closes #122 Closes #96 Closes #97 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
129 lines
5.4 KiB
TypeScript
129 lines
5.4 KiB
TypeScript
import React from 'react';
|
|
import { ThemeToggle } from './ThemeToggle';
|
|
import { ThemePreference } from '../hooks/useTheme';
|
|
|
|
interface HeaderProps {
|
|
isConnected: boolean;
|
|
projects: string[];
|
|
currentFilter: string;
|
|
onFilterChange: (filter: string) => void;
|
|
onSettingsToggle: () => void;
|
|
sidebarOpen: boolean;
|
|
isProcessing: boolean;
|
|
queueDepth: number;
|
|
themePreference: ThemePreference;
|
|
onThemeChange: (theme: ThemePreference) => void;
|
|
}
|
|
|
|
export function Header({
|
|
isConnected,
|
|
projects,
|
|
currentFilter,
|
|
onFilterChange,
|
|
onSettingsToggle,
|
|
sidebarOpen,
|
|
isProcessing,
|
|
queueDepth,
|
|
themePreference,
|
|
onThemeChange
|
|
}: HeaderProps) {
|
|
return (
|
|
<div className="header">
|
|
<h1>
|
|
<div style={{ position: 'relative', display: 'inline-block' }}>
|
|
<img src="claude-mem-logomark.webp" alt="" className={`logomark ${isProcessing ? 'spinning' : ''}`} />
|
|
{queueDepth > 0 && (
|
|
<div className="queue-bubble">
|
|
{queueDepth}
|
|
</div>
|
|
)}
|
|
</div>
|
|
<span className="logo-text">claude-mem</span>
|
|
</h1>
|
|
<div className="status">
|
|
<a
|
|
href="https://docs.claude-mem.ai"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
title="Documentation"
|
|
style={{
|
|
display: 'block',
|
|
padding: '8px 4px 8px 8px',
|
|
color: '#a0a0a0',
|
|
transition: 'color 0.2s',
|
|
lineHeight: 0
|
|
}}
|
|
onMouseEnter={(e) => e.currentTarget.style.color = '#606060'}
|
|
onMouseLeave={(e) => e.currentTarget.style.color = '#a0a0a0'}
|
|
>
|
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
<path d="M4 19.5A2.5 2.5 0 0 1 6.5 17H20"></path>
|
|
<path d="M6.5 2H20v20H6.5A2.5 2.5 0 0 1 4 19.5v-15A2.5 2.5 0 0 1 6.5 2z"></path>
|
|
</svg>
|
|
</a>
|
|
<a
|
|
href="https://github.com/thedotmack/claude-mem/"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
title="GitHub"
|
|
style={{
|
|
display: 'block',
|
|
padding: '8px 4px',
|
|
color: '#a0a0a0',
|
|
transition: 'color 0.2s',
|
|
lineHeight: 0
|
|
}}
|
|
onMouseEnter={(e) => e.currentTarget.style.color = '#606060'}
|
|
onMouseLeave={(e) => e.currentTarget.style.color = '#a0a0a0'}
|
|
>
|
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
|
|
<path d="M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"/>
|
|
</svg>
|
|
</a>
|
|
<a
|
|
href="https://x.com/Claude_Memory"
|
|
target="_blank"
|
|
rel="noopener noreferrer"
|
|
title="X (Twitter)"
|
|
style={{
|
|
display: 'block',
|
|
padding: '8px 8px 8px 4px',
|
|
color: '#a0a0a0',
|
|
transition: 'color 0.2s',
|
|
lineHeight: 0
|
|
}}
|
|
onMouseEnter={(e) => e.currentTarget.style.color = '#606060'}
|
|
onMouseLeave={(e) => e.currentTarget.style.color = '#a0a0a0'}
|
|
>
|
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="currentColor">
|
|
<path d="M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"/>
|
|
</svg>
|
|
</a>
|
|
<select
|
|
value={currentFilter}
|
|
onChange={e => onFilterChange(e.target.value)}
|
|
>
|
|
<option value="">All Projects</option>
|
|
{projects.map(project => (
|
|
<option key={project} value={project}>{project}</option>
|
|
))}
|
|
</select>
|
|
<ThemeToggle
|
|
preference={themePreference}
|
|
onThemeChange={onThemeChange}
|
|
/>
|
|
<button
|
|
className={`settings-btn ${sidebarOpen ? 'active' : ''}`}
|
|
onClick={onSettingsToggle}
|
|
title="Settings"
|
|
>
|
|
<svg className="settings-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round">
|
|
<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"></path>
|
|
<circle cx="12" cy="12" r="3"></circle>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|