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(new-primary-school): Current school page #17451

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

helgifr
Copy link
Member

@helgifr helgifr commented Jan 8, 2025

...

Attach a link to issue if relevant

What

Specify what you're trying to achieve

Why

Specify why you need to achieve this

Screenshots / Gifs

Attach Screenshots / Gifs to help reviewers understand the scope of the pull request

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

Release Notes

  • New Features

    • Added a new form section displaying current school details
    • Introduced a grade field component for capturing student grade information
  • Improvements

    • Enhanced application form with more comprehensive school-related information
    • Added localized messages for current school context
  • Changes

    • Restructured child information subsection
    • Updated primary school section layout

The updates provide more detailed and user-friendly school information capture in the application process.

@helgifr helgifr requested a review from a team as a code owner January 8, 2025 16:36
Copy link
Contributor

coderabbitai bot commented Jan 8, 2025

Walkthrough

This pull request introduces enhancements to the new primary school application template, focusing on improving the representation of current school information. A new GradeField component has been created to display a child's grade, and a new currentSchoolSubSection has been added to provide detailed information about the current school. The changes involve modifying form sections, adding localization messages, and restructuring how school-related information is presented in the application.

Changes

File Change Summary
libs/application/templates/new-primary-school/src/fields/Grade/index.tsx Added new GradeField React component to render child's grade
libs/application/templates/new-primary-school/src/fields/index.ts Added export for new Grade component
libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/childrenNParentsSection/childInfoSubSection.ts Removed buildActionCardListField and buildDescriptionField methods
libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/primarySchoolSection/currentSchoolSubSection.ts Created new currentSchoolSubSection with multiple fields for current school information
libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/primarySchoolSection/index.ts Added currentSchoolSubSection to primary school section
libs/application/templates/new-primary-school/src/lib/messages.ts Added new localization messages for current school information

Possibly related PRs

Suggested Labels

automerge, deploy-feature

Suggested Reviewers

  • Toti91
  • kksteini

Finishing Touches

  • 📝 Generate Docstrings

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@datadog-island-is
Copy link

datadog-island-is bot commented Jan 8, 2025

Datadog Report

All test runs bba0cc2 🔗

10 Total Test Services: 0 Failed, 10 Passed
🔻 Test Sessions change in coverage: 2 decreased, 1 increased (+0.04%), 197 no change

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
air-discount-scheme-backend 0 0 0 63 0 24.69s N/A Link
air-discount-scheme-web 0 0 0 2 0 6.77s N/A Link
api 0 0 0 4 0 2.41s N/A Link
api-domains-air-discount-scheme 0 0 0 6 0 16.21s N/A Link
api-domains-assets 0 0 0 3 0 9.61s N/A Link
api-domains-auth-admin 0 0 0 18 0 10.11s N/A Link
api-domains-communications 0 0 0 5 0 30.24s N/A Link
api-domains-criminal-record 0 0 0 5 0 8.45s 1 no change Link
api-domains-driving-license 0 0 0 23 0 29.95s N/A Link
api-domains-education 0 0 0 8 0 19.79s 1 no change Link

🔻 Code Coverage Decreases vs Default Branch (2)

  • services-university-gateway - jest 45.28% (-0.02%) - Details
  • application-ui-shell - jest 29.08% (-0.01%) - Details

Copy link

codecov bot commented Jan 8, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 35.66%. Comparing base (50422b0) to head (976d6c9).
Report is 24 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #17451      +/-   ##
==========================================
- Coverage   35.67%   35.66%   -0.01%     
==========================================
  Files        6936     6941       +5     
  Lines      148940   149169     +229     
  Branches    42560    42778     +218     
