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

Macro: #3041 – RNA Builder. Delete presets. #3473

Merged
merged 42 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
ec7aefc
#3041 Delete RNA presets.
StarlaStarla Oct 9, 2023
63d20e7
#3041 fix right click preset
StarlaStarla Oct 10, 2023
e243fdb
#3041 fix auto tests
StarlaStarla Oct 10, 2023
0421b02
#3041 remove skip for tests
StarlaStarla Oct 11, 2023
b18423c
#3041 fix screenshots
StarlaStarla Oct 11, 2023
1587dc9
Merge branch 'master' of https://github.com/epam/ketcher into 3041-rn…
StarlaStarla Oct 11, 2023
2711c70
#3041 – updated screenshots
Nitvex Oct 11, 2023
5f200b9
Merge branches '3041-rna-builder-delete-presets' and '3041-rna-builde…
StarlaStarla Oct 12, 2023
132a6ab
#3041 update implementation
StarlaStarla Oct 13, 2023
00e6692
Merge branch 'master' of github.com:epam/ketcher into 3041-rna-builde…
StarlaStarla Oct 13, 2023
5959683
#3041 update screenshots
StarlaStarla Oct 13, 2023
318d946
#3041 add dots menu and change delete dialog style
StarlaStarla Oct 16, 2023
181bca2
#3041 update screenshot
StarlaStarla Oct 16, 2023
2580368
#3041 align modal style
StarlaStarla Oct 16, 2023
fc3c898
Merge branch 'master' of github.com:epam/ketcher into 3041-rna-builde…
StarlaStarla Oct 16, 2023
d857fdd
#3041 update screenshots
StarlaStarla Oct 16, 2023
3d3bae5
Merge branch 'master' of github.com:epam/ketcher into 3041-rna-builde…
StarlaStarla Oct 17, 2023
2dbc7ea
#3041 update screenshots
StarlaStarla Oct 17, 2023
fe2dd42
#3041 fix ci babel audit issue
StarlaStarla Oct 17, 2023
c077861
#3041 update ui design
StarlaStarla Oct 18, 2023
da3dba4
#3041 update screenshots
StarlaStarla Oct 18, 2023
ec3e70c
#3041 update menu style & offset
StarlaStarla Oct 20, 2023
23edb07
Merge branch 'master' of github.com:epam/ketcher into 3041-rna-builde…
StarlaStarla Oct 20, 2023
f3b3723
#3041 update
StarlaStarla Oct 20, 2023
4a32f1f
Merge branch 'master' of github.com:epam/ketcher into 3041-rna-builde…
StarlaStarla Oct 23, 2023
3a6538b
#3041 update screenshots
StarlaStarla Oct 23, 2023
08d5171
- updated package-lock
Zhirnoff Oct 23, 2023
7de6549
#3041 update screenshot
StarlaStarla Oct 24, 2023
bbb3767
Merge branch '3041-rna-builder-delete-presets' of github.com:epam/ket…
StarlaStarla Oct 24, 2023
66cbd5c
#3041 update screenshot
StarlaStarla Oct 24, 2023
b10cb2d
Merge branch '3041-rna-builder-delete-presets' of https://github.com/…
StarlaStarla Oct 24, 2023
c84377a
#3041 update screenshot
StarlaStarla Oct 24, 2023
3b6a6ff
#3041 update screenshot
StarlaStarla Oct 25, 2023
dbad32b
Merge branch '3041-rna-builder-delete-presets' of https://github.com/…
StarlaStarla Nov 2, 2023
113d14c
Merge branch 'master' of https://github.com/epam/ketcher into 3041-rn…
StarlaStarla Nov 2, 2023
eeee729
#3041 update snapshots
StarlaStarla Nov 3, 2023
a333cf3
Merge branch 'master' of https://github.com/epam/ketcher into 3041-rn…
StarlaStarla Nov 6, 2023
e3dc54b
Merge branch 'master' of https://github.com/epam/ketcher into 3041-rn…
StarlaStarla Nov 7, 2023
5c02d60
#3041 update screenshots
StarlaStarla Nov 7, 2023
a558abf
Merge branch 'master' of github.com:epam/ketcher into 3041-rna-builde…
StarlaStarla Nov 9, 2023
5233d64
#3041 update screeshots
StarlaStarla Nov 9, 2023
194f41d
Merge branch 'master' of github.com:epam/ketcher into 3041-rna-builde…
StarlaStarla Nov 10, 2023
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ test.describe('Macromolecules delete RNA presets', () => {
await page.getByTestId('A_Copy_A_R_P').click({ button: 'right' });

await page.getByTestId('deletepreset').click();

await takePageScreenshot(page);

await page.getByTitle('Delete').click();
Expand Down
Copy link
Collaborator

Choose a reason for hiding this comment

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

On my computer this test regularly has error. Could you recheck it, please? I didn't find any problems there and it works in the app, but I am afraid that it could be flaky
Снимок экрана 2023-10-20 в 12 53 18

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see. But after I merged the latest changes from master and rebuild the project, it could always run successfully.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const RNAContextMenu = () => {
];

const isItemDisabled = (name: string) => {
if (name === 'deletepreset' && activePreset?.default) {
if (['deletepreset', 'edit'].includes(name) && activePreset?.default) {
return true;
}
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ import { Menu } from 'react-contexify';

export const StyledMenu = styled(Menu)`
--contexify-activeItem-bgColor: rgba(243, 245, 247, 1);
--contexify-menu-minWidth:width: 160px;
--contexify-menu-minWidth: 140px;
--contexify-activeItem-color: rgba(51, 51, 51, 1);
.contexify_itemContent {
font-family: ${({ theme }) => theme.ketcher.font.family.inter};
font-size: ${({ theme }) => theme.ketcher.font.size.regular};
}
.contexify_separator {
color: rgba(225, 229, 234, 1);
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,6 @@ export const RnaAccordion = ({
dispatch(setActiveRnaBuilderItem(groupName));
};

const handleContextMenu = (preset: IRnaPreset) => (event: MouseEvent) => {
dispatch(setActivePreset(preset));
show({
event,
props: {
duplicatePreset,
activateEditMode,
},
});
};

useEffect(() => {
setExpandedAccordion(activeRnaBuilderItem);
}, [activeRnaBuilderItem]);
Expand All @@ -167,7 +156,7 @@ export const RnaAccordion = ({
);
}, [isEditMode]);

const selectPreset = (preset: IRnaPreset) => {
const selectPreset = (preset: IRnaPreset) => () => {
dispatch(setActivePreset(preset));
editor.events.selectPreset.dispatch(preset);
};
Expand All @@ -178,6 +167,37 @@ export const RnaAccordion = ({
dispatch(setIsEditMode(true));
};

const getMenuPosition = (currentPresetCard: HTMLElement) => {
const isDivCard = currentPresetCard instanceof HTMLDivElement;
if (!isDivCard && currentPresetCard.parentElement) {
currentPresetCard = currentPresetCard.parentElement;
}
const boundingBox = currentPresetCard.getBoundingClientRect();
const parentBox = currentPresetCard.offsetParent?.getBoundingClientRect();
const contextMenuWidth = 140;
let x = boundingBox.right - contextMenuWidth;
const y = boundingBox.y + boundingBox.height / 2;
if (parentBox?.x && parentBox?.x > x) {
x = boundingBox.x;
}
return {
x,
y,
};
};

const handleContextMenu = (preset: IRnaPreset) => (event: MouseEvent) => {
dispatch(setActivePreset(preset));
show({
event,
props: {
duplicatePreset,
activateEditMode,
},
position: getMenuPosition(event.currentTarget as HTMLElement),
});
};

return (
<RnaAccordionContainer data-testid="rna-accordion">
{groupsData.map((groupData) => {
Expand Down Expand Up @@ -207,7 +227,7 @@ export const RnaAccordion = ({
<RnaPresetItem
key={`${preset.name}${index}`}
preset={preset}
onClick={() => selectPreset(preset)}
onClick={selectPreset(preset)}
onContextMenu={handleContextMenu(preset)}
isSelected={activePreset?.presetInList === preset}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,11 @@ export const RnaEditorExpanded = ({
);
} else {
mainButton = (
<StyledButton data-testid="edit-btn" onClick={onEdit}>
<StyledButton
data-testid="edit-btn"
onClick={onEdit}
disabled={activePreset.default}
>
Edit
</StyledButton>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ const PrimaryButton = styled(MuiButton)(
border: `1px solid ${theme.ketcher.color.button.primary.active}`,
color: 'rgb(245, 245, 245)',
fontWeight: theme.ketcher.font.weight.regular,
width: '62px',
height: '24px',

'&:hover': {
backgroundColor: theme.ketcher.color.button.primary.hover,
Expand All @@ -52,6 +54,8 @@ const SecondaryButton = styled(MuiButton)(
border: `1px solid ${theme.ketcher.color.button.secondary.active}`,
color: theme.ketcher.color.button.secondary.active,
fontWeight: theme.ketcher.font.weight.regular,
width: '72px',
height: '24px',

'&:hover': {
border: `1px solid ${theme.ketcher.color.button.secondary.hover}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ interface ModalProps {
const StyledDialog = styled(Dialog)`
.MuiPaper-root {
width: 304px;
background: #ffffff !important;
border-radius: 4px !important;
}
`;

Expand Down Expand Up @@ -55,6 +57,7 @@ const Content = styled(DialogContent)`
font-size: ${({ theme }) => theme.ketcher.font.size.medium};
letter-spacing: 1.25px;
line-height: 17px;
color: #000000;
${({ theme }) => scrollbarThin(theme)};
`;

Expand All @@ -64,8 +67,7 @@ const Footer = styled(DialogActions)`
padding: 0;
.MuiButtonBase-root {
border-radius: 4px;
width: 72px;
font-size: ${({ theme }) => theme.ketcher.font.size.medium};
font-size: ${({ theme }) => theme.ketcher.font.size.regular};
}
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export const defaultTheme: EditorTheme = {
disabled: 'rgba(0, 131, 143, 0.4)',
},
secondary: {
active: '#717171',
active: '#585858',
hover: '#333333',
clicked: '#AEAEAE',
disabled: 'rgba(113, 113, 113, 0.4)',
Expand Down
Loading