Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3941] New Content Diff UX #4165

Open
wants to merge 147 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
b8c95e5
Make content diff better - initial work #3941
jvega190 Oct 18, 2023
043d874
Replace makeStyles with sx #3941
jvega190 Oct 19, 2023
d4283ad
Styles, ContentInstanceComponents and MonacoWrapper updates #3941
jvega190 Oct 19, 2023
7c8f210
Merge branch 'develop' of https://github.com/craftercms/studio-ui int…
jvega190 Oct 20, 2023
14f5545
Compare Dialog updates, add compareTo action to versions in CompareVe…
jvega190 Oct 20, 2023
3783254
Update unchaged accordion styles in ContentInstanceComponents #3941
jvega190 Oct 30, 2023
75f89e7
Merge branch 'develop' of https://github.com/craftercms/studio-ui int…
jvega190 Nov 22, 2023
246252f
Update diff for node-selector #3941
jvega190 Nov 23, 2023
9448a71
Merge branch 'develop' of https://github.com/craftercms/studio-ui int…
jvega190 Dec 6, 2023
0780d9c
Add/update rendering of diff for video, date-time, time, checkbox. Up…
jvega190 Dec 6, 2023
28e5139
Added checkbox group initial diff rendering, update monaco editor wit…
jvega190 Dec 7, 2023
1b05c6c
Add default compare render, validate empty fields and add a default f…
jvega190 Dec 20, 2023
21a8456
Add xml comparison (global and for node-selector and repeating group)…
jvega190 Dec 22, 2023
b739a28
Merge branch 'develop' of https://github.com/craftercms/studio-ui int…
jvega190 Jul 3, 2024
5c977d3
Merge branch 'develop' of https://github.com/craftercms/studio-ui int…
jvega190 Aug 9, 2024
c0610ec
[3941] Update after merge, restore leftActions in CompareVersionsDialog
jvega190 Aug 9, 2024
6a6573a
[3941] Show monaco editor for textarea diff, update time control time…
jvega190 Aug 12, 2024
6a9b9e9
[3941] Rep-groups diff
jvega190 Aug 19, 2024
40d6336
[3941] Refactor, enhance objects comparison in diff dialog, rep-group…
jvega190 Aug 23, 2024
8e83ed1
[3941] CompareVersions updates, ViewVersionDialog work
jvega190 Aug 27, 2024
4956acc
[3941] Fix issue comparing possible null content (instead of empty ob…
jvega190 Aug 27, 2024
c5e79b8
[3941] Validate empty content before doing a map
jvega190 Aug 28, 2024
7483ec8
[3941] Update to consider systemProps
jvega190 Aug 28, 2024
44979ea
[3941] Validate possible non-existing contentA or contentB (no item s…
jvega190 Sep 10, 2024
b9a1983
Merge branch 'develop' of https://github.com/craftercms/studio-ui int…
jvega190 Sep 10, 2024
2316ac3
[3941] CompareVersions, update after merge
jvega190 Sep 10, 2024
b4586df
[3941] Sidebar view, single field view
jvega190 Sep 11, 2024
9659a91
[3941] Filter fields in CompareVersionsDialogContainer, update height…
jvega190 Sep 11, 2024
58f773c
[3941] Pre-select first diff field
jvega190 Sep 12, 2024
e1bac5c
[3941] Update CompareVersionsDialog height
jvega190 Sep 12, 2024
485c086
[3941] automaticLayout option in mocaco editor to handle window resizing
jvega190 Sep 12, 2024
dbd5b56
[3941] Adjust dialog content height for content to display properly
jvega190 Sep 12, 2024
36f3404
[3941] Design updates, components restructure
jvega190 Sep 13, 2024
a052bb7
[3941] Remove contextmenu from monacoWrapper
jvega190 Sep 13, 2024
9305dc1
[3941] Add content-type info in CompareVersionsDialogContainer
jvega190 Sep 13, 2024
5aaf377
[3941] Add info icon to diff view toolbar
jvega190 Sep 13, 2024
1d7a8dd
[3941] CompareVersionsDialog actions update
jvega190 Sep 13, 2024
1c80e9c
[3941] ContentInstance and RepeatGroup diff components updates
jvega190 Sep 16, 2024
15a5ea5
[3941] Image diff layout updates
jvega190 Sep 16, 2024
fee1bf8
[3941] Update components to handle a subDialog for repeating group diff
jvega190 Sep 16, 2024
486cabd
[3941] Update enhancedDialog to support text in header actions, remov…
jvega190 Sep 17, 2024
c7c953c
[3941] Add compare 'subdialog' to CompareVersionsDialog, update ViewI…
jvega190 Sep 18, 2024
a4ad9f1
[3941] ViewVersionDialog design updates, created FieldVersionToolbar …
jvega190 Sep 18, 2024
dd4a10f
[3941] ViewVersionDialog updates to support pre-fetched data
jvega190 Sep 18, 2024
b8a7b86
[3941] RepeatGroupItems updates to view single item version, simplify…
jvega190 Sep 18, 2024
1d97d1a
[3941] RepeatGroupItems updates, use cx, update hover/select styles
jvega190 Sep 19, 2024
0a6b863
[3941] ContentInstanceComponents open embedded components diff when t…
jvega190 Sep 19, 2024
b2dc9f7
[3941] Add backdrop to CompareVersionsDialog when sub view is open, c…
jvega190 Sep 19, 2024
e0790ff
[3941] Fix wrapping of texts in FieldVersionToolbar and Node Selector…
jvega190 Sep 19, 2024
51c25ed
[3941] Update MonacoWrapper to use monaco-editor/react
jvega190 Sep 19, 2024
7c25706
[3941] Refactor and created new component for item's diff state
jvega190 Sep 20, 2024
ed48536
[3941] Update jsdiff
jvega190 Sep 23, 2024
dc7e378
[3941] Fix View/Compare sub panels not showing content in xml view
jvega190 Sep 23, 2024
c9f8cd7
[3941] RepeatGroup items diff view, fix comparison between 2 multi-si…
jvega190 Sep 23, 2024
33429bb
[3941] Monaco editor diff enhancements
jvega190 Sep 23, 2024
dc5e1b8
[3941] Monaco diff editor/FieldVersionToolbar actions updates
jvega190 Sep 24, 2024
00125e3
[3941] useMonacoOptions hook update, Update ItemViewVersion to use th…
jvega190 Sep 24, 2024
35d3f98
[3941] Remove diffArrays util
jvega190 Sep 24, 2024
a0d224b
[3941] Add subViewPanel in ViewVersionDialog
jvega190 Sep 24, 2024
cca627f
[3941] Fix comparison between embedded components with one of them null
jvega190 Sep 24, 2024
3307b49
[3941] align viewField content to center, fix monaco editor options n…
jvega190 Sep 25, 2024
baa93fa
[3941] Disable compare option in HistoryDialog if only 1 version
jvega190 Sep 25, 2024
2367ae2
[3941] Fix Disable field not showing in Compare Versions Dialog
jvega190 Sep 25, 2024
1bc780a
[3941] CompareVersionsDialog, unmount SubPanels content when closed
jvega190 Sep 25, 2024
2eabd33
[3941] Enhance error handling (be able to recover) in compareVersions…
jvega190 Sep 26, 2024
da62b6f
[3941] Revert getContentInstanceValueFromProp update as it is not needed
jvega190 Sep 26, 2024
9f2036d
[3941] Subpanel open, close only subpanel on escape
jvega190 Sep 26, 2024
f0d7830
[3941] Update to show all fields in CompareVersionsDialog, highlight …
jvega190 Sep 26, 2024
cc5586a
[3941] Allow viewing item version of unchanged items in node-selector…
jvega190 Sep 26, 2024
7c39def
[3941] Show 'no content set' for empty node-selector
jvega190 Sep 26, 2024
abafd0c
[3941] Update, send proper xml content to ViewField
jvega190 Sep 26, 2024
a49deee
[3941] Add mechanics for displaying only fields with changes, include…
jvega190 Sep 27, 2024
f9b0f27
[3941] include internal fields in view version dialog
jvega190 Sep 27, 2024
901df43
[3941] Show all fields in diff (with and without changes and add togg…
jvega190 Sep 30, 2024
1da6dad
View layout option buttons placement
rart Sep 30, 2024
5fa51aa
[3941] Fix node selector embedded components issue with one of them b…
jvega190 Sep 30, 2024
c682efb
Ternary conditions flipped, small layout refactors, expand all accord…
rart Sep 30, 2024
d095f16
[3941] Update disabled field parsing
jvega190 Sep 30, 2024
3f2092b
[3941] Rename convertTimeToTimezone util to convertUtcTimeToTimezone
jvega190 Sep 30, 2024
6eab358
[3941] Update convertUtcTimeToTimezone param names
jvega190 Sep 30, 2024
b84a11c
[3941] Rename ViewField component to ContentFieldView
jvega190 Sep 30, 2024
f89c1bf
Code refactors and design updates
rart Oct 2, 2024
505d139
Unused var clean up
rart Oct 2, 2024
1d14492
[3941] Make first selected field aware of all fields/changed fields s…
jvega190 Oct 2, 2024
c77e22f
[3941] Keep selected field when changing between changed/all fields i…
jvega190 Oct 2, 2024
061c415
[3941] Move between fields with keyboard arrows (single field view)
jvega190 Oct 2, 2024
98e0566
[3941] Filter fields if showing only changed fields
jvega190 Oct 3, 2024
059955d
[3941] Initial work to refactor toolbar for it to be able to be usabl…
jvega190 Oct 3, 2024
730ddb2
[3941] Move in-dialog slide-out panel to CompareVersionsDialog, check…
jvega190 Oct 3, 2024
19beea7
[3941] Refactor toolbar to be able to be usable at the accordion header
jvega190 Oct 3, 2024
ec07a7d
[3941] Move viewVersionsContext to a separate file and use it in View…
jvega190 Oct 3, 2024
ce253d6
[3941] Fix editors not taking 100% height in single view, remove unus…
jvega190 Oct 3, 2024
57351a0
[3941] Update FieldAccordionPanel, so it can be used by ViewVersionDi…
jvega190 Oct 3, 2024
c4e3ef0
[3941] Update typings
jvega190 Oct 3, 2024
6b087ed
[3941] Allow ArrowUp/ArrowDown to change selected field in View/Compa…
jvega190 Oct 3, 2024
5c04512
[3941] Update var names
jvega190 Oct 4, 2024
d6c3280
[3941] Add compare/view version dialogs view preferences to localStorage
jvega190 Oct 4, 2024
2c18a5a
[3941] types
jvega190 Oct 4, 2024
a7f748e
[3941] Add paths to image diff, fix layout
jvega190 Oct 4, 2024
0c8f02b
[3941] Fix monacoEditorHeight not set properly on ContentFieldView
jvega190 Oct 4, 2024
6b6874b
[3941] Update view version dialog to properly use viewSubDialogState
jvega190 Oct 7, 2024
ef4004c
[3941] Update useVersionsDialogContext error message
jvega190 Oct 7, 2024
8cd4320
[3941] remove setExpanded dep from effect in FieldAccordionPanel
jvega190 Oct 7, 2024
82bb76f
[3941] Update to use optional chaining
jvega190 Oct 7, 2024
ebedd51
[3941] Update DiffCollectionItem prop names
jvega190 Oct 7, 2024
79969ae
[3941] Update getContentInstanceValueFromProp to properly retrieve fi…
jvega190 Oct 7, 2024
72aa216
[3941] Simplify getContentInstanceFileName
jvega190 Oct 7, 2024
a68c4b0
[3941] Update systemPropList and getContentInstanceValueFromProp to r…
jvega190 Oct 7, 2024
1e6ff0b
[3941] Move default fields views components to their own files
jvega190 Oct 7, 2024
6eda4c7
[3941] Add docs in code
jvega190 Oct 7, 2024
2c339ae
[3941] Update var name
jvega190 Oct 7, 2024
b438bfa
[3941] Update VersionsDialogContext
jvega190 Oct 7, 2024
991aa80
[3941] Remove areObjectsEqual util/usages and compare xml
jvega190 Oct 8, 2024
45a68e9
[3941] Rollback contentTypeFields into VersionsDialogContext
jvega190 Oct 8, 2024
8881163
[3941] Add controls for types views, modify default view for types view
jvega190 Oct 8, 2024
22be475
[3941] Add controls for types diff views
jvega190 Oct 8, 2024
26a0cf2
[3941] Remove MonacoWrapper and create TextView and TextDiffView
jvega190 Oct 8, 2024
5a00561
[3941] Update viewComponents to receive xml instead of parsed content
jvega190 Oct 9, 2024
4f41106
[3941] Update viewDiffComponents to receive xml instead of parsed con…
jvega190 Oct 9, 2024
bdc3d89
[3941] Add ViewComponentProps
jvega190 Oct 9, 2024
9d831b2
[3941] Add FileNameView and FileNameDiffView, remove/resolve some TODOs
jvega190 Oct 9, 2024
b9a4471
[3941] Fix internalFields not showing in ViewVersionDialog
jvega190 Oct 9, 2024
665fe60
[3941] Fix image view styles
jvega190 Oct 9, 2024
56d6c3b
[3941] Properly map field types to monaco editor languages in TextVie…
jvega190 Oct 9, 2024
738f716
[3941] Rollback showOnlyChanges and accordionView from Context as the…
jvega190 Oct 9, 2024
756709f
[3941] Rollback accordionView from Context - ViewVersionDialog update
jvega190 Oct 9, 2024
5e29707
[3941] Validate editorProps on TextDiffView
jvega190 Oct 9, 2024
972fa8a
[3941] Disable keyboard navigation for root dialog when opening slideout
jvega190 Oct 9, 2024
af5091a
[3941] Fix embedded content showing as 'changed' when they were 'new'…
jvega190 Oct 9, 2024
d2b19e3
[3941] Check for valid date in DateTimeView
jvega190 Oct 10, 2024
7b681bf
[3941] Add emptyState for no changes in content-type fields, update V…
jvega190 Oct 10, 2024
e279127
[3941] Update no content diff emptyState message
jvega190 Oct 10, 2024
3707a12
[3941] Pass editorProps to TextDiffView in DefaultDiffView
jvega190 Oct 10, 2024
70620bf
[3941] Import react in fields view components
jvega190 Oct 28, 2024
4386328
[3941] Support assets diff
jvega190 Oct 28, 2024
b75c614
[3941] Add CompareAssetPanel and PDFView files
jvega190 Oct 29, 2024
e4313f7
Merge branch 'develop' of https://github.com/craftercms/studio-ui int…
jvega190 Nov 6, 2024
3a30691
[3941] Yarn.lock update (build after merge)
jvega190 Nov 6, 2024
f18b374
Merge branch 'develop' of https://github.com/craftercms/studio-ui int…
jvega190 Nov 14, 2024
13e472e
[3941] Build after merge, update @types/diff
jvega190 Nov 14, 2024
62a4326
[3941] Update getEmbeddedVersions to return null if version doesn't e…
jvega190 Nov 14, 2024
83a31c3
[3941] center align assets comparison
jvega190 Nov 14, 2024
7f680e0
Merge branch 'develop' of https://github.com/craftercms/studio-ui int…
jvega190 Nov 19, 2024
9ec09e5
[3941] Send proper embedded xml in onViewEmbedded
jvega190 Nov 20, 2024
3cd4780
[7123] Center ImageDiffView content
jvega190 Nov 20, 2024
198355f
[3941] Close other slides when opening new
jvega190 Nov 20, 2024
afbbaa2
[3941] Validate possible field not existing in TextView
jvega190 Nov 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 0 additions & 28 deletions site/website/diff/index.xml

This file was deleted.

142 changes: 0 additions & 142 deletions templates/web/diff.ftl

This file was deleted.

3 changes: 3 additions & 0 deletions ui/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"@emotion/react": "^11.13.3",
"@emotion/styled": "^11.13.0",
"@graphiql/plugin-explorer": "^3.0.1",
"@monaco-editor/react": "^4.6.0",
"@mui/icons-material": "^6.1.7",
"@mui/lab": "6.0.0-beta.15",
"@mui/material": "^6.1.7",
Expand All @@ -75,6 +76,7 @@
"@types/video.js": "^7.3.58",
"autosuggest-highlight": "^3.3.4",
"clsx": "^2.1.1",
"diff": "^7.0.0",
"fast-xml-parser": "^4.3.6",
"graphiql": "^3.2.2",
"graphql": "^16.8.1",
Expand Down Expand Up @@ -113,6 +115,7 @@
"devDependencies": {
"@formatjs/cli": "^6.2.12",
"@rollup/plugin-swc": "^0.3.0",
"@types/diff": "^6.0.0",
"@types/js-cookie": "^3.0.6",
"@types/react-infinite-scroller": "^1.2.5",
"@types/uuid": "^10",
Expand Down
1 change: 1 addition & 0 deletions ui/app/src/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* @mui/x-data-grid
* @mui/x-date-pickers
* @mui/x-tree-view
* Removed LegacyVersionDialog and the entire associated `/studio/diff` route

## 4.2.0

Expand Down
6 changes: 5 additions & 1 deletion ui/app/src/components/AccountManagement/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ import {
removeStoredPullBranch,
removeStoredPullMergeStrategy,
removeStoredPushBranch,
removeStoredShowToolsPanel
removeStoredShowToolsPanel,
removeCompareVersionDialogViewModes,
removeViewVersionDialogViewModes
} from '../../utils/state';

export const preferencesGroups: Array<{
Expand Down Expand Up @@ -132,6 +134,8 @@ export const preferencesGroups: Array<{
removeStoredPreviewBackgroundMode(props.username);
removeStoredBrowseDialogViewMode(props.username);
removeStoredItems((key) => widgetsAccordionsKeyRegex.test(key));
removeCompareVersionDialogViewModes(props.username);
removeViewVersionDialogViewModes(props.username);
}
}
];
113 changes: 113 additions & 0 deletions ui/app/src/components/CompareVersionsDialog/CompareAssetPanel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
/*
* Copyright (C) 2007-2024 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, { ReactNode, useMemo } from 'react';
import { isImage, isPdfDocument, isVideo } from '../PathNavigator/utils';
import TextDiffView from './FieldsTypesDiffViews/TextDiffView';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import Divider from '@mui/material/Divider';
import ImageView from '../ViewVersionDialog/FieldTypesViews/ImageView';
import VideoView from '../ViewVersionDialog/FieldTypesViews/VideoView';
import { PDFView } from '../ViewVersionDialog/AssetTypesViews/PDFView';

const typesDiffMap = {
image: ImageView,
video: VideoView,
text: TextDiffView,
pdf: PDFView
};

export interface AssetDiffViewProps {
aContent?: string;
bContent?: string;
type: 'image' | 'video' | 'pdf' | 'text';
renderContent: (xml: string) => ReactNode;
noContent?: ReactNode;
}

function AssetDiffView(props: AssetDiffViewProps) {
const {
aContent,
bContent,
type,
renderContent,
noContent = (
<Box>
<Typography color="textSecondary">no content set</Typography>
</Box>
)
} = props;
const verticalLayout = type === 'image' || type === 'video';
return (
<Box
sx={{
display: 'flex',
height: '100%',
p: 2,
alignItems: verticalLayout ? 'center' : 'flex-start',
justifyContent: 'space-around',
flexDirection: verticalLayout ? 'column' : 'row',
'> div': {
flexGrow: verticalLayout && 1
}
}}
>
{aContent ? renderContent(aContent) : noContent}
{verticalLayout && <Divider sx={{ width: '100%', mt: 1, mb: 1 }} />}
{bContent ? renderContent(bContent) : noContent}
</Box>
);
}

export function CompareAssetPanel(props) {
const { a, b, item } = props;
const assetType = useMemo(() => {
if (isImage(item)) {
return 'image';
} else if (isVideo(item)) {
return 'video';
} else if (isPdfDocument(item.mimeType)) {
return 'pdf';
} else {
return 'text';
}
}, [item]);
const ViewComponent = typesDiffMap[assetType];
const isVerticalLayout = assetType === 'image' || assetType === 'video';
const viewComponentProps = {
...(isVerticalLayout ? { sxs: { image: { maxHeight: '100%' } } } : {})
};

if (assetType === 'text') {
return <TextDiffView aXml={a} bXml={b} />;
} else {
return (
<AssetDiffView
aContent={a}
bContent={b}
type={assetType}
renderContent={(content) => (
<Box sx={{ height: isVerticalLayout ? 'calc(50% - 9px)' : '100%', width: '50%', textAlign: 'center' }}>
<ViewComponent content={content} {...viewComponentProps} />
</Box>
)}
/>
);
}
}

export default CompareAssetPanel;
Loading