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

IBX-9170: AI Assistant #1385

Open
wants to merge 10 commits into
base: 4.6
Choose a base branch
from
Open

IBX-9170: AI Assistant #1385

wants to merge 10 commits into from

Conversation

GrabowskiM
Copy link
Contributor

@GrabowskiM GrabowskiM commented Oct 30, 2024

🎫 Issue IBX-9170

Description:

This PR provides two reusable react components - draggable dialog (that will be used for AI assistant) and popup menu (based a little on dropdown component, using similar styles as popup menu from vanilla JS)

For QA:

Documentation:

@GrabowskiM GrabowskiM marked this pull request as draft October 30, 2024 14:15
@GrabowskiM GrabowskiM changed the title AI Assistant IBX-9170: AI Assistant Nov 7, 2024
@GrabowskiM GrabowskiM marked this pull request as ready for review November 7, 2024 16:37
@GrabowskiM GrabowskiM marked this pull request as draft November 13, 2024 08:08
@GrabowskiM GrabowskiM marked this pull request as ready for review November 19, 2024 16:05
onClose: () => {},
onItemClick: () => {},
positionOffset: () => ({ x: 0, y: 0 }),
scrollContainer: window.document.body,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

&__item-content {
position: relative;
display: flex;
align-items: center;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

duplicated align-items

cursor: pointer;
padding: calculateRem(9px);
color: $ibexa-color-dark;
font-size: calculateRem(14px);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we have variable for font-size

&:disabled,
&--disabled {
pointer-events: none;
cursor: not-allowed;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pointer-events: none and cursor: not-allowed, is it working together?


useEffect(() => {
if (isDragging) {
rootDOMElement.addEventListener('mousemove', handleDragging);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
rootDOMElement.addEventListener('mousemove', handleDragging);
rootDOMElement.addEventListener('mousemove', handleDragging, false);

just for consistency


rootDOMElement.classList.add('ibexa-react-root');

if (id) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should check if there is no repetition of the ID in document?

return null;
}

const groupClassName = createCssClassNames({
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if we should use createCssClassNames because this it's only one class and it's not conditional

@@ -0,0 +1,24 @@
const createDynamicRoot = (contextDOMElement = window.document.body, id) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

window.document.body you can get this object by function getRootDOMElement from https://github.com/ibexa/admin-ui/blob/main/src/bundle/Resources/public/js/scripts/helpers/context.helper.js. We will avoid possible problems in the future if this code is used outside DXP

onClose();
};

window.document.body.addEventListener('click', onInteractionOutside, false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use getRootDOMElement

scrollContainer.addEventListener('scroll', calculateAndSetItemsListStyles, false);

return () => {
window.document.body.removeEventListener('click', onInteractionOutside);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use getRootDOMElement

Copy link

sonarcloud bot commented Nov 28, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants