feat(nav): add pulsing indicator for offline network players
Add smooth opacity pulsing animation to the network badge (📡) when network players are offline. The badge smoothly fades from full opacity to 30% opacity and back over 2 seconds, providing a clear visual indicator of disconnection status. When online, the badge remains at full opacity with no animation. This subtle indicator helps users quickly identify connection issues without being distracting. Changes: - Add isOnline property to NetworkPlayer interface - Apply offlinePulse animation when isOnline is false - Default to online if isOnline is not specified 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -19,6 +19,7 @@ interface NetworkPlayer {
|
||||
id: string
|
||||
emoji?: string
|
||||
name?: string
|
||||
isOnline?: boolean
|
||||
}
|
||||
|
||||
interface ArcadeRoomInfo {
|
||||
|
||||
@@ -7,6 +7,7 @@ interface NetworkPlayer {
|
||||
name?: string
|
||||
color?: string
|
||||
memberName?: string
|
||||
isOnline?: boolean
|
||||
}
|
||||
|
||||
interface NetworkPlayerIndicatorProps {
|
||||
@@ -22,6 +23,7 @@ export function NetworkPlayerIndicator({ player, shouldEmphasize }: NetworkPlaye
|
||||
const [isHovered, setIsHovered] = React.useState(false)
|
||||
const playerName = player.name || `Network Player ${player.id.slice(0, 8)}`
|
||||
const extraInfo = player.memberName ? `Controlled by ${player.memberName}` : undefined
|
||||
const isOnline = player.isOnline !== false // Default to online if not specified
|
||||
|
||||
return (
|
||||
<PlayerTooltip
|
||||
@@ -91,10 +93,26 @@ export function NetworkPlayerIndicator({ player, shouldEmphasize }: NetworkPlaye
|
||||
justifyContent: 'center',
|
||||
boxShadow: '0 4px 10px rgba(0,0,0,0.4)',
|
||||
zIndex: 1,
|
||||
animation: isOnline ? 'none' : 'offlinePulse 2s ease-in-out infinite',
|
||||
}}
|
||||
>
|
||||
📡
|
||||
</div>
|
||||
|
||||
<style
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: `
|
||||
@keyframes offlinePulse {
|
||||
0%, 100% {
|
||||
opacity: 1;
|
||||
}
|
||||
50% {
|
||||
opacity: 0.3;
|
||||
}
|
||||
}
|
||||
`,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</PlayerTooltip>
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user