import { combineReducers, AnyAction } from "redux"; import { grantAppealTxs, grantAppealTxsFetching } from "./challenges"; import { government, govtParameters, constitution, appellate, controller, appellateMembers, councilMultisigTransactions, govtProposals, } from "./government"; import { user } from "./userAccount"; import { network, networkName } from "./network"; import { ui, showWeb3AuthModal, web3AuthType } from "./ui"; import { contractAddresses } from "./contractAddresses"; import { Set, Map } from "immutable"; import { MultisigTransaction } from "@joincivil/core"; import { EthAddress, EthContentHeader, ContentData, TxDataAll } from "@joincivil/typescript-types"; import { currentUserNewsrooms, content, contentFetched, charterRevisions } from "./newsrooms"; import { newsrooms, NewsroomState, newsroomUi, newsroomUsers, newsroomGovernment, grantApplication, } from "@joincivil/newsroom-signup"; import { networkActions } from "../actionCreators/network"; export interface State { networkDependent: NetworkDependentState; network: string; networkName: string; ui: Map; showWeb3AuthModal: boolean; web3AuthType: string; newsrooms: Map; newsroomUi: Map; newsroomUsers: Map; newsroomGovernment: Map; grantApplication: Map; } export interface NetworkDependentState { currentUserNewsrooms: Set; content: Map; contentFetched: Map; user: { account: any }; govtParameters: object; govtProposals: Map; grantAppealTxs: Map; grantAppealTxsFetching: Map; government: Map; constitution: Map; appellate: string; controller: string; appellateMembers: string[]; councilMultisigTransactions: Map; contractAddresses: Map; } const networkDependentReducers = combineReducers({ currentUserNewsrooms, content, contentFetched, charterRevisions, user, govtParameters, govtProposals, grantAppealTxs, grantAppealTxsFetching, government, constitution, appellate, controller, appellateMembers, councilMultisigTransactions, contractAddresses, }); const networkDependent = (state: any, action: AnyAction) => { if (action.type === networkActions.SET_NETWORK) { return networkDependentReducers(undefined, action); } return networkDependentReducers(state, action); }; import { connectRouter } from "connected-react-router"; export default (history: any) => combineReducers({ router: connectRouter(history), newsrooms, // have to be top level because come from a package newsroomUi, newsroomUsers, newsroomGovernment, grantApplication, networkDependent, network, networkName, ui, showWeb3AuthModal, web3AuthType, });