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

feat: Story map chapter move #1175

Merged
merged 14 commits into from
Sep 18, 2023
Merged

feat: Story map chapter move #1175

merged 14 commits into from
Sep 18, 2023

Conversation

josebui
Copy link
Contributor

@josebui josebui commented Sep 14, 2023

Description

  • Added context menu for chapters
  • Added move up and move down menu items
  • Move delete button to menu
  • Added drag and drop for chapter reorder

Checklist

  • Corresponding issue has been opened
  • New tests added

Related Issues

Fixes #1108

@josebui josebui self-assigned this Sep 14, 2023
@josebui josebui changed the base branch from feat/story-map-chapter-move to main September 14, 2023 16:50
@josebui josebui marked this pull request as ready for review September 14, 2023 16:56
@josebui josebui changed the title feat: Story map chapter move with drag and drop feat: Story map chapter move Sep 15, 2023
Copy link
Contributor

@david-code david-code left a comment

Choose a reason for hiding this comment

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

Looks good to me! I'm not very knowledgeable about the web client, so unfortunately there's some stuff that is just going over my head right now. But overall it seems good to me.


const onClick = useCallback(event => {
setOpenConfirmation(true);
event.stopPropagation();
Copy link
Contributor

Choose a reason for hiding this comment

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

question: I'm not super familiar with the web client code, is the event.stopPropagation used commonly throughout, or is there a special reason you are using it here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@david-code yes, I think that is common, there are some cases where you have the same listener on a parent component and you want to avoid the event to keep propagating

props;

useEffect(() => {
setOpenConfirmation(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion+nit: I don't think this needs to be set false here, I think that is the default value it will have.

Comment on lines +182 to +190
const withoutChapter = config.chapters.filter(
chapter => chapter.id !== id
);
const newChapters = [
..._.slice(0, index, withoutChapter),
config.chapters.find(chapter => chapter.id === id),
..._.slice(index, withoutChapter.length, withoutChapter),
];
return newChapters;
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion(not neccessary): I think if this is used elsewhere in the code, it could be a good idea to make a separate function to encapsulate the immutable replace.

Copy link
Contributor

Choose a reason for hiding this comment

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

comment: I don't have enough experience with this part of the web client to give a good review of the tests themselves here, but they look nice to me at a quick glance.

@josebui josebui mentioned this pull request Sep 18, 2023
2 tasks
@josebui josebui merged commit 19bf90d into main Sep 18, 2023
7 of 8 checks passed
@josebui josebui deleted the feat/story-map-chapter-move-dnd branch September 18, 2023 17:38
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.

Engineering task - story maps: allow users to rearrange chapters - drag and drop
2 participants