Format boolean values in edit history
This commit is contained in:
parent
5a3c3e6f15
commit
ffcf31cb34
@ -6,12 +6,19 @@ interface FieldEditSummaryProps {
|
||||
oldValue: any;
|
||||
}
|
||||
|
||||
function formatValue(value: any) {
|
||||
if(typeof value === 'boolean') {
|
||||
return value ? 'Yes' : 'No';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
const FieldEditSummary: React.FunctionComponent<FieldEditSummaryProps> = props => (
|
||||
<>
|
||||
{props.title}:
|
||||
<code title="Value before edit" className='edit-history-diff old'>{props.oldValue}</code>
|
||||
<code title="Value before edit" className='edit-history-diff old'>{formatValue(props.oldValue)}</code>
|
||||
|
||||
<code title="Value after edit" className='edit-history-diff new'>{props.value}</code>
|
||||
<code title="Value after edit" className='edit-history-diff new'>{formatValue(props.value)}</code>
|
||||
</>
|
||||
);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user