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