Make it possible to export support form V2 with meta data

Summary:
This diff enables a full roundtrip of exporting a bug report to file / link, and importing it again.

Styling is not part of this story.

Reviewed By: jknoxville

Differential Revision: D18636418

fbshipit-source-id: ef9a8e3622bdac9361f612d51415a593f4268b80
This commit is contained in:
Michel Weststrate
2019-11-21 08:00:25 -08:00
committed by Facebook Github Bot
parent f33666a4b9
commit dd65ec6ed0
7 changed files with 77 additions and 55 deletions

View File

@@ -169,6 +169,14 @@ const reducer = (state: State = INITAL_STATE, action: Actions): State => {
selectedPlugin: payload != null ? null : selectedPlugin,
};
}
case 'RESET_SUPPORT_FORM_V2_STATE': {
return updateSelection({
...state,
staticView: null,
});
}
case 'SELECT_DEVICE': {
const {payload} = action;
return updateSelection({

View File

@@ -13,6 +13,8 @@ export type SupportFormV2State = {
description: string;
commitHash: string;
appName: string;
screenshots?: {image: string; description: string}[];
videos?: {url: string; description: string}[];
};
export type State = {
@@ -27,6 +29,9 @@ export type Action =
| {
type: 'SET_SUPPORT_FORM_V2_STATE';
payload: SupportFormV2State;
}
| {
type: 'RESET_SUPPORT_FORM_V2_STATE';
};
export type NTUsersFormData = {
@@ -66,6 +71,8 @@ export default function reducer(
...state,
supportFormV2: action.payload,
};
} else if (action.type === 'RESET_SUPPORT_FORM_V2_STATE') {
return initialState();
} else {
return state;
}
@@ -82,3 +89,7 @@ export const setSupportFormV2State = (payload: SupportFormV2State): Action => ({
type: 'SET_SUPPORT_FORM_V2_STATE',
payload,
});
export const resetSupportFormV2State = (): Action => ({
type: 'RESET_SUPPORT_FORM_V2_STATE',
});