diff --git a/ui/src/index.tsx b/ui/src/index.tsx index c8a6a4f..e2990e5 100644 --- a/ui/src/index.tsx +++ b/ui/src/index.tsx @@ -9,13 +9,12 @@ import {CurrentUser} from './CurrentUser'; import {AppStore} from './application/AppStore'; import {WebSocketStore} from './message/WebSocketStore'; import {SnackManager} from './snack/SnackManager'; -import {InjectProvider, StoreMapping} from './inject'; import {UserStore} from './user/UserStore'; import {MessagesStore} from './message/MessagesStore'; import {ClientStore} from './client/ClientStore'; import {PluginStore} from './plugin/PluginStore'; import {registerReactions} from './reactions'; -import {StoreContext} from './stores'; +import {StoreContext, StoreMapping} from './stores'; const {port, hostname, protocol, pathname} = window.location; const slashes = protocol.concat('//'); diff --git a/ui/src/inject.tsx b/ui/src/inject.tsx deleted file mode 100644 index 6e16721..0000000 --- a/ui/src/inject.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import * as React from 'react'; -import {UserStore} from './user/UserStore'; -import {SnackManager} from './snack/SnackManager'; -import {MessagesStore} from './message/MessagesStore'; -import {CurrentUser} from './CurrentUser'; -import {ClientStore} from './client/ClientStore'; -import {AppStore} from './application/AppStore'; -import {inject as mobxInject, Provider} from 'mobx-react'; -import {WebSocketStore} from './message/WebSocketStore'; -import {PluginStore} from './plugin/PluginStore'; - -export interface StoreMapping { - userStore: UserStore; - snackManager: SnackManager; - messagesStore: MessagesStore; - currentUser: CurrentUser; - clientStore: ClientStore; - appStore: AppStore; - pluginStore: PluginStore; - wsStore: WebSocketStore; -} - -export type AllStores = Extract; -export type Stores = Pick; - -export const inject = - (...stores: I[]) => -

( - node: React.ComponentType

- ): React.ComponentType>> => - // eslint-disable-next-line @typescript-eslint/no-explicit-any - mobxInject(...stores)(node) as any; - -export const InjectProvider: React.FC<{stores: StoreMapping}> = ({children, stores}) => ( - {children} -); diff --git a/ui/src/reactions.ts b/ui/src/reactions.ts index 5e27aec..0f980bd 100644 --- a/ui/src/reactions.ts +++ b/ui/src/reactions.ts @@ -1,6 +1,6 @@ -import {StoreMapping} from './inject'; import {reaction} from 'mobx'; import * as Notifications from './snack/browserNotification'; +import {StoreMapping} from './stores'; export const registerReactions = (stores: StoreMapping) => { const clearAll = () => {