-
Notifications
You must be signed in to change notification settings - Fork 323
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
Adding support for standalone diffs of images #1223
Conversation
Load image from git db
src/components/diff/ImageDiff.tsx
Outdated
const compareImageWidget = ReactWidget.create( | ||
<CompareImage reference={reference} challenger={challenger} /> | ||
); | ||
|
||
this.addWidget(compareImageWidget); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@fcollonval I ended up using react-compare-image instead of the component you suggested for the image comparing functionality. I'm wondering if there's a suggested method to adjust in the height of the Panel widget. Currently, the widget fits the entire width of the panel (as shown by the video in the PR description).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks awesome 🎉
Do you think you could add a dropbox to switch between viewers 2-up | Slider | Onion (and of course add those 😉) ?
This could be difficult, perhaps if I try using the component that you recommended instead this would be quite easy 🤔. |
For an example of the image diff viewer in GitHub: https://github.com/jupyterlab/jupyterlab/pull/13861/files#diff-9f79052c539324287f8df1779707857e4e41bc23fc336393de60dcbadf0b8cd9 |
Hi @fcollonval! I attempted to replace the react image compare component with the react image diff component (https://github.com/cezary/react-image-diff), which would give us the views that you suggested for free. I was able to add an external TypeScript declaration file, but after integrating it into our component, it broke the extension with a runtime error:
This is caused by the use of PropTypes to validate the types of props. Additionally, many depreciated react class component methods were used in the component, such as
How should I progress from here? |
Thanks for trying it out @basokant - I would go for the second path. Looking at the code of react-image-diff, it is quite short. So I guess it will be possible to understand how they do the onion view. |
@fcollonval I somehow wasn't killed by the CSS! Here's a summary of my progress (See a demo in the PR description):
I do still have some next steps (which are also in the PR description). I do have a couple of questions:
|
Yes we should support more formats. But actually, it is in the frontend when you set the source
That function may be helpful as it allows to get the filetype that got an attribute Line 1614 in dda8e82
This seems like a nice improvement
I let you test and propose what you think more appropriate |
…fix styling for image and MUI components
… skin image diff views
…r, and match slider and image widths responsively
e92f29a
to
7eba07d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @basokant and sorry for the late review.
Overall it looks good. Would you be able to finish it up and add integration tests? Otherwise I'm happy to finish the PR.
a9e2042
to
653ff90
Compare
653ff90
to
3538779
Compare
A continuation of the work done in #1179 , including implementing an interactive image compare widget.
This PR intends to add the feature outlined in #664 .
Current progress:
ImageDiff.mov
Tasks: