-
Notifications
You must be signed in to change notification settings - Fork 2
Review roadmap and complete outstanding features #21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
JoshuaAFerguson
merged 4 commits into
main
from
claude/complete-outstanding-features-01RQG4tqUfuS2A9ChNztvaAU
Nov 15, 2025
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
0d8f3ac
feat(ui): Complete WebSocket integration for 8 remaining pages
claude 96d0cdc
feat(ui): Add production-ready WebSocket enhancements
claude b5cbbc0
feat(ui): Implement enhanced WebSocket features across all pages
claude 1d40507
docs(roadmap): Update roadmap with completed WebSocket enhancements
claude File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,247 @@ | ||
| /** | ||
| * EnhancedWebSocketStatus Component | ||
| * | ||
| * Production-ready WebSocket connection status indicator with: | ||
| * - Reconnection countdown timer | ||
| * - Manual reconnect button | ||
| * - Connection quality indicator (latency) | ||
| * - Visual feedback for connection states | ||
| * | ||
| * @component | ||
| */ | ||
| import { useState, useEffect } from 'react'; | ||
| import { | ||
| Box, | ||
| Chip, | ||
| IconButton, | ||
| Tooltip, | ||
| CircularProgress, | ||
| Popover, | ||
| Typography, | ||
| Button, | ||
| LinearProgress, | ||
| } from '@mui/material'; | ||
| import { | ||
| Wifi as ConnectedIcon, | ||
| WifiOff as DisconnectedIcon, | ||
| Refresh as RefreshIcon, | ||
| SignalCellularAlt as SignalIcon, | ||
| ErrorOutline as ErrorIcon, | ||
| } from '@mui/icons-material'; | ||
|
|
||
| interface EnhancedWebSocketStatusProps { | ||
| isConnected: boolean; | ||
| reconnectAttempts: number; | ||
| maxReconnectAttempts?: number; | ||
| onManualReconnect?: () => void; | ||
| latency?: number; // in milliseconds | ||
| size?: 'small' | 'medium'; | ||
| showDetails?: boolean; | ||
| } | ||
|
|
||
| export default function EnhancedWebSocketStatus({ | ||
| isConnected, | ||
| reconnectAttempts, | ||
| maxReconnectAttempts = 10, | ||
| onManualReconnect, | ||
| latency, | ||
| size = 'small', | ||
| showDetails = true, | ||
| }: EnhancedWebSocketStatusProps) { | ||
| const [anchorEl, setAnchorEl] = useState<HTMLElement | null>(null); | ||
| const [countdown, setCountdown] = useState<number | null>(null); | ||
|
|
||
| // Calculate reconnection delay (exponential backoff: 2^attempt seconds, max 30s) | ||
| const getReconnectDelay = (attempt: number) => { | ||
| return Math.min(Math.pow(2, attempt), 30); | ||
| }; | ||
|
|
||
| // Countdown timer for reconnection | ||
| useEffect(() => { | ||
| if (reconnectAttempts > 0 && !isConnected) { | ||
| const delay = getReconnectDelay(reconnectAttempts - 1); | ||
| setCountdown(delay); | ||
|
|
||
| const interval = setInterval(() => { | ||
| setCountdown((prev) => { | ||
| if (prev === null || prev <= 1) { | ||
| clearInterval(interval); | ||
| return null; | ||
| } | ||
| return prev - 1; | ||
| }); | ||
| }, 1000); | ||
|
|
||
| return () => clearInterval(interval); | ||
| } else { | ||
| setCountdown(null); | ||
| } | ||
| }, [reconnectAttempts, isConnected]); | ||
|
|
||
| const handleClick = (event: React.MouseEvent<HTMLElement>) => { | ||
| if (showDetails) { | ||
| setAnchorEl(event.currentTarget); | ||
| } | ||
| }; | ||
|
|
||
| const handleClose = () => { | ||
| setAnchorEl(null); | ||
| }; | ||
|
|
||
| const handleManualReconnect = () => { | ||
| if (onManualReconnect) { | ||
| onManualReconnect(); | ||
| } | ||
| handleClose(); | ||
| }; | ||
|
|
||
| const getConnectionQuality = (latency?: number) => { | ||
| if (!latency) return { label: 'Unknown', color: 'default' as const }; | ||
| if (latency < 100) return { label: 'Excellent', color: 'success' as const }; | ||
| if (latency < 300) return { label: 'Good', color: 'info' as const }; | ||
| if (latency < 500) return { label: 'Fair', color: 'warning' as const }; | ||
| return { label: 'Poor', color: 'error' as const }; | ||
| }; | ||
|
|
||
| const getStatusLabel = () => { | ||
| if (isConnected) { | ||
| return latency ? `Live • ${latency}ms` : 'Live Updates'; | ||
| } | ||
| if (reconnectAttempts > 0) { | ||
| return countdown !== null | ||
| ? `Reconnecting in ${countdown}s...` | ||
| : `Reconnecting... (${reconnectAttempts}/${maxReconnectAttempts})`; | ||
| } | ||
| if (reconnectAttempts >= maxReconnectAttempts) { | ||
| return 'Connection Failed'; | ||
| } | ||
| return 'Disconnected'; | ||
| }; | ||
|
|
||
| const getStatusColor = () => { | ||
| if (isConnected) return 'success' as const; | ||
| if (reconnectAttempts >= maxReconnectAttempts) return 'error' as const; | ||
| if (reconnectAttempts > 0) return 'warning' as const; | ||
| return 'default' as const; | ||
| }; | ||
|
|
||
| const getStatusIcon = () => { | ||
| if (isConnected) return <ConnectedIcon />; | ||
| if (reconnectAttempts >= maxReconnectAttempts) return <ErrorIcon />; | ||
| if (reconnectAttempts > 0) return <CircularProgress size={16} />; | ||
| return <DisconnectedIcon />; | ||
| }; | ||
|
|
||
| const quality = getConnectionQuality(latency); | ||
| const open = Boolean(anchorEl); | ||
|
|
||
| return ( | ||
| <> | ||
| <Chip | ||
| icon={getStatusIcon()} | ||
| label={getStatusLabel()} | ||
| size={size} | ||
| color={getStatusColor()} | ||
| onClick={handleClick} | ||
| sx={{ | ||
| cursor: showDetails ? 'pointer' : 'default', | ||
| '& .MuiChip-icon': { | ||
| marginLeft: '8px', | ||
| }, | ||
| }} | ||
| /> | ||
|
|
||
| {showDetails && ( | ||
| <Popover | ||
| open={open} | ||
| anchorEl={anchorEl} | ||
| onClose={handleClose} | ||
| anchorOrigin={{ | ||
| vertical: 'bottom', | ||
| horizontal: 'center', | ||
| }} | ||
| transformOrigin={{ | ||
| vertical: 'top', | ||
| horizontal: 'center', | ||
| }} | ||
| > | ||
| <Box sx={{ p: 2, minWidth: 280 }}> | ||
| <Typography variant="subtitle2" gutterBottom sx={{ fontWeight: 600 }}> | ||
| WebSocket Connection Status | ||
| </Typography> | ||
|
|
||
| {/* Connection State */} | ||
| <Box sx={{ display: 'flex', alignItems: 'center', gap: 1, mb: 2 }}> | ||
| {getStatusIcon()} | ||
| <Box sx={{ flex: 1 }}> | ||
| <Typography variant="body2" sx={{ fontWeight: 500 }}> | ||
| {isConnected ? 'Connected' : reconnectAttempts > 0 ? 'Reconnecting' : 'Disconnected'} | ||
| </Typography> | ||
| <Typography variant="caption" color="text.secondary"> | ||
| {getStatusLabel()} | ||
| </Typography> | ||
| </Box> | ||
| </Box> | ||
|
|
||
| {/* Reconnection Progress */} | ||
| {reconnectAttempts > 0 && !isConnected && ( | ||
| <Box sx={{ mb: 2 }}> | ||
| <Box sx={{ display: 'flex', justifyContent: 'space-between', mb: 0.5 }}> | ||
| <Typography variant="caption" color="text.secondary"> | ||
| Attempt {reconnectAttempts}/{maxReconnectAttempts} | ||
| </Typography> | ||
| {countdown !== null && ( | ||
| <Typography variant="caption" color="text.secondary"> | ||
| {countdown}s | ||
| </Typography> | ||
| )} | ||
| </Box> | ||
| <LinearProgress | ||
| variant={countdown !== null ? 'determinate' : 'indeterminate'} | ||
| value={countdown !== null ? ((getReconnectDelay(reconnectAttempts - 1) - countdown) / getReconnectDelay(reconnectAttempts - 1)) * 100 : undefined} | ||
| color={reconnectAttempts >= maxReconnectAttempts ? 'error' : 'primary'} | ||
| /> | ||
| </Box> | ||
| )} | ||
|
|
||
| {/* Connection Quality */} | ||
| {isConnected && latency !== undefined && ( | ||
| <Box sx={{ mb: 2 }}> | ||
| <Box sx={{ display: 'flex', alignItems: 'center', gap: 1, mb: 0.5 }}> | ||
| <SignalIcon fontSize="small" color={quality.color} /> | ||
| <Typography variant="body2"> | ||
| Connection Quality: <strong>{quality.label}</strong> | ||
| </Typography> | ||
| </Box> | ||
| <Typography variant="caption" color="text.secondary"> | ||
| Latency: {latency}ms | ||
| </Typography> | ||
| </Box> | ||
| )} | ||
|
|
||
| {/* Manual Reconnect Button */} | ||
| {!isConnected && onManualReconnect && ( | ||
| <Button | ||
| fullWidth | ||
| variant="outlined" | ||
| size="small" | ||
| startIcon={<RefreshIcon />} | ||
| onClick={handleManualReconnect} | ||
| disabled={reconnectAttempts > 0 && reconnectAttempts < maxReconnectAttempts} | ||
| > | ||
| {reconnectAttempts >= maxReconnectAttempts ? 'Retry Connection' : 'Reconnect Now'} | ||
| </Button> | ||
| )} | ||
|
|
||
| {/* Help Text */} | ||
| {!isConnected && ( | ||
| <Typography variant="caption" color="text.secondary" sx={{ mt: 2, display: 'block' }}> | ||
| Real-time updates are temporarily unavailable. Data will refresh automatically when reconnected. | ||
| </Typography> | ||
| )} | ||
| </Box> | ||
| </Popover> | ||
| )} | ||
| </> | ||
| ); | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Check notice
Code scanning / CodeQL
Unused variable, import, function or class Note
Copilot Autofix
AI 10 months ago
To fix this problem, simply remove
IconButtonandTooltipfrom the destructured import list from@mui/materialon lines 13–23. No further changes to code, logic, or imports are necessary. The change should be made only in the import statement block at the top of the file (ui/src/components/EnhancedWebSocketStatus.tsx), specifically removingIconButtonandTooltip(making sure to preserve commas and formatting).