import React from 'react'; import { Link } from 'react-router-dom'; import { parseJsonOrDefault } from '../../helpers'; import ErrorBox from '../components/error-box'; 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'; import Categories from './categories'; interface MultiEditProps { user?: User; category: string; dataString: string; } const MultiEdit: React.FC = (props) => { 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;