==========================================
+ Hits        53127    53203      +76     
- Misses      95813    95966     +153     
Flag Coverage Δ
air-discount-scheme-web 0.00% <ø> (ø)
api 3.35% <ø> (+0.02%) ⬆️
api-domains-auth-admin 48.49% <ø> (ø)
api-domains-communications 39.47% <ø> (+0.07%) ⬆️
application-system-api 38.76% <ø> (+0.02%) ⬆️
application-template-api-modules 27.72% <ø> (+0.04%) ⬆️
application-templates-driving-license 18.17% <ø> (ø)
application-ui-shell 22.25% <ø> (ø)
cms 0.39% <ø> (-0.01%) ⬇️
cms-translations 38.80% <ø> (+0.06%) ⬆️
judicial-system-api 20.23% <ø> (+0.02%) ⬆️
judicial-system-backend 55.88% <ø> (-0.03%) ⬇️
judicial-system-web 27.76% <ø> (-0.02%) ⬇️
services-user-notification 46.54% <ø> (+0.03%) ⬆️
web 2.39% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...n/templates/new-primary-school/src/lib/messages.ts 100.00% <ø> (ø)

... and 51 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 50422b0...976d6c9. Read the comment docs.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
libs/application/templates/new-primary-school/src/fields/Grade/index.tsx (1)

15-45: Add error handling for external data.

The component looks well-structured, but consider adding error handling for cases where childGradeLevel might be undefined from external data.

Consider adding a fallback:

  const { childGradeLevel } = getApplicationExternalData(
    application.externalData,
  )

+ if (childGradeLevel === undefined) {
+   return (
+     <TextFormField
+       application={application}
+       showFieldName
+       field={{
+         ...field,
+         disabled: true,
+         defaultValue: formatMessage(newPrimarySchoolMessages.shared.notAvailable),
+       }}
+     />
+   )
+ }
libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/primarySchoolSection/currentSchoolSubSection.ts (1)

13-114: Consider splitting the form into smaller components.

The current structure has a large number of fields in a single subsection. Consider splitting this into smaller, more focused components for better maintainability.

For example:

  • TeacherInfoComponent
  • ProsperityContactComponent
  • CaseManagerComponent

This would make the code more modular and easier to maintain.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1a3606f and d84ceed.

📒 Files selected for processing (6)
  • libs/application/templates/new-primary-school/src/fields/Grade/index.tsx (1 hunks)
  • libs/application/templates/new-primary-school/src/fields/index.ts (1 hunks)
  • libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/childrenNParentsSection/childInfoSubSection.ts (0 hunks)
  • libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/primarySchoolSection/currentSchoolSubSection.ts (1 hunks)
  • libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/primarySchoolSection/index.ts (2 hunks)
  • libs/application/templates/new-primary-school/src/lib/messages.ts (1 hunks)
💤 Files with no reviewable changes (1)
  • libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/childrenNParentsSection/childInfoSubSection.ts
🧰 Additional context used
📓 Path-based instructions (5)
libs/application/templates/new-primary-school/src/fields/index.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/new-primary-school/src/lib/messages.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/primarySchoolSection/index.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/primarySchoolSection/currentSchoolSubSection.ts (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
libs/application/templates/new-primary-school/src/fields/Grade/index.tsx (1)

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
🔇 Additional comments (3)
libs/application/templates/new-primary-school/src/fields/index.ts (1)

2-2: LGTM! Export follows consistent pattern.

The new Grade export follows the established barrel file pattern.

libs/application/templates/new-primary-school/src/forms/NewPrimarySchoolForm/primarySchoolSection/index.ts (1)

3-3: LGTM! Logical placement of the new section.

The currentSchoolSubSection is appropriately imported and placed in a logical order within the children array, between siblingsSubSection and newSchoolSubSection.

Also applies to: 15-15

libs/application/templates/new-primary-school/src/lib/messages.ts (1)

423-454: Well-structured message definitions!

The new message definitions for the "Current school" section follow best practices:

  • Consistent naming pattern for message IDs
  • Clear English descriptions for translators
  • Proper TypeScript usage with defineMessages
  • Modular organization enabling effective tree-shaking

Comment on lines +52 to +54
// TODO: Use correct value
defaultValue: (application: Application) =>
getCurrentSchoolName(application),
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix placeholder values for contact information.

Multiple fields are currently using getCurrentSchoolName as a placeholder value for different contact information (supervising teacher, prosperity contact, case manager). This needs to be updated with the correct data retrieval functions.

Would you like me to help create the appropriate data retrieval functions for each contact type? This would include:

  • Supervising teacher details
  • Prosperity contact details
  • Case manager details

Also applies to: 61-63, 75-77, 84-86, 98-100, 107-109

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.

1 participant