about summary refs log tree commit diff
path: root/app/javascript/themes/glitch/reducers/settings.js
diff options
context:
space:
mode:
authorkibigo! <marrus-sh@users.noreply.github.com>2017-12-03 23:26:40 -0800
committerkibigo! <marrus-sh@users.noreply.github.com>2017-12-03 23:26:40 -0800
commitbc4fa6b198557a7f3989eb0865e2c77ac7451d29 (patch)
treea18543e1e0555e88b97cad60adc6d2abe0bffb00 /app/javascript/themes/glitch/reducers/settings.js
parentd216547382cf1f3419de31e1ee06272e816ea339 (diff)
Rename themes -> flavours ? ?
Diffstat (limited to 'app/javascript/themes/glitch/reducers/settings.js')
-rw-r--r--app/javascript/themes/glitch/reducers/settings.js119
1 files changed, 0 insertions, 119 deletions
diff --git a/app/javascript/themes/glitch/reducers/settings.js b/app/javascript/themes/glitch/reducers/settings.js
deleted file mode 100644
index c22bbbd8d..000000000
--- a/app/javascript/themes/glitch/reducers/settings.js
+++ /dev/null
@@ -1,119 +0,0 @@
-import { SETTING_CHANGE, SETTING_SAVE } from 'themes/glitch/actions/settings';
-import { COLUMN_ADD, COLUMN_REMOVE, COLUMN_MOVE } from 'themes/glitch/actions/columns';
-import { STORE_HYDRATE } from 'themes/glitch/actions/store';
-import { EMOJI_USE } from 'themes/glitch/actions/emojis';
-import { Map as ImmutableMap, fromJS } from 'immutable';
-import uuid from 'themes/glitch/util/uuid';
-
-const initialState = ImmutableMap({
-  saved: true,
-
-  onboarded: false,
-  layout: 'auto',
-
-  skinTone: 1,
-
-  home: ImmutableMap({
-    shows: ImmutableMap({
-      reblog: true,
-      reply: true,
-    }),
-
-    regex: ImmutableMap({
-      body: '',
-    }),
-  }),
-
-  notifications: ImmutableMap({
-    alerts: ImmutableMap({
-      follow: true,
-      favourite: true,
-      reblog: true,
-      mention: true,
-    }),
-
-    shows: ImmutableMap({
-      follow: true,
-      favourite: true,
-      reblog: true,
-      mention: true,
-    }),
-
-    sounds: ImmutableMap({
-      follow: true,
-      favourite: true,
-      reblog: true,
-      mention: true,
-    }),
-  }),
-
-  community: ImmutableMap({
-    regex: ImmutableMap({
-      body: '',
-    }),
-  }),
-
-  public: ImmutableMap({
-    regex: ImmutableMap({
-      body: '',
-    }),
-  }),
-
-  direct: ImmutableMap({
-    regex: ImmutableMap({
-      body: '',
-    }),
-  }),
-});
-
-const defaultColumns = fromJS([
-  { id: 'COMPOSE', uuid: uuid(), params: {} },
-  { id: 'HOME', uuid: uuid(), params: {} },
-  { id: 'NOTIFICATIONS', uuid: uuid(), params: {} },
-]);
-
-const hydrate = (state, settings) => state.mergeDeep(settings).update('columns', (val = defaultColumns) => val);
-
-const moveColumn = (state, uuid, direction) => {
-  const columns  = state.get('columns');
-  const index    = columns.findIndex(item => item.get('uuid') === uuid);
-  const newIndex = index + direction;
-
-  let newColumns;
-
-  newColumns = columns.splice(index, 1);
-  newColumns = newColumns.splice(newIndex, 0, columns.get(index));
-
-  return state
-    .set('columns', newColumns)
-    .set('saved', false);
-};
-
-const updateFrequentEmojis = (state, emoji) => state.update('frequentlyUsedEmojis', ImmutableMap(), map => map.update(emoji.id, 0, count => count + 1)).set('saved', false);
-
-export default function settings(state = initialState, action) {
-  switch(action.type) {
-  case STORE_HYDRATE:
-    return hydrate(state, action.state.get('settings'));
-  case SETTING_CHANGE:
-    return state
-      .setIn(action.key, action.value)
-      .set('saved', false);
-  case COLUMN_ADD:
-    return state
-      .update('columns', list => list.push(fromJS({ id: action.id, uuid: uuid(), params: action.params })))
-      .set('saved', false);
-  case COLUMN_REMOVE:
-    return state
-      .update('columns', list => list.filterNot(item => item.get('uuid') === action.uuid))
-      .set('saved', false);
-  case COLUMN_MOVE:
-    return moveColumn(state, action.uuid, action.direction);
-  case EMOJI_USE:
-    return updateFrequentEmojis(state, action.emoji);
-  case SETTING_SAVE:
-    return state.set('saved', true);
-  default:
-    return state;
-  }
-};