feat(ui): add Now Playing panel for admins (#4209)
* feat(ui): add Now Playing panel and integrate now playing count updates Signed-off-by: Deluan <deluan@navidrome.org> * fix: check return value in test to satisfy linter * fix: format React code with prettier * fix: resolve race condition in play tracker test * fix: log error when fetching now playing data fails Signed-off-by: Deluan <deluan@navidrome.org> * feat(ui): refactor Now Playing panel with new components and error handling Signed-off-by: Deluan <deluan@navidrome.org> * fix(ui): adjust padding and height in Now Playing panel for improved layout Signed-off-by: Deluan <deluan@navidrome.org> * fix(cache): add automatic cleanup to prevent goroutine leak on cache garbage collection Signed-off-by: Deluan <deluan@navidrome.org> --------- Signed-off-by: Deluan <deluan@navidrome.org>
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
import { activityReducer } from './activityReducer'
|
||||
import { EVENT_SCAN_STATUS, EVENT_SERVER_START } from '../actions'
|
||||
import {
|
||||
EVENT_SCAN_STATUS,
|
||||
EVENT_SERVER_START,
|
||||
EVENT_NOW_PLAYING_COUNT,
|
||||
} from '../actions'
|
||||
import config from '../config'
|
||||
|
||||
describe('activityReducer', () => {
|
||||
@@ -12,6 +16,7 @@ describe('activityReducer', () => {
|
||||
elapsedTime: 0,
|
||||
},
|
||||
serverStart: { version: config.version },
|
||||
nowPlayingCount: 0,
|
||||
}
|
||||
|
||||
it('returns the initial state when no action is specified', () => {
|
||||
@@ -116,4 +121,13 @@ describe('activityReducer', () => {
|
||||
startTime: Date.parse('2023-01-01T00:00:00Z'),
|
||||
})
|
||||
})
|
||||
|
||||
it('handles EVENT_NOW_PLAYING_COUNT', () => {
|
||||
const action = {
|
||||
type: EVENT_NOW_PLAYING_COUNT,
|
||||
data: { count: 5 },
|
||||
}
|
||||
const newState = activityReducer(initialState, action)
|
||||
expect(newState.nowPlayingCount).toEqual(5)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user