import { Descriptions, Table } from 'antd' import { ColumnsType } from 'antd/lib/table/interface' import React from 'react' import { useTranslation } from 'react-i18next' import { FormPagerFragment } from '../../../graphql/fragment/form.pager.fragment' import { SubmissionFieldFragment, SubmissionFragment, } from '../../../graphql/fragment/submission.fragment' import { fieldTypes } from '../types' interface Props { form: FormPagerFragment submission: SubmissionFragment } export const SubmissionValues: React.FC = (props) => { const { t } = useTranslation() const columns: ColumnsType = [ { title: t('submission:field'), render(_, row) { if (row.field) { return `${row.field.title}${row.field.required ? '*' : ''}` } return `${row.id}` }, }, { title: t('submission:value'), render(_, row) { try { return fieldTypes[row.type]?.displayValue(row.value) } catch (e) { return row.value } }, }, ] return (
{props.submission.geoLocation.country} {props.submission.geoLocation.city} {props.submission.device.type} {props.submission.device.name} ) }