import React from 'react'; import { JSONTree } from 'UI'; import cn from 'classnames'; import { useTranslation } from 'react-i18next'; interface Props { resource: any; } function GraphQLDetailsModal(props: Props) { const { t } = useTranslation(); const { resource: { variables, response, duration, operationKind, operationName }, // nextClick, // prevClick, // first = false, // last = false, } = props; let jsonVars; let jsonResponse; try { jsonVars = JSON.parse(variables); } catch (e) {} try { jsonResponse = JSON.parse(response); } catch (e) {} const dataClass = cn('p-2 bg-gray-lightest rounded color-gray-darkest'); return (
{t('Operation Name')}
{operationName}
{t('Operation Kind')}
{operationKind}
{t('Duration')}
{duration ? parseInt(duration) : '???'} {t('ms')}
{t('Variables')}
{jsonVars === undefined ? variables : }
{t('Response')}
{jsonResponse === undefined ? ( response ) : ( )}
{/*
*/}
); } export default GraphQLDetailsModal;