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