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(web): Team List - Display email, phone and tags for team members #15947

Merged
merged 5 commits into from
Sep 11, 2024

Conversation

RunarVestmann
Copy link
Member

@RunarVestmann RunarVestmann commented Sep 10, 2024

Team List - Display email, phone and tags for team members

What

  • Team List accordion variant now displays team members emails, phone numbers and tags

Why

  • This change follows a new staff list figma design
  • To standardize how team lists are set up in the cms

Screenshots / Gifs

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

Summary by CodeRabbit

  • New Features

    • Enhanced team member display with email and phone information.
    • Introduced tag grouping for better organization of team member tags.
    • Added localization support for email and phone labels.
    • Introduced display modes for team member presentation (card or accordion).
  • Bug Fixes

    • Improved layout to prevent overflow issues with long email addresses.
  • Documentation

    • Updated interfaces to reflect new properties for team members, including email, phone, and tagGroups.

Copy link
Contributor

coderabbitai bot commented Sep 10, 2024

Walkthrough

The pull request introduces updates to the team management components, enhancing the data structure and rendering of team member information. Key changes include the addition of new fields such as email, phone, and filterTags in the GraphQL query, updates to the TeamListSlice component for improved item processing using useMemo, and modifications to the CSS for better layout handling. The TeamListProps interface has been expanded to accommodate new properties for localization and display options, resulting in a more structured presentation of team member data.

Changes

Files Change Summary
apps/web/components/Organization/Slice/TeamListSlice/TeamListSlice.tsx Introduced useMemo for optimizing item processing, added tagGroups for organizing tags, updated props to include prefixes for localization.
apps/web/screens/queries/TeamList.ts Enhanced GET_TEAM_MEMBERS_QUERY by adding email, phone, and filterTags fields for more detailed team member data retrieval.
libs/cms/src/lib/generated/contentfulTypes.d.ts Updated ITeamMemberFields interface to include optional email and phone properties, and modified the comment for intro.
libs/cms/src/lib/models/teamMember.model.ts Added email and phone fields to TeamMember class, updated mapTeamMember function to include these new fields.
libs/island-ui/contentful/src/lib/TeamList/TeamList.css.ts Added a new CSS constant for proper email display to prevent overflow issues.
libs/island-ui/contentful/src/lib/TeamList/TeamList.tsx Expanded TeamListProps interface with variant and prefixes properties, modified teamMembers structure to include optional email, phone, and tagGroups.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant TeamList
    participant GraphQL
    participant TeamListSlice

    User->>TeamList: Request team members
    TeamList->>GraphQL: Execute GET_TEAM_MEMBERS_QUERY
    GraphQL-->>TeamList: Return team members data (including email, phone, filterTags)
    TeamList->>TeamListSlice: Render team members
    TeamListSlice->>TeamListSlice: Process items with useMemo
    TeamListSlice->>User: Display team members with details
Loading

Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 5b7a59d and ca3e486.

Files selected for processing (1)
  • apps/web/components/Organization/Slice/TeamListSlice/TeamListSlice.tsx (3 hunks)
