2023-06-30 17:03:25 +02:00
|
|
|
import { Record as ImmutableRecord } from 'immutable';
|
|
|
|
|
2016-09-19 23:25:59 +02:00
|
|
|
import { loadingBarReducer } from 'react-redux-loading-bar';
|
2023-05-10 12:59:29 +02:00
|
|
|
import { combineReducers } from 'redux-immutable';
|
|
|
|
|
2016-11-20 19:39:18 +01:00
|
|
|
import accounts from './accounts';
|
2017-05-03 02:04:16 +02:00
|
|
|
import accounts_counters from './accounts_counters';
|
2023-05-10 12:59:29 +02:00
|
|
|
import accounts_map from './accounts_map';
|
|
|
|
import alerts from './alerts';
|
|
|
|
import announcements from './announcements';
|
2019-09-29 21:46:05 +02:00
|
|
|
import blocks from './blocks';
|
2021-02-11 00:53:12 +01:00
|
|
|
import boosts from './boosts';
|
2017-07-09 12:16:08 +02:00
|
|
|
import compose from './compose';
|
2023-05-10 12:59:29 +02:00
|
|
|
import contexts from './contexts';
|
|
|
|
import conversations from './conversations';
|
2017-09-23 05:40:28 +02:00
|
|
|
import custom_emojis from './custom_emojis';
|
2023-05-10 12:59:29 +02:00
|
|
|
import domain_lists from './domain_lists';
|
2023-09-22 18:18:46 +02:00
|
|
|
import { dropdownMenuReducer } from './dropdown_menu';
|
2018-06-29 15:34:36 +02:00
|
|
|
import filters from './filters';
|
2023-05-10 12:59:29 +02: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 16:14:16 +02:00
|
|
|
import markers from './markers';
|
2023-05-10 12:59:29 +02:00
|
|
|
import media_attachments from './media_attachments';
|
|
|
|
import meta from './meta';
|
2023-05-25 15:42:37 +02:00
|
|
|
import { modalReducer } from './modal';
|
2023-05-10 12:59:29 +02:00
|
|
|
import mutes from './mutes';
|
|
|
|
import notifications from './notifications';
|
2020-09-28 13:29:43 +02:00
|
|
|
import picture_in_picture from './picture_in_picture';
|
2023-05-10 12:59:29 +02: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 15:52:06 +02:00
|
|
|
import tags from './tags';
|
2023-05-10 12:59:29 +02:00
|
|
|
import timelines from './timelines';
|
|
|
|
import trends from './trends';
|
|
|
|
import user_lists from './user_lists';
|
2016-08-24 17:56:44 +02:00
|
|
|
|
2017-07-08 00:06:02 +02:00
|
|
|
const reducers = {
|
2020-01-23 22:00:13 +01:00
|
|
|
announcements,
|
2023-09-22 18:18:46 +02:00
|
|
|
dropdownMenu: dropdownMenuReducer,
|
2016-08-31 16:15:12 +02:00
|
|
|
timelines,
|
|
|
|
meta,
|
2016-11-20 19:39:18 +01:00
|
|
|
alerts,
|
2016-09-19 23:25:59 +02:00
|
|
|
loadingBar: loadingBarReducer,
|
2023-05-25 15:42:37 +02:00
|
|
|
modal: modalReducer,
|
2016-10-27 21:59:56 +02:00
|
|
|
user_lists,
|
2018-03-30 12:38:00 +02:00
|
|
|
domain_lists,
|
2017-01-16 13:27:58 +01:00
|
|
|
status_lists,
|
2016-10-30 15:06:43 +01:00
|
|
|
accounts,
|
2017-05-03 02:04:16 +02:00
|
|
|
accounts_counters,
|
2021-09-26 05:46:13 +02:00
|
|
|
accounts_map,
|
2016-10-30 15:06:43 +01:00
|
|
|
statuses,
|
2016-11-13 13:04:18 +01:00
|
|
|
relationships,
|
2017-01-20 01:00:14 +01:00
|
|
|
settings,
|
2017-07-13 22:15:32 +02:00
|
|
|
push_notifications,
|
2017-11-15 03:56:41 +01:00
|
|
|
mutes,
|
2019-09-29 21:46:05 +02:00
|
|
|
blocks,
|
2021-02-11 00:53:12 +01:00
|
|
|
boosts,
|
2022-10-05 03:47:56 +02:00
|
|
|
server,
|
2017-06-11 17:07:35 +02:00
|
|
|
contexts,
|
2017-07-09 12:16:08 +02:00
|
|
|
compose,
|
|
|
|
search,
|
|
|
|
media_attachments,
|
|
|
|
notifications,
|
2017-09-13 10:24:33 +02:00
|
|
|
height_cache,
|
2017-09-23 05:40:28 +02:00
|
|
|
custom_emojis,
|
2017-11-25 00:35:37 +01:00
|
|
|
lists,
|
2017-12-05 23:02:27 +01:00
|
|
|
listEditor,
|
2018-11-05 18:52:38 +01:00
|
|
|
listAdder,
|
2018-06-29 15:34:36 +02:00
|
|
|
filters,
|
2018-10-07 23:44:58 +02:00
|
|
|
conversations,
|
2018-10-23 00:08:39 +02:00
|
|
|
suggestions,
|
2019-03-03 22:18:23 +01:00
|
|
|
polls,
|
2019-08-06 17:57:52 +02:00
|
|
|
trends,
|
2020-05-29 16:14:16 +02:00
|
|
|
markers,
|
2020-09-28 13:29:43 +02:00
|
|
|
picture_in_picture,
|
2022-02-09 01:17:07 +01:00
|
|
|
history,
|
2022-07-22 15:52:06 +02:00
|
|
|
tags,
|
2023-01-18 16:44:33 +01:00
|
|
|
followed_tags,
|
2017-07-08 00:06:02 +02:00
|
|
|
};
|
|
|
|
|
2023-06-30 17:03:25 +02: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 11:26:45 +02:00
|
|
|
]),
|
2023-06-30 17:03:25 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
const RootStateRecord = ImmutableRecord(initialRootState, 'RootState');
|
|
|
|
|
|
|
|
const rootReducer = combineReducers(reducers, RootStateRecord);
|
2023-05-09 16:56:26 +02:00
|
|
|
|
|
|
|
export { rootReducer };
|