* Implemented code splitting of some files for SAML integration * Implemented code splitting of some more files for SAML integration * updated redirect url component * fixed an import statement * fixed a unit test * updated restart banner tooltip logic * updated an import statement
78 lines
1.8 KiB
TypeScript
78 lines
1.8 KiB
TypeScript
import {
|
|
ReduxAction,
|
|
ReduxActionTypes,
|
|
} from "@appsmith/constants/ReduxActionConstants";
|
|
import { createReducer } from "utils/AppsmithUtils";
|
|
import { User } from "entities/AppCollab/CollabInterfaces";
|
|
import { cloneDeep } from "lodash";
|
|
|
|
const initialState: AppCollabReducerState = {
|
|
editors: [],
|
|
pointerData: {},
|
|
pageEditors: [],
|
|
};
|
|
|
|
const appCollabReducer = createReducer(initialState, {
|
|
[ReduxActionTypes.APP_COLLAB_LIST_EDITORS]: (
|
|
state: AppCollabReducerState,
|
|
action: ReduxAction<any>,
|
|
) => {
|
|
return { ...state, editors: action.payload.users };
|
|
},
|
|
[ReduxActionTypes.APP_COLLAB_RESET_EDITORS]: (
|
|
state: AppCollabReducerState,
|
|
) => {
|
|
return { ...state, editors: [] };
|
|
},
|
|
[ReduxActionTypes.APP_COLLAB_SET_EDITORS_POINTER_DATA]: (
|
|
state: AppCollabReducerState,
|
|
action: ReduxAction<any>,
|
|
) => {
|
|
return {
|
|
...state,
|
|
pointerData: {
|
|
...state.pointerData,
|
|
[action.payload.socketId]: action.payload,
|
|
},
|
|
};
|
|
},
|
|
[ReduxActionTypes.APP_COLLAB_UNSET_EDITORS_POINTER_DATA]: (
|
|
state: AppCollabReducerState,
|
|
action: ReduxAction<any>,
|
|
) => {
|
|
const clonedPointerData = cloneDeep(state.pointerData);
|
|
delete clonedPointerData[action.payload];
|
|
return {
|
|
...state,
|
|
clonedPointerData,
|
|
};
|
|
},
|
|
[ReduxActionTypes.APP_COLLAB_RESET_EDITORS_POINTER_DATA]: (
|
|
state: AppCollabReducerState,
|
|
) => {
|
|
return {
|
|
...state,
|
|
pointerData: {},
|
|
};
|
|
},
|
|
[ReduxActionTypes.APP_COLLAB_SET_CONCURRENT_PAGE_EDITORS]: (
|
|
state: AppCollabReducerState,
|
|
action: ReduxAction<any>,
|
|
) => ({
|
|
...state,
|
|
pageEditors: action.payload,
|
|
}),
|
|
});
|
|
|
|
type PointerDataType = {
|
|
[s: string]: any;
|
|
};
|
|
|
|
export type AppCollabReducerState = {
|
|
editors: User[];
|
|
pointerData: PointerDataType;
|
|
pageEditors: User[];
|
|
};
|
|
|
|
export default appCollabReducer;
|