jedmund-svelte/src/lib/components/StreamStatus.svelte
Justin Edmund 3d7eb6e985 refactor: consolidate now playing detection into single music stream store
- Merge albumStream and nowPlayingStream into unified musicStream store
- Simplify confidence scoring to binary detection (playing/not playing)
- Create single source of truth for music state across components
- Fix synchronization issues between header and album indicators
- Make Album spring animation more subtle (stiffness: 150, damping: 25)

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-10 21:32:14 -07:00

79 lines
1.3 KiB
Svelte

<script lang="ts">
import { musicStream } from '$lib/stores/music-stream'
let isConnected = $state(false)
$effect(() => {
const unsubscribe = musicStream.subscribe((state) => {
isConnected = state.connected
})
return unsubscribe
})
</script>
{#if isConnected}
<div class="stream-status connected" title="Live updates active">
<span class="dot"></span>
</div>
{/if}
<style lang="scss">
.stream-status {
position: fixed;
bottom: $unit * 2;
right: $unit * 2;
display: flex;
align-items: center;
gap: $unit-half;
padding: $unit-half $unit;
background: rgba(0, 0, 0, 0.8);
color: white;
border-radius: $unit * 2;
font-size: $font-size-small;
z-index: $z-index-overlay;
animation: fadeIn 0.3s ease-out;
&.connected {
.dot {
background: #4caf50;
animation: pulse 2s ease-in-out infinite;
}
}
.dot {
width: 8px;
height: 8px;
border-radius: 50%;
}
}
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes pulse {
0%,
100% {
opacity: 1;
transform: scale(1);
}
50% {
opacity: 0.6;
transform: scale(0.9);
}
}
@include breakpoint('phone') {
.stream-status {
bottom: $unit;
right: $unit;
}
}
</style>