2021-03-20 14:42:15 +01:00
|
|
|
import React from 'react';
|
2022-11-27 15:11:28 +01:00
|
|
|
import ReactDiffViewer, { DiffMethod } from 'react-diff-viewer-continued';
|
2021-10-14 17:13:12 +02:00
|
|
|
|
2022-11-27 14:35:11 +01:00
|
|
|
import {
|
|
|
|
ModalLayout,
|
|
|
|
ModalBody,
|
|
|
|
ModalHeader,
|
|
|
|
Grid,
|
|
|
|
GridItem,
|
|
|
|
Typography,
|
|
|
|
} from '@strapi/design-system';
|
2021-03-20 14:42:15 +01:00
|
|
|
|
2021-10-14 17:39:53 +02:00
|
|
|
const ConfigDiff = ({ isOpen, onClose, oldValue, newValue, configName }) => {
|
2021-10-14 17:13:12 +02:00
|
|
|
if (!isOpen) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2021-03-20 14:42:15 +01:00
|
|
|
return (
|
2021-10-14 17:13:12 +02:00
|
|
|
<ModalLayout
|
|
|
|
onClose={onClose}
|
|
|
|
labelledBy="title"
|
2021-03-20 14:42:15 +01:00
|
|
|
>
|
2021-10-14 17:13:12 +02:00
|
|
|
<ModalHeader>
|
2022-03-16 21:29:54 +01:00
|
|
|
<Typography variant="omega" fontWeight="bold" textColor="neutral800">
|
2021-10-14 17:13:12 +02:00
|
|
|
Config changes for {configName}
|
2022-03-16 21:29:54 +01:00
|
|
|
</Typography>
|
2021-10-14 17:13:12 +02:00
|
|
|
</ModalHeader>
|
|
|
|
<ModalBody>
|
2021-11-19 20:39:32 +01:00
|
|
|
<Grid paddingBottom={4} style={{ textAlign: 'center' }}>
|
|
|
|
<GridItem col={6}>
|
|
|
|
<Typography variant="delta">Sync directory</Typography>
|
|
|
|
</GridItem>
|
|
|
|
<GridItem col={6}>
|
|
|
|
<Typography variant="delta">Database</Typography>
|
|
|
|
</GridItem>
|
|
|
|
</Grid>
|
|
|
|
<ReactDiffViewer
|
|
|
|
oldValue={JSON.stringify(oldValue, null, 2)}
|
|
|
|
newValue={JSON.stringify(newValue, null, 2)}
|
|
|
|
splitView
|
|
|
|
compareMethod={DiffMethod.WORDS}
|
|
|
|
/>
|
2021-03-20 14:42:15 +01:00
|
|
|
</ModalBody>
|
2021-10-14 17:13:12 +02:00
|
|
|
</ModalLayout>
|
2021-03-20 14:42:15 +01:00
|
|
|
);
|
2021-10-14 17:39:53 +02:00
|
|
|
};
|
2021-10-14 17:13:12 +02:00
|
|
|
|
|
|
|
export default ConfigDiff;
|