Migrate ShareSheet from js to ts
Summary: Migrated ShareSheet.js to ShareSheet.tsx Reviewed By: jknoxville Differential Revision: D16734361 fbshipit-source-id: a6c050be19892f1650c1652536a62e4324ad949a
This commit is contained in:
committed by
Facebook Github Bot
parent
d9cb55c8ae
commit
3e11e8887d
@@ -13,7 +13,7 @@ import TitleBar from './chrome/TitleBar.tsx';
|
|||||||
import MainSidebar from './chrome/MainSidebar.tsx';
|
import MainSidebar from './chrome/MainSidebar.tsx';
|
||||||
import BugReporterDialog from './chrome/BugReporterDialog.tsx';
|
import BugReporterDialog from './chrome/BugReporterDialog.tsx';
|
||||||
import ErrorBar from './chrome/ErrorBar.tsx';
|
import ErrorBar from './chrome/ErrorBar.tsx';
|
||||||
import ShareSheet from './chrome/ShareSheet.js';
|
import ShareSheet from './chrome/ShareSheet.tsx';
|
||||||
import SignInSheet from './chrome/SignInSheet.js';
|
import SignInSheet from './chrome/SignInSheet.js';
|
||||||
import ExportDataPluginSheet from './chrome/ExportDataPluginSheet.tsx';
|
import ExportDataPluginSheet from './chrome/ExportDataPluginSheet.tsx';
|
||||||
import ShareSheetExportFile from './chrome/ShareSheetExportFile.js';
|
import ShareSheetExportFile from './chrome/ShareSheetExportFile.js';
|
||||||
|
|||||||
@@ -12,24 +12,21 @@ import {
|
|||||||
colors,
|
colors,
|
||||||
Text,
|
Text,
|
||||||
LoadingIndicator,
|
LoadingIndicator,
|
||||||
Component,
|
|
||||||
FlexRow,
|
FlexRow,
|
||||||
Spacer,
|
Spacer,
|
||||||
Input,
|
Input,
|
||||||
} from 'flipper';
|
} from 'flipper';
|
||||||
import {
|
import React, {Component} from 'react';
|
||||||
setExportStatusComponent,
|
import {setExportStatusComponent, unsetShare} from '../reducers/application';
|
||||||
unsetShare,
|
import {Logger} from '../fb-interfaces/Logger.js';
|
||||||
} from '../reducers/application.tsx';
|
|
||||||
import type {Logger} from '../fb-interfaces/Logger.js';
|
|
||||||
import {Idler} from '../utils/Idler';
|
import {Idler} from '../utils/Idler';
|
||||||
import {shareFlipperData} from '../fb-stubs/user.tsx';
|
import {shareFlipperData} from '../fb-stubs/user';
|
||||||
import {exportStore, EXPORT_FLIPPER_TRACE_EVENT} from '../utils/exportData.tsx';
|
import {exportStore, EXPORT_FLIPPER_TRACE_EVENT} from '../utils/exportData';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import {clipboard} from 'electron';
|
import {clipboard} from 'electron';
|
||||||
import ShareSheetErrorList from './ShareSheetErrorList.js';
|
import ShareSheetErrorList from './ShareSheetErrorList.js';
|
||||||
import {reportPlatformFailures} from '../utils/metrics';
|
import {reportPlatformFailures} from '../utils/metrics';
|
||||||
import CancellableExportStatus from './CancellableExportStatus.tsx';
|
import CancellableExportStatus from './CancellableExportStatus';
|
||||||
// $FlowFixMe: Missing type defs for node built-in.
|
// $FlowFixMe: Missing type defs for node built-in.
|
||||||
import {performance} from 'perf_hooks';
|
import {performance} from 'perf_hooks';
|
||||||
export const SHARE_FLIPPER_TRACE_EVENT = 'share-flipper-link';
|
export const SHARE_FLIPPER_TRACE_EVENT = 'share-flipper-link';
|
||||||
@@ -72,21 +69,23 @@ const ErrorMessage = styled(Text)({
|
|||||||
});
|
});
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
onHide: () => mixed,
|
onHide: () => any;
|
||||||
logger: Logger,
|
logger: Logger;
|
||||||
};
|
};
|
||||||
type State = {
|
type State = {
|
||||||
runInBackground: boolean,
|
runInBackground: boolean;
|
||||||
errorArray: Array<Error>,
|
errorArray: Array<Error>;
|
||||||
result:
|
result:
|
||||||
| ?{
|
| {
|
||||||
error_class: string,
|
error_class: string;
|
||||||
error: string,
|
error: string;
|
||||||
}
|
}
|
||||||
| {
|
| {
|
||||||
flipperUrl: string,
|
flipperUrl: string;
|
||||||
},
|
}
|
||||||
statusUpdate: ?string,
|
| null
|
||||||
|
| undefined;
|
||||||
|
statusUpdate: string | null | undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class ShareSheet extends Component<Props, State> {
|
export default class ShareSheet extends Component<Props, State> {
|
||||||
@@ -142,7 +141,7 @@ export default class ShareSheet extends Component<Props, State> {
|
|||||||
this.setState({errorArray, result});
|
this.setState({errorArray, result});
|
||||||
if (result.flipperUrl) {
|
if (result.flipperUrl) {
|
||||||
clipboard.writeText(String(result.flipperUrl));
|
clipboard.writeText(String(result.flipperUrl));
|
||||||
new window.Notification('Sharable Flipper trace created', {
|
new Notification('Sharable Flipper trace created', {
|
||||||
body: 'URL copied to clipboard',
|
body: 'URL copied to clipboard',
|
||||||
requireInteraction: true,
|
requireInteraction: true,
|
||||||
});
|
});
|
||||||
@@ -160,7 +159,10 @@ export default class ShareSheet extends Component<Props, State> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderTheProgessState(onHide: () => void, statusUpdate: ?string) {
|
renderTheProgessState(
|
||||||
|
onHide: () => void,
|
||||||
|
statusUpdate: string | null | undefined,
|
||||||
|
) {
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<FlexColumn>
|
<FlexColumn>
|
||||||
@@ -267,3 +267,12 @@ export const setFlipperRating = (rating: number): Action => ({
|
|||||||
rating,
|
rating,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export const unsetShare = (): Action => ({
|
||||||
|
type: UNSET_SHARE,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const setExportStatusComponent = (payload: JSX.Element): Action => ({
|
||||||
|
type: SET_EXPORT_STATUS_MESSAGE,
|
||||||
|
payload,
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user