import { parse } from 'query-string'; import React from 'react'; import { Link, Redirect, RouteComponentProps } from 'react-router-dom'; import { parseJsonOrDefault } from '../../helpers'; import ErrorBox from '../components/error-box'; import { BackIcon } from '../components/icons'; import InfoBox from '../components/info-box'; import { dataFields } from '../data_fields'; import { User } from '../models/user'; import DataEntry from './data-components/data-entry'; import Sidebar from './sidebar'; interface MultiEditProps { user?: User; category: string; dataString: string; } const MultiEdit: React.FC = (props) => { if (!props.user){ return ; } if (props.category === 'like') { // special case for likes return (

Like me!

Back to view Back to edit
); } let data = parseJsonOrDefault(props.dataString); let error: string; if(data == null) { error = 'Invalid parameters supplied'; data = {}; } else if(Object.values(data).some(x => x == undefined)) { error = 'Cannot copy empty values'; data = {}; } return (

Copy {props.category} data

{ error ? : } { Object.keys(data).map((key => { const info = dataFields[key] || {}; return ( ); })) }
Back to view Back to edit
); }; export default MultiEdit;