Additional context used
Path-based instructions (1)
apps/web/components/Organization/Slice/TeamListSlice/TeamListSlice.tsx (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
Additional comments not posted (4)
apps/web/components/Organization/Slice/TeamListSlice/TeamListSlice.tsx (4)

6-6: LGTM!

The import statement for the sortAlpha function is correctly written.


70-106: Excellent use of useMemo and improved tag grouping logic!

The changes in this code segment significantly enhance the performance and organization of the TeamListSlice component:

  • The use of useMemo is appropriate to memoize the result of the mapping operation and avoid unnecessary re-computations.
  • The logic for creating tagGroups is correctly implemented, ensuring that only valid tags are processed and dynamically updating the tagGroups array.
  • The formatting step to ensure group labels end with a colon is a good addition for consistency.
  • The sorting of tagGroups using the sortAlpha utility improves the organization and readability of the rendered output.

Great work on optimizing the component and improving the tag grouping functionality!


135-135: LGTM!

The processed items are correctly passed to the teamMembers prop of the TeamList component, ensuring that the enhanced team member data is properly rendered.


137-140: Great addition of the prefixes prop for localization!

The new prefixes prop in the TeamList component is a valuable addition for improving localization:

  • The conditional logic correctly sets the appropriate labels based on the activeLocale value.
  • This change enhances the user experience by providing locale-specific labels for email and phone.

Well done on considering localization and making the component more user-friendly!


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 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.

Copy link

codecov bot commented Sep 10, 2024

Codecov Report

Attention: Patch coverage is 9.52381% with 19 lines in your changes missing coverage. Please review.

Project coverage is 36.83%. Comparing base (1cc4845) to head (ca3e486).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...Organization/Slice/TeamListSlice/TeamListSlice.tsx 0.00% 19 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #15947      +/-   ##
==========================================
- Coverage   36.84%   36.83%   -0.01%     
==========================================
  Files        6709     6709              
  Lines      137533   137553      +20     
  Branches    39095    39102       +7     
==========================================
  Hits        50674    50674              
- Misses      86859    86879      +20     
Flag Coverage Δ
air-discount-scheme-backend 54.08% <ø> (ø)
air-discount-scheme-web 0.00% <ø> (ø)
api 3.39% <ø> (ø)
api-domains-air-discount-scheme 36.88% <ø> (ø)
api-domains-assets 26.71% <ø> (ø)
api-domains-auth-admin 49.89% <ø> (ø)
api-domains-communications 40.54% <100.00%> (+0.01%) ⬆️
api-domains-driving-license 44.28% <ø> (ø)
api-domains-education 31.25% <ø> (ø)
api-domains-health-insurance 34.63% <ø> (ø)
api-domains-mortgage-certificate 35.75% <ø> (ø)
api-domains-payment-schedule 41.17% <ø> (ø)
application-api-files 57.52% <ø> (ø)
application-core 71.95% <ø> (-0.34%) ⬇️
application-system-api 41.69% <100.00%> (+<0.01%) ⬆️
application-template-api-modules 23.49% <ø> (+0.01%) ⬆️
application-templates-accident-notification 19.83% <ø> (ø)
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 22.12% <ø> (ø)
application-templates-driving-license 15.58% <ø> (ø)
application-templates-estate 11.86% <ø> (ø)
application-templates-example-payment 20.79% <ø> (ø)
application-templates-financial-aid 12.14% <ø> (ø)
application-templates-general-petition 18.86% <ø> (ø)
application-templates-health-insurance 23.27% <ø> (ø)
application-templates-inheritance-report 4.63% <ø> (ø)
application-templates-marriage-conditions 10.47% <ø> (ø)
application-templates-mortgage-certificate 44.09% <ø> (ø)
application-templates-parental-leave 28.40% <ø> (ø)
application-types 6.74% <ø> (ø)
application-ui-components 1.52% <ø> (ø)
application-ui-shell 21.08% <ø> (ø)
clients-charge-fjs-v2 24.11% <ø> (ø)
clients-license-client 1.83% <ø> (ø)
cms 0.42% <0.00%> (-0.01%) ⬇️
cms-translations 39.70% <100.00%> (+0.01%) ⬆️
download-service 44.57% <ø> (ø)
financial-aid-backend 56.53% <ø> (ø)
financial-aid-shared 19.03% <ø> (ø)
icelandic-names-registry-backend 54.64% <ø> (ø)
judicial-system-api 19.35% <ø> (ø)
judicial-system-backend 55.88% <100.00%> (+<0.01%) ⬆️
license-api 42.85% <ø> (ø)
portals-admin-regulations-admin 1.96% <ø> (ø)
services-auth-admin-api 52.72% <ø> (ø)
services-auth-delegation-api 61.36% <ø> (-0.08%) ⬇️
services-auth-ids-api 54.05% <ø> (-0.03%) ⬇️
services-auth-personal-representative 47.98% <ø> (ø)
services-auth-personal-representative-public 43.92% <ø> (-0.02%) ⬇️
services-auth-public-api 51.85% <ø> (ø)
services-documents 61.26% <ø> (ø)
services-endorsements-api 54.99% <ø> (ø)
services-sessions 65.75% <ø> (ø)
services-university-gateway 48.49% <ø> (+0.05%) ⬆️
services-user-notification 47.74% <100.00%> (+<0.01%) ⬆️
services-user-profile 62.26% <ø> (ø)
web 1.85% <0.00%> (-0.01%) ⬇️

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

Files with missing lines Coverage Δ
apps/web/screens/queries/TeamList.ts 0.00% <ø> (ø)
libs/cms/src/lib/models/teamMember.model.ts 62.50% <100.00%> (+3.40%) ⬆️
...Organization/Slice/TeamListSlice/TeamListSlice.tsx 0.00% <0.00%> (ø)

... and 1 file 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 1cc4845...ca3e486. Read the comment docs.

@datadog-island-is
Copy link

datadog-island-is bot commented Sep 10, 2024

Datadog Report

All test runs 20b78f7 🔗

74 Total Test Services: 0 Failed, 72 Passed
🔻 Test Sessions change in coverage: 4 decreased, 2 increased, 194 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 81 0 21.29s N/A Link
air-discount-scheme-web 0 0 0 2 0 8.91s N/A Link
api 0 0 0 4 0 2.94s N/A Link
api-domains-air-discount-scheme 0 0 0 6 0 19.46s N/A Link
api-domains-assets 0 0 0 3 0 12.53s N/A Link
api-domains-auth-admin 0 0 0 18 0 12.8s N/A Link
api-domains-communications 0 0 0 5 0 32.35s N/A Link
api-domains-criminal-record 0 0 0 5 0 9.82s 1 no change Link
api-domains-driving-license 0 0 0 23 0 32.23s N/A Link
api-domains-education 0 0 0 8 0 22.17s N/A Link

🔻 Code Coverage Decreases vs Default Branch (4)

  • services-auth-delegation-api - jest 60.01% (-0.26%) - Details
  • application-core - jest 79.42% (-0.1%) - Details
  • services-user-profile - jest 52.63% (-0.02%) - Details
  • services-auth-personal-representative-public - jest 45.87% (-0.01%) - Details

@RunarVestmann RunarVestmann added the automerge Merge this PR as soon as all checks pass label Sep 11, 2024
@RunarVestmann RunarVestmann changed the title feat(web): Add explicit email and phone fields to team member content type feat(web): Team List - Display email. phone and tags for team members Sep 11, 2024
@RunarVestmann RunarVestmann marked this pull request as ready for review September 11, 2024 12:16
@RunarVestmann RunarVestmann requested review from a team as code owners September 11, 2024 12:16
@RunarVestmann RunarVestmann changed the title feat(web): Team List - Display email. phone and tags for team members feat(web): Team List - Display email phone and tags for team members Sep 11, 2024
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

Outside diff range and nitpick comments (1)
apps/web/screens/queries/TeamList.ts (1)

17-28: LGTM! The changes to the GET_TEAM_MEMBERS_QUERY query are well-structured and aligned with the PR objective.

The addition of new fields (email, phone, and filterTags) enhances the query's capability to retrieve more detailed information about team members. The structured approach used to define the filterTags object and its subfields adheres to GraphQL best practices.

A few additional suggestions:

  • Consider adding comments to describe the purpose of each new field, especially for the filterTags object and its subfields. This will improve the code readability and maintainability.
  • If the email and phone fields are optional, consider adding the @nullable directive to indicate that they may return null values.
  • Verify that the corresponding changes have been made in the backend GraphQL schema to support these new fields.

Overall, the changes are well-implemented and do not introduce any breaking changes to the existing query structure.

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 4264bb3 and 6998267.

Files selected for processing (6)
  • apps/web/components/Organization/Slice/TeamListSlice/TeamListSlice.tsx (4 hunks)
  • apps/web/screens/queries/TeamList.ts (1 hunks)
  • libs/cms/src/lib/generated/contentfulTypes.d.ts (1 hunks)
  • libs/cms/src/lib/models/teamMember.model.ts (2 hunks)
  • libs/island-ui/contentful/src/lib/TeamList/TeamList.css.ts (1 hunks)
  • libs/island-ui/contentful/src/lib/TeamList/TeamList.tsx (4 hunks)
Additional context used
Path-based instructions (6)
libs/island-ui/contentful/src/lib/TeamList/TeamList.css.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."
apps/web/screens/queries/TeamList.ts (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
libs/cms/src/lib/models/teamMember.model.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."
apps/web/components/Organization/Slice/TeamListSlice/TeamListSlice.tsx (1)

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

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
libs/island-ui/contentful/src/lib/TeamList/TeamList.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."
libs/cms/src/lib/generated/contentfulTypes.d.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."
Biome
libs/island-ui/contentful/src/lib/TeamList/TeamList.tsx

[error] 195-195: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)

Additional comments not posted (15)
libs/island-ui/contentful/src/lib/TeamList/TeamList.css.ts (1)

7-9: LGTM!

The new email style is a good addition to handle potential text overflow scenarios with long email addresses. The usage of the style function from @vanilla-extract/css aligns with the reusability and TypeScript guidelines for the libs directory.

libs/cms/src/lib/models/teamMember.model.ts (3)

16-20: LGTM!

The addition of the optional email and phone fields to the TeamMember class is a valid enhancement to the data model. The usage of the @Field decorator with nullable: true is correct for optional fields. The changes adhere to TypeScript usage for defining props.


42-43: LGTM!

The update to the mapTeamMember function to include the new email and phone fields is consistent with the changes made to the TeamMember class. The data transformation logic is correctly modified to accommodate the new fields.


Line range hint 1-44: Adheres to the additional instructions.

The code in this file adheres to the following:

  • Reusability of components and hooks across different NextJS apps: The TeamMember model class is reusable across different NextJS apps.
  • TypeScript usage for defining props and exporting types: TypeScript is used for defining the class properties and decorators.
  • Effective tree-shaking and bundling practices: The file exports the TeamMember class and the mapTeamMember function, which can be effectively tree-shaken and bundled.
apps/web/components/Organization/Slice/TeamListSlice/TeamListSlice.tsx (3)

14-14: LGTM!

The code change is approved.


70-106: Great work on optimizing the items computation and improving the tag grouping logic!

  1. The use of useMemo is a good optimization to avoid unnecessary re-computations of the items array.
  2. The logic for creating tagGroups is correctly implemented:
    • It checks for valid tags before processing them.
    • It dynamically updates the tagGroups array by either pushing to existing groups or creating new ones.
    • It ensures that group labels end with a colon.
  3. The sorting of tagGroups using sortAlpha improves the organization and readability of the rendered output.

The code changes are approved.


135-140: Nice addition of the prefixes prop for better localization!

The prefixes object conditionally sets the labels for email and phone based on the active locale, allowing for better localization of the displayed information in the TeamList component.

The code changes are approved.

libs/island-ui/contentful/src/lib/TeamList/TeamList.tsx (7)

21-21: LGTM!

The addition of the optional variant property to the TeamListProps interface is a good way to support different display modes for the team list component.


22-25: LGTM!

The addition of the optional prefixes property to the TeamListProps interface is a good way to provide customizable labels for the email and phone fields.


34-34: LGTM!

The addition of the optional email property to the teamMembers structure within the TeamListProps interface is a good way to store the email address of a team member.


35-35: LGTM!

The addition of the optional phone property to the teamMembers structure within the TeamListProps interface is a good way to store the phone number of a team member.


36-39: LGTM!

The addition of the optional tagGroups property to the teamMembers structure within the TeamListProps interface is a good way to categorize team members using tags.


143-144: LGTM!

The modification of the TeamMemberAccordionList component's props to include the prefixes property is consistent with the addition of the prefixes property to the TeamListProps interface and allows for passing customizable labels for the email and phone fields to the component.


Line range hint 1-221: Code adheres to the additional instructions.

The code follows the guidelines mentioned in the additional instructions:

  1. The TeamList component and its sub-components are reusable across different NextJS apps as they are self-contained and rely only on the props passed to them.

  2. TypeScript is used for defining the TeamListProps interface and the props of the TeamList component and its sub-components, ensuring type safety and better developer experience.

  3. The code uses named exports for the TeamList component and its sub-components, allowing for effective tree-shaking by bundlers to reduce the bundle size.

Tools
Biome

[error] 195-195: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)

libs/cms/src/lib/generated/contentfulTypes.d.ts (1)

4411-4417: LGTM!

The addition of the optional email, phone, and intro properties to the ITeamMemberFields interface is approved. These changes expand the data structure to include more detailed information about team members.

libs/island-ui/contentful/src/lib/TeamList/TeamList.tsx Outdated Show resolved Hide resolved
@RunarVestmann RunarVestmann changed the title feat(web): Team List - Display email phone and tags for team members feat(web): Team List - Display email, phone and tags for team members Sep 11, 2024
Copy link
Member

@disaerna disaerna left a comment

Choose a reason for hiding this comment

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

UI Core files look good

@kodiakhq kodiakhq bot merged commit 75e2db8 into main Sep 11, 2024
158 checks passed
@kodiakhq kodiakhq bot deleted the feature/web-team-member-email-and-phone-fields branch September 11, 2024 13:25
jonnigs pushed a commit that referenced this pull request Sep 12, 2024
…#15947)

* Add explicit email and phone fields to team member content type

* Display filter tags

* Add missing key prop

* Sort imports

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants