Move supportform related redux property in a different reducer
Summary: This diff moves support form related redux prop to a separate reducer under separate supportForm property. Reviewed By: passy Differential Revision: D18272436 fbshipit-source-id: b64c4e041d8dacd305a71db255752a310a46b0d1
This commit is contained in:
committed by
Facebook Github Bot
parent
9ec4ef67ad
commit
7c69aba8fa
@@ -66,10 +66,6 @@ export type ShareType = {
|
|||||||
closeOnFinish: boolean;
|
closeOnFinish: boolean;
|
||||||
} & SubShareType;
|
} & SubShareType;
|
||||||
|
|
||||||
export type NTUsersFormData = {
|
|
||||||
flipper_trace: string | null;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type State = {
|
export type State = {
|
||||||
leftSidebarVisible: boolean;
|
leftSidebarVisible: boolean;
|
||||||
rightSidebarVisible: boolean;
|
rightSidebarVisible: boolean;
|
||||||
@@ -84,7 +80,6 @@ export type State = {
|
|||||||
flipperRating: number | null;
|
flipperRating: number | null;
|
||||||
statusMessages: Array<string>;
|
statusMessages: Array<string>;
|
||||||
xcodeCommandLineToolsDetected: boolean;
|
xcodeCommandLineToolsDetected: boolean;
|
||||||
supportForm: {webState: NTUsersFormData} | null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
type BooleanActionType =
|
type BooleanActionType =
|
||||||
@@ -155,12 +150,6 @@ export type Action =
|
|||||||
payload: {
|
payload: {
|
||||||
isDetected: boolean;
|
isDetected: boolean;
|
||||||
};
|
};
|
||||||
}
|
|
||||||
| {
|
|
||||||
type: 'SET_SUPPORT_FORM_STATE';
|
|
||||||
payload: {
|
|
||||||
webState: NTUsersFormData;
|
|
||||||
} | null;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const initialState: () => State = () => ({
|
export const initialState: () => State = () => ({
|
||||||
@@ -183,7 +172,6 @@ export const initialState: () => State = () => ({
|
|||||||
flipperRating: null,
|
flipperRating: null,
|
||||||
statusMessages: [],
|
statusMessages: [],
|
||||||
xcodeCommandLineToolsDetected: false,
|
xcodeCommandLineToolsDetected: false,
|
||||||
supportForm: null,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function statusMessage(sender: string, msg: string): string {
|
function statusMessage(sender: string, msg: string): string {
|
||||||
@@ -297,8 +285,6 @@ export default function reducer(
|
|||||||
return state;
|
return state;
|
||||||
} else if (action.type === 'SET_XCODE_DETECTED') {
|
} else if (action.type === 'SET_XCODE_DETECTED') {
|
||||||
return {...state, xcodeCommandLineToolsDetected: action.payload.isDetected};
|
return {...state, xcodeCommandLineToolsDetected: action.payload.isDetected};
|
||||||
} else if (action.type === 'SET_SUPPORT_FORM_STATE') {
|
|
||||||
return {...state, supportForm: action.payload};
|
|
||||||
} else {
|
} else {
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
@@ -384,10 +370,3 @@ export const setXcodeDetected = (isDetected: boolean): Action => ({
|
|||||||
type: 'SET_XCODE_DETECTED',
|
type: 'SET_XCODE_DETECTED',
|
||||||
payload: {isDetected},
|
payload: {isDetected},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const setSupportFormState = (
|
|
||||||
payload: {webState: NTUsersFormData} | null,
|
|
||||||
): Action => ({
|
|
||||||
type: 'SET_SUPPORT_FORM_STATE',
|
|
||||||
payload,
|
|
||||||
});
|
|
||||||
|
|||||||
@@ -28,6 +28,10 @@ import plugins, {
|
|||||||
State as PluginsState,
|
State as PluginsState,
|
||||||
Action as PluginsAction,
|
Action as PluginsAction,
|
||||||
} from './plugins';
|
} from './plugins';
|
||||||
|
import supportForm, {
|
||||||
|
State as SupportFormState,
|
||||||
|
Action as SupportFormAction,
|
||||||
|
} from './supportForm';
|
||||||
import settings, {
|
import settings, {
|
||||||
Settings as SettingsState,
|
Settings as SettingsState,
|
||||||
Action as SettingsAction,
|
Action as SettingsAction,
|
||||||
@@ -52,6 +56,7 @@ export type Actions =
|
|||||||
| PluginsAction
|
| PluginsAction
|
||||||
| UserAction
|
| UserAction
|
||||||
| SettingsAction
|
| SettingsAction
|
||||||
|
| SupportFormAction
|
||||||
| {type: 'INIT'};
|
| {type: 'INIT'};
|
||||||
|
|
||||||
export type State = {
|
export type State = {
|
||||||
@@ -62,6 +67,7 @@ export type State = {
|
|||||||
plugins: PluginsState;
|
plugins: PluginsState;
|
||||||
user: UserState & PersistPartial;
|
user: UserState & PersistPartial;
|
||||||
settingsState: SettingsState & PersistPartial;
|
settingsState: SettingsState & PersistPartial;
|
||||||
|
supportForm: SupportFormState;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type Store = ReduxStore<State, Actions>;
|
export type Store = ReduxStore<State, Actions>;
|
||||||
@@ -107,6 +113,7 @@ export default combineReducers<State, Actions>({
|
|||||||
notifications,
|
notifications,
|
||||||
),
|
),
|
||||||
plugins,
|
plugins,
|
||||||
|
supportForm,
|
||||||
user: persistReducer(
|
user: persistReducer(
|
||||||
{
|
{
|
||||||
key: 'user',
|
key: 'user',
|
||||||
|
|||||||
46
src/reducers/supportForm.tsx
Normal file
46
src/reducers/supportForm.tsx
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||||
|
*
|
||||||
|
* This source code is licensed under the MIT license found in the
|
||||||
|
* LICENSE file in the root directory of this source tree.
|
||||||
|
*
|
||||||
|
* @format
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {Actions} from './';
|
||||||
|
export type State = {
|
||||||
|
webState: NTUsersFormData | null;
|
||||||
|
};
|
||||||
|
export type Action = {
|
||||||
|
type: 'SET_SUPPORT_FORM_STATE';
|
||||||
|
payload: NTUsersFormData | null;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type NTUsersFormData = {
|
||||||
|
flipper_trace: string | null;
|
||||||
|
};
|
||||||
|
|
||||||
|
export const initialState: () => State = () => ({
|
||||||
|
webState: null,
|
||||||
|
});
|
||||||
|
export default function reducer(
|
||||||
|
state: State | undefined,
|
||||||
|
action: Actions,
|
||||||
|
): State {
|
||||||
|
state = state || initialState();
|
||||||
|
if (action.type === 'SET_SUPPORT_FORM_STATE') {
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
webState: action.payload,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const setSupportFormState = (
|
||||||
|
payload: NTUsersFormData | null,
|
||||||
|
): Action => ({
|
||||||
|
type: 'SET_SUPPORT_FORM_STATE',
|
||||||
|
payload,
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user