signal-desktop/ts/components/CrashReportDialog.stories.tsx

39 lines
976 B
TypeScript
Raw Normal View History

2022-01-11 20:02:46 +00:00
// Copyright 2022 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import React, { useState } from 'react';
import { action } from '@storybook/addon-actions';
import { CrashReportDialog } from './CrashReportDialog';
import { setupI18n } from '../util/setupI18n';
import { sleep } from '../util/sleep';
import enMessages from '../../_locales/en/messages.json';
2022-06-07 00:48:02 +00:00
export default {
title: 'Components/CrashReportDialog',
};
2022-01-11 20:02:46 +00:00
const i18n = setupI18n('en', enMessages);
2022-06-07 00:48:02 +00:00
export const _CrashReportDialog = (): JSX.Element => {
2022-01-11 20:02:46 +00:00
const [isPending, setIsPending] = useState(false);
return (
<CrashReportDialog
i18n={i18n}
isPending={isPending}
uploadCrashReports={async () => {
setIsPending(true);
action('uploadCrashReports')();
await sleep(5000);
setIsPending(false);
}}
eraseCrashReports={action('eraseCrashReports')}
/>
);
2022-06-07 00:48:02 +00:00
};
_CrashReportDialog.story = {
name: 'CrashReportDialog',
};