* chore: code split sagas and reducers index file * fix: update imports * chore: remove acl reducers file on ce * fix: code split reducers properly * chore: remove unnecessary import * chore: split root sagas file
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import { createSelector } from "reselect";
|
|
import { AppState } from "@appsmith/reducers";
|
|
import { AppCollabReducerState } from "reducers/uiReducers/appCollabReducer";
|
|
import { getCurrentUser, selectFeatureFlags } from "./usersSelectors";
|
|
import { User } from "entities/AppCollab/CollabInterfaces";
|
|
import { ANONYMOUS_USERNAME } from "constants/userConstants";
|
|
|
|
export const getAppCollabState = (state: AppState) => state.ui.appCollab;
|
|
|
|
export const getRealtimeAppEditors = createSelector(
|
|
getAppCollabState,
|
|
getCurrentUser,
|
|
(appCollab: AppCollabReducerState, currentUser) =>
|
|
appCollab.editors.filter((el) => el.email !== currentUser?.email),
|
|
);
|
|
|
|
export const isMultiplayerEnabledForUser = createSelector(
|
|
selectFeatureFlags,
|
|
(featureFlags) => featureFlags.MULTIPLAYER,
|
|
);
|
|
|
|
export const getConcurrentPageEditors = (state: AppState) =>
|
|
state.ui.appCollab.pageEditors;
|
|
|
|
export const isConcurrentPageEditorToastVisible = createSelector(
|
|
getConcurrentPageEditors,
|
|
getCurrentUser,
|
|
(pageEditors: User[], currentUser?: User) => {
|
|
if (
|
|
pageEditors.length === 0 ||
|
|
!currentUser ||
|
|
currentUser.email === ANONYMOUS_USERNAME
|
|
)
|
|
return;
|
|
return pageEditors.some(
|
|
(editor: User) => editor.email !== currentUser?.email,
|
|
);
|
|
},
|
|
);
|