UNPKG

@craftercms/studio-ui

Version:

Services, components, models & utils to build CrafterCMS authoring extensions.

115 lines (113 loc) 3.73 kB
/* * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License version 3 as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* * Copyright (C) 2007-2022 Crafter Software Corporation. All Rights Reserved. * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 3 as published by * the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import React from 'react'; import { makeStyles } from 'tss-react/mui'; import AceEditor from '../AceEditor/AceEditor'; import ConflictedPathDiffDialogSplitView from './ConflictedPathDiffDialogSplitView'; import Grid from '@mui/material/Grid'; import Typography from '@mui/material/Typography'; import { FormattedMessage } from 'react-intl'; const tabsHeight = 450; const useStyles = makeStyles()((theme) => ({ diffTab: { height: tabsHeight, overflowX: 'auto', '& .ace_editor': { margin: 0 } }, diffContent: { fontSize: '14px', background: 'none', border: 'none' }, splitView: { width: '100%', height: 'calc(100% - 24px)', '&.unChanged': { height: 'auto' } }, labelsContainer: { width: 'calc(100% - 30px)', textAlign: 'center', backgroundColor: theme.palette.background.paper } })); export function ConflictedPathDiffDialogUI(props) { const { resource, tab } = props; const fileDiff = resource.read(); const { classes } = useStyles(); return React.createElement( React.Fragment, null, tab === 0 && React.createElement( 'div', { className: classes.diffTab }, React.createElement(AceEditor, { mode: 'ace/mode/diff', autoFocus: false, readOnly: true, value: fileDiff.diff }) ), tab === 1 && React.createElement( 'div', { className: classes.diffTab }, React.createElement( Grid, { container: true, className: classes.labelsContainer }, React.createElement( Grid, { item: true, xs: 6 }, React.createElement( Typography, { variant: 'body1' }, React.createElement(FormattedMessage, { id: 'words.local', defaultMessage: 'Local' }) ) ), React.createElement( Grid, { item: true, xs: 6 }, React.createElement( Typography, { variant: 'body1' }, React.createElement(FormattedMessage, { id: 'words.remote', defaultMessage: 'Remote' }) ) ) ), React.createElement(ConflictedPathDiffDialogSplitView, { diff: fileDiff, className: classes.splitView }) ) ); } export default ConflictedPathDiffDialogUI;