/** * Copyright (c) Meta Platforms, Inc. and 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 React from 'react'; import {Button, Typography} from 'antd'; import {CoffeeOutlined, CopyOutlined, DeleteOutlined} from '@ant-design/icons'; import { usePlugin, useValue, DataList, Layout, CodeBlock, Toolbar, } from 'flipper-plugin'; import {Crash, devicePlugin} from './index'; const {Text} = Typography; export function Crashes() { const plugin = usePlugin(devicePlugin); const crashes = useValue(plugin.crashes); const selectedCrashId = useValue(plugin.selectedCrash); const selectedCrash = crashes.find( (c) => c.notificationID === selectedCrashId, ); return ( ({ id: crash.notificationID, title: crash.reason ?? crash.name, description: `${new Date(crash.date).toLocaleString()} - ${ crash.name }`, }))} selection={selectedCrashId} onSelect={(id) => { plugin.selectedCrash.set(id); }} onRenderEmpty={null} /> {selectedCrash ? ( ) : ( {crashes.length === 0 ? 'No crashes detected so far!' : 'No crash selected'} )} ); } function CrashDetails({crash}: {crash: Crash}) { const plugin = usePlugin(devicePlugin); return ( { plugin.clearCrashes(); }} title="Clear all crashes" danger> }> {plugin.isFB ? ( ) : null} {crash.name}

{crash.reason}

{crash.callstack}
); }