import React, { useState } from 'react';
import { Icon } from 'UI';
import cn from 'classnames';
import stl from './errorFrame.module.css';
import { useTranslation } from 'react-i18next';
function ErrorFrame({ frame = {}, showRaw, isFirst }) {
const { t } = useTranslation();
const [open, setOpen] = useState(isFirst);
const hasContext = frame.context && frame.context.length > 0;
return (
{showRaw ? (
{t('at')}
{frame.function ? frame.function : '?'}{' '}
({`${frame.filename}:${frame.lineNo}:${frame.colNo}`})
) : (
setOpen(!open)}
>
{frame.absPath}
{frame.function && (
<>
{t('in')}
{frame.function}
>
)}
{t('at line')}
{frame.lineNo}:{frame.colNo}
{hasContext && (
)}
{open && hasContext && (
{frame.context.map((i) => (
-
{i[1].replace(/ /g, '\u00a0')}
))}
)}
)}
);
}
export default ErrorFrame;