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

Created 'Create Section' page, hooked in with real data and added translations #216

Open
wants to merge 9 commits into
base: development
Choose a base branch
from

Conversation

jupiter007
Copy link
Collaborator

@jupiter007 jupiter007 commented Dec 20, 2024

Description

Created the "Create Section" page, which will be different from "Edit Section" page, primarily because we won't be setting a Section ID until the user successfully creates a new section.

  • Created a new page at: template/[templateId]/section/create
  • Styles with css modules and added unit test for new page
  • Add translations
  • Added new icon for info to be used next to the tags
  • components/Editor
    -- updated components/Editor to use a skeleton to display until the editor loads. This became more of a problem as more instances of that DMPEditor were included in the same page.
    -- switched components/Editor to use css modules
    -- added two new props, error and id to the component
  • Added AddSection and Tags mutation and query

Fixes # (187)

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

This was tested both manually and using unit tests.

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I updated the CHANGELOG.md and added documentation if necessary
  • I have added tests that prove my fix is effective or that my feature works
  • I have completed manual or automated accessibility testing for my changes
  • New and existing unit tests pass locally with my changes
  • [NA] Any dependent changes have been merged and published in downstream modules

Screenshots

image image image

@jupiter007 jupiter007 requested review from fraserclark, andrewebdev and briri and removed request for fraserclark December 20, 2024 19:47
@jupiter007 jupiter007 changed the title Update Created Section page to work with real data and to add translations Created 'Create Section' page to work with real data and to add translations Dec 20, 2024
@jupiter007 jupiter007 changed the title Created 'Create Section' page to work with real data and to add translations Created 'Create Section' page, hooked in with real data and added translations Dec 20, 2024
Copy link
Collaborator

@briri briri left a comment

Choose a reason for hiding this comment

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

I just had a few minor comments and one that probably requires some brief discussion on how we want the display order to work in the new tool.

introduction: sectionIntroductionContent,
requirements: sectionRequirementsContent,
guidance: sectionGuidanceContent,
displayOrder: 1,
Copy link
Collaborator

Choose a reason for hiding this comment

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

We probably want a way to determine the next number rather than hard coding a 1 here. When a user adds a section in the current tool, it's added at the end instead of the beginning of the list. I'm not sure if we want to continue that in the new tool, but if so we'll want a function to get that number.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks @briri. That's a good point. It should probably go to the bottom of the list rather than the top. I can make that update and bring it up at Tuesday's meeting to confirm.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@briri I updated the code to insert the new section with the max displayOrder + 1, so that it will be rendered at the bottom of the list of sections.

const handleChange = (newState: EditorState) => {
const html = prosemirrorNodeToHtml(newState.doc);
const handleChange = ((newState: EditorState) => {
//prosemirror was adding an empty <p></p> when no data was passed, so we need to remove it here
Copy link
Collaborator

Choose a reason for hiding this comment

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

How does Prosemirror handle adding blank lines to help separate content? I believe the TinyMCE editor uses empty paragraphs to accomplish this.

We might be better off replacing it only iy what is the entire content of the html.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@briri, good catch. Prosemirror also inserts <p></p> for additional blank lines. I'll plan on only replacing <p></p> when it is the only content in the field.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@briri I updated the code to only filter out <p></p> only when that is all that exists in the content.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Cool thanks @jupiter007!

Copy link
Collaborator

@briri briri left a comment

Choose a reason for hiding this comment

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

sorry for the delay LGTM

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.

2 participants