Improve error handling / roundtrip behavior

Summary:
Slightly improves the support form interactions / code flow:
* When uploading, input fields are hidden
* WHen upload succeeded: Show link to final post
* When upload succeeded: be able to start a new bug report
* Styled error messages, and unified error flow
* Don't support report if errors occurred

Reviewed By: priteshrnandgaonkar

Differential Revision: D18779791

fbshipit-source-id: 28e873d0509865c66d861fe9cedb62a31f0e8bae
This commit is contained in:
Michel Weststrate
2019-12-03 03:58:06 -08:00
committed by Facebook Github Bot
parent 3e8a026618
commit b1fb67c9c4
2 changed files with 13 additions and 33 deletions

View File

@@ -8,7 +8,7 @@
*/
import React, {PureComponent} from 'react';
import {FlexColumn, Text, styled} from '../ui';
import {Text, styled, Info, VBox} from '../ui';
type Props = {
errors: Array<Error>;
@@ -22,25 +22,6 @@ const ErrorMessage = styled(Text)({
lineHeight: 1.35,
});
const Padder = styled('div')(
({
paddingLeft,
paddingRight,
paddingBottom,
paddingTop,
}: {
paddingLeft?: number;
paddingRight?: number;
paddingBottom?: number;
paddingTop?: number;
}) => ({
paddingLeft: paddingLeft || 0,
paddingRight: paddingRight || 0,
paddingBottom: paddingBottom || 0,
paddingTop: paddingTop || 0,
}),
);
const Title = styled(Text)({
marginBottom: 6,
});
@@ -65,18 +46,16 @@ export default class Popover extends PureComponent<Props> {
return null;
}
return (
<>
<Padder paddingBottom={8}>
<FlexColumn>
<Title bold>
The following errors occurred while exporting your data
</Title>
{this.props.errors.map((e: Error) => (
<ErrorMessage code>{formatError(e)}</ErrorMessage>
))}
</FlexColumn>
</Padder>
</>
<VBox>
<Info type="error">
<Title bold>
The following errors occurred while exporting your data
</Title>
{this.props.errors.map((e: Error) => (
<ErrorMessage code>{formatError(e)}</ErrorMessage>
))}
</Info>
</VBox>
);
}
}

View File

@@ -25,6 +25,7 @@ StyledLink.displayName = 'Link:StyledLink';
export default class Link extends Component<{
href: string;
children?: React.ReactNode;
style?: React.CSSProperties;
}> {
onClick = () => {
shell.openExternal(this.props.href);
@@ -32,7 +33,7 @@ export default class Link extends Component<{
render() {
return (
<StyledLink onClick={this.onClick}>
<StyledLink onClick={this.onClick} style={this.props.style}>
{this.props.children || this.props.href}
</StyledLink>
);