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