2023-06-30 16:03:25 +01:00
|
|
|
import { Record as ImmutableRecord } from 'immutable';
|
|
|
|
|
2016-09-19 22:25:59 +01:00
|
|
|
import { loadingBarReducer } from 'react-redux-loading-bar';
|
2023-05-10 11:59:29 +01:00
|
|
|
import { combineReducers } from 'redux-immutable';
|
|
|
|
|
2016-11-20 18:39:18 +00:00
|
|
|
import accounts from './accounts';
|
2017-05-03 01:04:16 +01:00
|
|
|
import accounts_counters from './accounts_counters';
|
2023-05-10 11:59:29 +01:00
|
|
|
import accounts_map from './accounts_map';
|
|
|
|
import alerts from './alerts';
|
|
|
|
import announcements from './announcements';
|
2019-09-29 20:46:05 +01:00
|
|
|
import blocks from './blocks';
|
2021-02-10 23:53:12 +00:00
|
|
|
import boosts from './boosts';
|
2017-07-09 11:16:08 +01:00
|
|
|
import compose from './compose';
|
2023-05-10 11:59:29 +01:00
|
|
|
import contexts from './contexts';
|
|
|
|
import conversations from './conversations';
|
2017-09-23 04:40:28 +01:00
|
|
|
import custom_emojis from './custom_emojis';
|
2023-05-10 11:59:29 +01:00
|
|
|
import domain_lists from './domain_lists';
|
|
|
|
import dropdown_menu from './dropdown_menu';
|
2018-06-29 14:34:36 +01:00
|
|
|
import filters from './filters';
|
2023-05-10 11:59:29 +01:00
|
|
|
import followed_tags from './followed_tags';
|
|
|
|
import height_cache from './height_cache';
|
|
|
|
import history from './history';
|
|
|
|
import listAdder from './list_adder';
|
|
|
|
import listEditor from './list_editor';
|
|
|
|
import lists from './lists';
|
2020-05-29 15:14:16 +01:00
|
|
|
import markers from './markers';
|
2023-05-10 11:59:29 +01:00
|
|
|
import media_attachments from './media_attachments';
|
|
|
|
import meta from './meta';
|
2023-05-25 14:42:37 +01:00
|
|
|
import { modalReducer } from './modal';
|
2023-05-10 11:59:29 +01:00
|
|
|
import mutes from './mutes';
|
|
|
|
import notifications from './notifications';
|
2020-09-28 12:29:43 +01:00
|
|
|
import picture_in_picture from './picture_in_picture';
|
2023-05-10 11:59:29 +01:00
|
|
|
import polls from './polls';
|
|
|
|
import push_notifications from './push_notifications';
|
|
|
|
import relationships from './relationships';
|
|
|
|
import search from './search';
|
|
|
|
import server from './server';
|
|
|
|
import settings from './settings';
|
|
|
|
import status_lists from './status_lists';
|
|
|
|
import statuses from './statuses';
|
|
|
|
import suggestions from './suggestions';
|
2022-07-22 14:52:06 +01:00
|
|
|
import tags from './tags';
|
2023-05-10 11:59:29 +01:00
|
|
|
import timelines from './timelines';
|
|
|
|
import trends from './trends';
|
|
|
|
import user_lists from './user_lists';
|
2016-08-24 16:56:44 +01:00
|
|
|
|
2017-07-07 23:06:02 +01:00
|
|
|
const reducers = {
|
2020-01-23 21:00:13 +00:00
|
|
|
announcements,
|
2018-03-07 01:26:43 +00:00
|
|
|
dropdown_menu,
|
2016-08-31 15:15:12 +01:00
|
|
|
timelines,
|
|
|
|
meta,
|
2016-11-20 18:39:18 +00:00
|
|
|
alerts,
|
2016-09-19 22:25:59 +01:00
|
|
|
loadingBar: loadingBarReducer,
|
2023-05-25 14:42:37 +01:00
|
|
|
modal: modalReducer,
|
2016-10-27 20:59:56 +01:00
|
|
|
user_lists,
|
2018-03-30 11:38:00 +01:00
|
|
|
domain_lists,
|
2017-01-16 12:27:58 +00:00
|
|
|
status_lists,
|
2016-10-30 14:06:43 +00:00
|
|
|
accounts,
|
2017-05-03 01:04:16 +01:00
|
|
|
accounts_counters,
|
2021-09-26 04:46:13 +01:00
|
|
|
accounts_map,
|
2016-10-30 14:06:43 +00:00
|
|
|
statuses,
|
2016-11-13 12:04:18 +00:00
|
|
|
relationships,
|
2017-01-20 00:00:14 +00:00
|
|
|
settings,
|
2017-07-13 21:15:32 +01:00
|
|
|
push_notifications,
|
2017-11-15 02:56:41 +00:00
|
|
|
mutes,
|
2019-09-29 20:46:05 +01:00
|
|
|
blocks,
|
2021-02-10 23:53:12 +00:00
|
|
|
boosts,
|
2022-10-05 02:47:56 +01:00
|
|
|
server,
|
2017-06-11 16:07:35 +01:00
|
|
|
contexts,
|
2017-07-09 11:16:08 +01:00
|
|
|
compose,
|
|
|
|
search,
|
|
|
|
media_attachments,
|
|
|
|
notifications,
|
2017-09-13 09:24:33 +01:00
|
|
|
height_cache,
|
2017-09-23 04:40:28 +01:00
|
|
|
custom_emojis,
|
2017-11-24 23:35:37 +00:00
|
|
|
lists,
|
2017-12-05 22:02:27 +00:00
|
|
|
listEditor,
|
2018-11-05 17:52:38 +00:00
|
|
|
listAdder,
|
2018-06-29 14:34:36 +01:00
|
|
|
filters,
|
2018-10-07 22:44:58 +01:00
|
|
|
conversations,
|
2018-10-22 23:08:39 +01:00
|
|
|
suggestions,
|
2019-03-03 21:18:23 +00:00
|
|
|
polls,
|
2019-08-06 16:57:52 +01:00
|
|
|
trends,
|
2020-05-29 15:14:16 +01:00
|
|
|
markers,
|
2020-09-28 12:29:43 +01:00
|
|
|
picture_in_picture,
|
2022-02-09 00:17:07 +00:00
|
|
|
history,
|
2022-07-22 14:52:06 +01:00
|
|
|
tags,
|
2023-01-18 15:44:33 +00:00
|
|
|
followed_tags,
|
2017-07-07 23:06:02 +01:00
|
|
|
};
|
|
|
|
|
2023-06-30 16:03:25 +01:00
|
|
|
// We want the root state to be an ImmutableRecord, which is an object with a defined list of keys,
|
|
|
|
// so it is properly typed and keys can be accessed using `state.<key>` syntax.
|
|
|
|
// This will allow an easy conversion to a plain object once we no longer call `get` or `getIn` on the root state
|
|
|
|
|
|
|
|
// By default with `combineReducers` it is a Collection, so we provide our own implementation to get a Record
|
|
|
|
const initialRootState = Object.fromEntries(
|
|
|
|
Object.entries(reducers).map(([name, reducer]) => [
|
|
|
|
name,
|
|
|
|
reducer(undefined, {
|
|
|
|
// empty action
|
|
|
|
}),
|
2023-07-13 10:26:45 +01:00
|
|
|
]),
|
2023-06-30 16:03:25 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
const RootStateRecord = ImmutableRecord(initialRootState, 'RootState');
|
|
|
|
|
|
|
|
const rootReducer = combineReducers(reducers, RootStateRecord);
|
2023-05-09 15:56:26 +01:00
|
|
|
|
|
|
|
export { rootReducer };
|