import React, { useState, useEffect, useContext } from 'react'; import { useTranslation } from 'react-i18next'; import { v4 as uuidv4 } from 'uuid'; import set from 'lodash/set'; import TextField from '../../../shared/TextField'; import TextArea from '../../../shared/TextArea'; import AppContext from '../../../context/AppContext'; import Checkbox from '../../../shared/Checkbox'; import { addItem } from '../../../utils'; import ItemActions from '../../../shared/ItemActions'; import ItemHeading from '../../../shared/ItemHeading'; import AddItemButton from '../../../shared/AddItemButton'; const ReferencesTab = ({ data, onChange }) => { const context = useContext(AppContext); const { dispatch } = context; useEffect(() => { if (!('references' in data)) { dispatch({ type: 'migrate_section', payload: { key: 'references', value: { enable: false, heading: 'References', items: [], }, }, }); dispatch({ type: 'save_data' }); } }, [data, dispatch]); return ( 'references' in data && ( <>
onChange('data.references.enable', v)} />
onChange('data.references.heading', v)} />

{data.references.items.map((x, index) => ( ))} ) ); }; const Form = ({ item, onChange, identifier = '' }) => { const { t } = useTranslation(['leftSidebar', 'app']); return (
onChange(`${identifier}name`, v)} /> onChange(`${identifier}position`, v)} /> onChange(`${identifier}phone`, v)} /> onChange(`${identifier}email`, v)} />