cf8ee251ee
* Add toggleColumns - Add logic for toggling columns - Add MenuComponent + useSelectedFields hook * Refactoring * eslint-fixes * Typo * skip menu in albumGridView * add omittedFields * Add toggling for playlists and albumSong * Refactoring * defaultProps - fix * Add toggling for PlaylistSongs * remove accidental console log * Refactoring for future compatibility * Hide ToggleMenu in albumGridView * Add TopBarComponent in ToggleFieldsMenu * Add defaultOff for useSelectedFields * Fix edge case * eslint fix * Refactoring * Add propType for forwardRef * Fix issues * add translation for grid and table * add translation for grid and table * Ignore menuBtn for spotify-ish and Ligera themes * hide bpm by default in playlistSongs * Add memoization * Default album view must be Grid Co-authored-by: Deluan <deluan@navidrome.org>
41 lines
843 B
JavaScript
41 lines
843 B
JavaScript
import {
|
|
SET_NOTIFICATIONS_STATE,
|
|
SET_OMITTED_FIELDS,
|
|
SET_TOGGLEABLE_FIELDS,
|
|
} from '../actions'
|
|
|
|
const initialState = {
|
|
notifications: false,
|
|
toggleableFields: {},
|
|
omittedFields: {},
|
|
}
|
|
|
|
export const settingsReducer = (previousState = initialState, payload) => {
|
|
const { type, data } = payload
|
|
switch (type) {
|
|
case SET_NOTIFICATIONS_STATE:
|
|
return {
|
|
...previousState,
|
|
notifications: data,
|
|
}
|
|
case SET_TOGGLEABLE_FIELDS:
|
|
return {
|
|
...previousState,
|
|
toggleableFields: {
|
|
...previousState.toggleableFields,
|
|
...data,
|
|
},
|
|
}
|
|
case SET_OMITTED_FIELDS:
|
|
return {
|
|
...previousState,
|
|
omittedFields: {
|
|
...previousState.omittedFields,
|
|
...data,
|
|
},
|
|
}
|
|
default:
|
|
return previousState
|
|
}
|
|
}
|