You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
958 B

  1. import { SETTING_CHANGE } from '../actions/settings';
  2. import { STORE_HYDRATE } from '../actions/store';
  3. import Immutable from 'immutable';
  4. const initialState = Immutable.Map({
  5. home: Immutable.Map({
  6. shows: Immutable.Map({
  7. reblog: true,
  8. reply: true
  9. })
  10. }),
  11. notifications: Immutable.Map({
  12. alerts: Immutable.Map({
  13. follow: true,
  14. favourite: true,
  15. reblog: true,
  16. mention: true
  17. }),
  18. shows: Immutable.Map({
  19. follow: true,
  20. favourite: true,
  21. reblog: true,
  22. mention: true
  23. }),
  24. sounds: Immutable.Map({
  25. follow: true,
  26. favourite: true,
  27. reblog: true,
  28. mention: true
  29. })
  30. })
  31. });
  32. export default function settings(state = initialState, action) {
  33. switch(action.type) {
  34. case STORE_HYDRATE:
  35. return state.mergeDeep(action.state.get('settings'));
  36. case SETTING_CHANGE:
  37. return state.setIn(action.key, action.value);
  38. default:
  39. return state;
  40. }
  41. };