import styled from '@emotion/styled'; import Button from 'sentry/components/button'; import ButtonBar from 'sentry/components/buttonBar'; import {t} from 'sentry/locale'; import space from 'sentry/styles/space'; import { ExceptionType, ExceptionValue, STACK_TYPE, STACK_VIEW, Thread, } from 'sentry/types'; type NotifyOptions = { stackType?: STACK_TYPE; stackView?: STACK_VIEW; }; type Props = { hasHierarchicalGrouping: boolean; exception?: ExceptionType; onChange?: (notifyOptions: NotifyOptions) => void; platform?: string; stackType?: STACK_TYPE; stackView?: STACK_VIEW; stacktrace?: ExceptionValue['stacktrace']; thread?: Thread; }; const CrashActions = ({ hasHierarchicalGrouping, stackView, stackType, stacktrace, thread, exception, platform, onChange, }: Props) => { const hasSystemFrames: boolean = stacktrace?.hasSystemFrames || !!exception?.values?.find(value => !!value.stacktrace?.hasSystemFrames); const hasMinified = !stackType ? false : !!exception?.values?.find(value => value.rawStacktrace) || !!thread?.rawStacktrace; const notify = (options: NotifyOptions) => { if (onChange) { onChange(options); } }; const setStackType = (type: STACK_TYPE) => () => { notify({stackType: type}); }; const setStackView = (view: STACK_VIEW) => () => { notify({stackView: view}); }; const getOriginalButtonLabel = () => { if (platform === 'javascript' || platform === 'node') { return t('Original'); } return t('Symbolicated'); }; const getMinifiedButtonLabel = () => { if (platform === 'javascript' || platform === 'node') { return t('Minified'); } return t('Unsymbolicated'); }; return ( {hasSystemFrames && ( )} {hasMinified && ( )} ); }; export default CrashActions; const ButtonGroupWrapper = styled('div')` display: flex; flex-wrap: wrap; > * { padding: ${space(0.5)} 0; } > *:not(:last-child) { margin-right: ${space(1)}; } `;