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(app-sys): add tab title option #17263

Merged
merged 3 commits into from
Dec 16, 2024
Merged

feat(app-sys): add tab title option #17263

merged 3 commits into from
Dec 16, 2024

Conversation

jonnigs
Copy link
Member

@jonnigs jonnigs commented Dec 16, 2024

What

Option to set the title in the tab for sections and subsections

Why

It is possible to have an empty stepper and since the title for the tab is derived from there, this option is needed

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

  • New Features
    • Enhanced localization support by adding a new optional property, tabTitle, to the Section and SubSection interfaces.
    • Updated logic for determining the application section title to prioritize tabTitle over the existing title property.

@jonnigs jonnigs marked this pull request as ready for review December 16, 2024 16:29
@jonnigs jonnigs requested a review from a team as a code owner December 16, 2024 16:29
Copy link
Contributor

coderabbitai bot commented Dec 16, 2024

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 eslint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

warning [email protected]: This version is no longer supported. Please see https://eslint.org/version-support for other options.
warning eslint > @humanwhocodes/[email protected]: Use @eslint/config-array instead
warning eslint > file-entry-cache > flat-cache > [email protected]: Rimraf versions prior to v4 are no longer supported
warning eslint > file-entry-cache > flat-cache > rimraf > [email protected]: Glob versions prior to v9 are no longer supported
warning eslint > @humanwhocodes/config-array > @humanwhocodes/[email protected]: Use @eslint/object-schema instead
warning eslint > file-entry-cache > flat-cache > rimraf > glob > [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
warning jest > @jest/core > jest-config > [email protected]: Glob versions prior to v9 are no longer supported
warning jest > @jest/core > jest-runtime > [email protected]: Glob versions prior to v9 are no longer supported
warning jest > @jest/core > @jest/reporters > [email protected]: Glob versions prior to v9 are no longer supported
warning jest > @jest/core > @jest/transform > babel-plugin-istanbul > test-exclude > [email protected]: Glob versions prior to v9 are no longer supported
warning storybook > @storybook/cli > puppeteer-core > [email protected]: Rimraf versions prior to v4 are no longer supported
warning storybook > @storybook/cli > puppeteer-core > rimraf > [email protected]: Glob versions prior to v9 are no longer supported
warning storybook > @storybook/cli > tempy > del > [email protected]: Rimraf versions prior to v4 are no longer supported
warning storybook > @storybook/cli > jscodeshift > temp > [email protected]: Rimraf versions prior to v4 are no longer supported
warning storybook > @storybook/cli > jscodeshift > temp > rimraf > [email protected]: Glob versions prior to v9 are no longer supported
warning storybook > @storybook/cli > jscodeshift > @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
warning storybook > @storybook/cli > jscodeshift > @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
warning storybook > @storybook/cli > jscodeshift > @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
warning react-native > @react-native/codegen > [email protected]: Glob versions prior to v9 are no longer supported
warning react-native > @react-native/community-cli-plugin > [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
warning react-native > @react-native/community-cli-plugin > @react-native/dev-middleware > @rnx-kit/chromium-edge-launcher > [email protected]: Rimraf versions prior to v4 are no longer supported
warning react-native > @react-native/community-cli-plugin > @react-native/metro-babel-transformer > @react-native/babel-preset > @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.
warning react-native > @react-native/community-cli-plugin > @react-native/metro-babel-transformer > @react-native/babel-preset > @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.
warning react-native > @react-native/community-cli-plugin > @react-native/metro-babel-transformer > @react-native/babel-preset > @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.
warning react-native > @react-native/community-cli-plugin > @react-native/metro-babel-transformer > @react-native/babel-preset > @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-numeric-separator instead.
warning react-native > @react-native/community-cli-plugin > @react-native/metro-babel-transformer > @react-native/babel-preset > @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-object-rest-spread instead.
warning react-native > @react-native/community-cli-plugin > @react-native/metro-babel-transformer > @react-native/babel-preset > @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-catch-binding instead.
warning react-native > @react-native/community-cli-plugin > @react-native/metro-babel-transformer > @react-native/babel-preset > @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-async-generator-functions instead.
warning react-native > @react-native/community-cli-plugin > @react-native/metro-babel-transformer > @react-native/babel-preset > @babel/[email protected]: This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-logical-assignment-operators instead.
warning next-auth > [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
warning next-auth > [email protected]: this version is no longer supported
warning next-auth > @next-auth/typeorm-legacy-adapter > typeorm > [email protected]: Glob versions prior to v9 are no longer supported
warning @nx/next > @nx/webpack > stylus > [email protected]: Glob versions prior to v9 are no longer supported
warning @nx/next > @nx/webpack > webpack-dev-server > [email protected]: Rimraf versions prior to v4 are no longer supported
warning @nx/next > @nx/webpack > fork-ts-checker-webpack-plugin > [email protected]: this will be v4
warning @nx/next > @nx/webpack > webpack-dev-server > webpack-dev-middleware > [email protected]: this will be v4
warning workspace-aggregator-babdf4b4-009f-477e-91ba-757042db3bfa > [email protected]: This version is no longer supported. Please see https://eslint.org/version-support for other options.
warning "@nx/eslint > @nx/js > [email protected]" has unmet peer dependency "@types/node@".
warning "@nx/next > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0".
warning "styled-components > babel-plugin-styled-components > @babel/[email protected]" has unmet peer dependency "@babel/core@^7.0.0-0".
warning " > [email protected]" has unmet peer dependency "react-is@>= 16.8.0".
warning "@nx/react > [email protected]" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
warning " > [email protected]" has unmet peer dependency "@types/node@
".
warning " > [email protected]" has incorrect peer dependency "[email protected]".
warning "react-native > @react-native/[email protected]" has unmet peer dependency "@babel/preset-env@^7.1.6".
warning "react-native > @react-native/community-cli-plugin > @react-native/[email protected]" has unmet peer dependency "@babel/core@*".
warning "@vanilla-extract/next-plugin > @vanilla-extract/[email protected]" has unmet peer dependency "webpack@^4.30.0 || ^5.20.2".
warning " > [email protected]" has incorrect peer dependency "react@^16.13.1 || ^17".
warning " > [email protected]" has incorrect peer dependency "react-dom@^16.13.1 || ^17".
warning "next-auth > @next-auth/[email protected]" has unmet peer dependency "@prisma/client@^2.16.1".
warning "@nx/next > [email protected]" has unmet peer dependency "webpack@^5.1.0".

Walkthrough

The pull request introduces modifications to two files in the application's type and UI shell libraries. The changes primarily focus on enhancing localization support by adding an optional tabTitle property to the Section and SubSection interfaces. Additionally, the useApplicationTitle hook has been updated to prioritize the new tabTitle when generating the application title, providing more flexibility in how section titles are displayed.

Changes

File Change Summary
libs/application/types/src/lib/Form.ts Added optional tabTitle?: FormTextWithLocale to Section and SubSection interfaces
libs/application/ui-shell/src/hooks/useApplicationTitle.ts Modified getApplicationTitle function to prioritize tabTitle over title when generating application title

Sequence Diagram

sequenceDiagram
    participant UI as User Interface
    participant Hook as useApplicationTitle
    participant Section as Active Section
    
    UI->>Section: Retrieve section details
    Section-->>Hook: Provide section data
    Hook->Hook: Check for tabTitle
    alt tabTitle exists
        Hook->>Hook: Use tabTitle
    else tabTitle is undefined
        Hook->>Hook: Fallback to title
    end
    Hook->>UI: Set document title
Loading

The sequence diagram illustrates how the useApplicationTitle hook now prioritizes the tabTitle when generating the application title, with a fallback mechanism to the standard title if tabTitle is not present.

Tip

CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request.


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.

@jonnigs jonnigs added the automerge Merge this PR as soon as all checks pass label Dec 16, 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: 0

🧹 Nitpick comments (1)
libs/application/ui-shell/src/hooks/useApplicationTitle.ts (1)

35-40: Consider destructuring in a single line for better readability.

The implementation is correct, but the variable declarations could be more concise.

Consider this refactoring:

-    const tabTitle = activeSection.tabTitle
-    const title = activeSection.title
+    const { tabTitle, title } = activeSection
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c4bc9c4 and be81599.

📒 Files selected for processing (2)
  • libs/application/types/src/lib/Form.ts (1 hunks)
  • libs/application/ui-shell/src/hooks/useApplicationTitle.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
libs/application/types/src/lib/Form.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/ui-shell/src/hooks/useApplicationTitle.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."
🔇 Additional comments (2)
libs/application/types/src/lib/Form.ts (1)

113-113: LGTM! Type definitions are well-structured and maintain backward compatibility.

The addition of the optional tabTitle property to both interfaces is type-safe and follows TypeScript best practices. The use of FormTextWithLocale ensures proper localization support.

Also applies to: 119-119

libs/application/ui-shell/src/hooks/useApplicationTitle.ts (1)

35-40: Verify the impact on existing section titles.

The implementation looks good, but let's verify that existing sections without tabTitle continue to display correctly.

✅ Verification successful

Existing sections continue to display correctly with title property

Based on the extensive codebase analysis, all existing section implementations consistently use the title property, and the new code correctly falls back to title when tabTitle is not present (tabTitle || title). The search results show numerous section definitions across the codebase that rely on the title property, and the implementation maintains backward compatibility.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for sections using only title property
# This helps verify backward compatibility

# Search for section definitions to ensure existing sections work
ast-grep --pattern 'type: FormItemTypes.SECTION, title: $_'

Length of output: 61


Script:

#!/bin/bash
# Let's try a different approach to find section definitions
# Search for section type declarations and their title/tabTitle usage

# Search for section definitions with rg for better context
rg "type.*FormItemTypes\.SECTION" -A 5

# Also search for interfaces/types that define section properties
ast-grep --pattern 'interface $_ {
  $$$
  title?: $_
  tabTitle?: $_
  $$$
}'

Length of output: 2481


Script:

#!/bin/bash
# Let's examine the actual section definitions in the codebase
# and look for title/tabTitle usage patterns

# Search for section definitions with their properties
rg "buildSection\({" -A 10

# Also look for any direct section object definitions
rg "type:\s+FormItemTypes\.SECTION,\s*\n.*title:" -A 5

Length of output: 371


Script:

#!/bin/bash
# Let's try a different approach with fixed regex patterns

# Search for section definitions and their properties
rg "buildSection\(" -A 10

# Look for section type declarations with multiline support
rg -U "type:\s+FormItemTypes\.SECTION.*title:" -A 5

# Also check for any test files that might contain section definitions
rg "test|spec" -t ts -l | xargs rg "FormItemTypes\.SECTION" -A 5

Length of output: 73103

@jonnigs jonnigs changed the title Feat/add tab title option feat(app-sys): add tab title option Dec 16, 2024
Copy link

codecov bot commented Dec 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 35.74%. Comparing base (400f28f) to head (e5acffc).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #17263   +/-   ##
=======================================
  Coverage   35.73%   35.74%           
=======================================
  Files        6941     6941           
  Lines      148395   148398    +3     
  Branches    42331    42332    +1     
=======================================
+ Hits        53035    53038    +3     
  Misses      95360    95360           
Flag Coverage Δ
air-discount-scheme-web 0.00% <ø> (ø)
api 3.33% <ø> (ø)
application-api-files 61.87% <ø> (ø)
application-core 75.78% <ø> (ø)
application-system-api 38.74% <ø> (-0.01%) ⬇️
application-template-api-modules 27.83% <ø> (ø)
application-templates-accident-notification 28.82% <ø> (ø)
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 25.77% <ø> (ø)
application-templates-driving-license 18.16% <ø> (ø)
application-templates-estate 13.76% <ø> (ø)
application-templates-example-payment 24.72% <ø> (ø)
application-templates-financial-aid 14.46% <ø> (ø)
application-templates-general-petition 23.15% <ø> (ø)
application-templates-inheritance-report 6.59% <ø> (ø)
application-templates-marriage-conditions 15.19% <ø> (ø)
application-templates-mortgage-certificate 43.64% <ø> (ø)
application-templates-parental-leave 29.82% <ø> (-0.12%) ⬇️
application-types 6.51% <ø> (ø)
application-ui-components 1.22% <ø> (ø)
application-ui-shell 22.48% <100.00%> (+0.02%) ⬆️
clients-charge-fjs-v2 28.35% <ø> (ø)
judicial-system-api 20.21% <ø> (ø)
judicial-system-backend 55.90% <ø> (ø)
judicial-system-formatters 78.47% <ø> (ø)
judicial-system-message 66.48% <ø> (ø)
judicial-system-message-handler 48.16% <ø> (ø)
judicial-system-scheduler 71.08% <ø> (ø)
judicial-system-types 41.66% <ø> (ø)
judicial-system-web 27.89% <ø> (ø)
web 2.41% <ø> (ø)

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

Files with missing lines Coverage Δ
libs/application/types/src/lib/Form.ts 100.00% <ø> (ø)
...lication/ui-shell/src/hooks/useApplicationTitle.ts 100.00% <100.00%> (ø)

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 400f28f...e5acffc. Read the comment docs.

@datadog-island-is
Copy link

Datadog Report

All test runs 2661f44 🔗

21 Total Test Services: 0 Failed, 20 Passed
🔻 Test Sessions change in coverage: 1 decreased (-0.01%), 1 increased (+0.03%), 93 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-web 0 0 0 2 0 7.57s 1 no change Link
api 0 0 0 4 0 2.99s 1 no change Link
application-api-files 0 0 0 2 0 5.49s 1 no change Link
application-core 0 0 0 97 0 21.95s 1 no change Link
application-system-api 0 0 0 46 0 2m 29.67s 1 no change Link
application-template-api-modules 0 0 0 118 0 2m 45.76s 1 decreased (-0.01%) Link
application-templates-accident-notification 0 0 0 148 0 20.18s 1 no change Link
application-templates-criminal-record 0 0 0 2 0 10.28s 1 no change Link
application-templates-driving-license 0 0 0 13 0 15.74s 1 no change Link
application-templates-example-payment 0 0 0 2 0 11.09s 1 no change Link

🔻 Code Coverage Decreases vs Default Branch (1)

  • application-template-api-modules - jest 30.2% (-0.01%) - Details

@kodiakhq kodiakhq bot merged commit d30a093 into main Dec 16, 2024
100 checks passed
@kodiakhq kodiakhq bot deleted the feat/add-tab-title-option branch December 16, 2024 18:05
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.

2 participants