fix(ui): keep the NowPlayingPanel badge in sync.
Introduced a new event, EVENT_STREAM_RECONNECTED, to track the last timestamp of stream reconnections. This change updates the activity reducer to handle the new event and modifies the NowPlayingPanel to refresh data based on server and stream status. Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
EVENT_SCAN_STATUS,
|
||||
EVENT_SERVER_START,
|
||||
EVENT_NOW_PLAYING_COUNT,
|
||||
EVENT_STREAM_RECONNECTED,
|
||||
} from '../actions'
|
||||
import config from '../config'
|
||||
|
||||
@@ -16,6 +17,7 @@ const initialState = {
|
||||
},
|
||||
serverStart: { version: config.version },
|
||||
nowPlayingCount: 0,
|
||||
streamReconnected: 0, // Timestamp of last reconnection
|
||||
}
|
||||
|
||||
export const activityReducer = (previousState = initialState, payload) => {
|
||||
@@ -44,6 +46,8 @@ export const activityReducer = (previousState = initialState, payload) => {
|
||||
}
|
||||
case EVENT_NOW_PLAYING_COUNT:
|
||||
return { ...previousState, nowPlayingCount: data.count }
|
||||
case EVENT_STREAM_RECONNECTED:
|
||||
return { ...previousState, streamReconnected: Date.now() }
|
||||
default:
|
||||
return previousState
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user