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

fix(j-s): Extension Tag #16760

Merged
merged 2 commits into from
Nov 7, 2024
Merged

fix(j-s): Extension Tag #16760

merged 2 commits into from
Nov 7, 2024

Conversation

gudjong
Copy link
Member

@gudjong gudjong commented Nov 7, 2024

Extension Tag

Það vantar "Framlenging" í málalista fyrir framlengingarmál í vinnslu

What

  • Adds "Framlenging" below the case type for exrtended cases in case lists where missing.

Why

Verified bug.

Screenshots / Gifs

image

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 case detail rendering in the ColumnCaseType component by passing decision and parentCaseId props across various tables.
    • Improved context menu functionality by conditionally displaying options based on case state.
  • Bug Fixes

    • Adjusted handling of parentCaseId to ensure accurate data representation without defaulting to an empty string.

@gudjong gudjong requested a review from a team as a code owner November 7, 2024 14:26
Copy link
Contributor

coderabbitai bot commented Nov 7, 2024

Walkthrough

The changes in this pull request involve modifications to several components within the judicial system application, specifically enhancing the ColumnCaseType component. The updates include passing additional props, namely decision and parentCaseId, to the ColumnCaseType across multiple tables, including AppealCasesTable, CasesInProgressTable, ActiveCases, and PrisonCases. Additionally, the CasesInProgressTable has a refined context menu logic based on case state. Overall, these changes aim to improve the data rendering capabilities of the ColumnCaseType component.

Changes

File Change Summary
.../AppealCasesTable.tsx Removed nullish coalescing operator for parentCaseId, passing undefined instead of an empty string.
.../CasesInProgressTable.tsx Added decision and parentCaseId props to ColumnCaseType. Modified generateContextMenuItems to return an empty array for cases with state WAITING_FOR_CANCELLATION.
.../Shared/Cases/ActiveCases.tsx Updated cell property to include decision and parentCaseId in ColumnCaseType.
.../Shared/Cases/PrisonCases.tsx Updated cell property to include decision and parentCaseId in ColumnCaseType.

Possibly related PRs

Suggested labels

automerge, high priority

Suggested reviewers

  • oddsson

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 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 Nov 7, 2024

Codecov Report

Attention: Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 36.56%. Comparing base (312c468) to head (29d9172).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...system/web/src/routes/Shared/Cases/PrisonCases.tsx 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #16760      +/-   ##
==========================================
+ Coverage   36.52%   36.56%   +0.03%     
==========================================
  Files        6889     6892       +3     
  Lines      143680   143686       +6     
  Branches    40938    40947       +9     
==========================================
+ Hits        52483    52537      +54     
+ Misses      91197    91149      -48     
Flag Coverage Δ
judicial-system-api 19.62% <ø> (ø)
judicial-system-backend 55.22% <ø> (+0.13%) ⬆️
judicial-system-formatters 79.97% <ø> (ø)
judicial-system-message 66.79% <ø> (ø)
judicial-system-message-handler 47.71% <ø> (ø)
judicial-system-scheduler 70.45% <ø> (ø)
judicial-system-types 43.99% <ø> (ø)
judicial-system-web 27.58% <66.66%> (+<0.01%) ⬆️

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

Files with missing lines Coverage Δ
...onents/Table/AppealCasesTable/AppealCasesTable.tsx 2.50% <ø> (+0.06%) ⬆️
...ents/CasesInProgressTable/CasesInProgressTable.tsx 56.86% <100.00%> (ø)
...system/web/src/routes/Shared/Cases/ActiveCases.tsx 85.00% <100.00%> (ø)
...system/web/src/routes/Shared/Cases/PrisonCases.tsx 0.00% <0.00%> (ø)

... and 36 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 312c468...29d9172. Read the comment docs.

@datadog-island-is
Copy link

Datadog Report

Branch report: j-s/fix-extended-tag
Commit report: 7775d68
Test service: judicial-system-web

✅ 0 Failed, 338 Passed, 0 Skipped, 57.65s Total Time
➡️ Test Sessions change in coverage: 1 no change

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/judicial-system/web/src/components/Table/AppealCasesTable/AppealCasesTable.tsx (1)

115-117: Consider adding type safety improvements.

While the code works correctly, we could enhance type safety by explicitly typing the props passed to ColumnCaseType.

Consider adding type annotations:

              <ColumnCaseType
                type={row.type}
                decision={row.decision}
-                parentCaseId={row.parentCaseId}
+                parentCaseId={row.parentCaseId as string | undefined}
              />
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 7e8abb4 and 4b0f268.

📒 Files selected for processing (4)
  • apps/judicial-system/web/src/components/Table/AppealCasesTable/AppealCasesTable.tsx (1 hunks)
  • apps/judicial-system/web/src/routes/Court/components/CasesInProgressTable/CasesInProgressTable.tsx (1 hunks)
  • apps/judicial-system/web/src/routes/Shared/Cases/ActiveCases.tsx (1 hunks)
  • apps/judicial-system/web/src/routes/Shared/Cases/PrisonCases.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
apps/judicial-system/web/src/components/Table/AppealCasesTable/AppealCasesTable.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."
apps/judicial-system/web/src/routes/Court/components/CasesInProgressTable/CasesInProgressTable.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."
apps/judicial-system/web/src/routes/Shared/Cases/ActiveCases.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."
apps/judicial-system/web/src/routes/Shared/Cases/PrisonCases.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 (3)
apps/judicial-system/web/src/routes/Shared/Cases/ActiveCases.tsx (1)

90-96: LGTM! The changes align with the PR objective.

The addition of decision and parentCaseId props to ColumnCaseType enables the display of the "Framlenging" label for extension cases.

Let's verify the TypeScript types for these new props:

✅ Verification successful

TypeScript types are properly defined and implemented

The ColumnCaseType component has correct TypeScript interface definitions for all props:

  • type?: CaseType | null
  • decision?: CaseDecision | null
  • parentCaseId?: string | null

All props are optional and properly typed, matching the usage in ActiveCases.tsx. The implementation correctly uses these props to display both the case type and extension label when applicable.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the type definitions for ColumnCaseType component
# Expected: Find the component's type definition with decision and parentCaseId props

# Search for ColumnCaseType type/interface definition
ast-grep --pattern 'interface $name {
  $$$
}' | rg -A 10 'ColumnCaseType'

Length of output: 74


Script:

#!/bin/bash
# Let's try a different approach to find the ColumnCaseType component and its props
# First, let's find the file containing ColumnCaseType
fd "ColumnCaseType" --type f

# Then let's examine the component definition
rg -B 5 -A 10 "ColumnCaseType" --type typescript

Length of output: 192


Script:

#!/bin/bash
# Now that we found the file, let's examine its contents
cat "apps/judicial-system/web/src/components/Table/ColumnCaseType/ColumnCaseType.tsx"

Length of output: 1037

apps/judicial-system/web/src/components/Table/AppealCasesTable/AppealCasesTable.tsx (1)

116-116: LGTM! Removing the nullish coalescing operator is the right approach.

The change allows undefined values to be properly passed to ColumnCaseType, which is necessary for correctly identifying and displaying extension cases.

Let's verify the ColumnCaseType component's handling of undefined parentCaseId:

✅ Verification successful

Removing the nullish coalescing operator is correct and safe

The verification confirms that the ColumnCaseType component properly handles undefined parentCaseId values:

  1. The component's implementation shows explicit handling of parentCaseId with a conditional render:
{parentCaseId && (
  <Text as="span" variant="small" color="dark400">
    {formatMessage(tables.extension)}
  </Text>
)}
  1. The prop is correctly typed as optional with possible null value:
parentCaseId?: string | null
  1. Multiple tables across the application pass parentCaseId directly without nullish coalescing, confirming this is the standard pattern.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for ColumnCaseType's prop type definition and implementation
ast-grep --pattern 'interface $interface {
  $$$
  parentCaseId?: $_
  $$$
}'

# Verify the component's handling of undefined parentCaseId
ast-grep --pattern 'const ColumnCaseType = $_ => {
  $$$
  parentCaseId
  $$$
}'

Length of output: 162


Script:

#!/bin/bash
# Let's try a different approach to find ColumnCaseType component and its usage
rg -A 10 "ColumnCaseType" --type typescript

# Also search for any type definitions containing parentCaseId
rg "parentCaseId.*:" --type typescript

Length of output: 154


Script:

#!/bin/bash
# Search for ColumnCaseType component and its usage without file type filter
rg -A 10 "ColumnCaseType"

# Search for any type definitions containing parentCaseId
rg "parentCaseId"

# Find all TypeScript/TSX files that might contain ColumnCaseType
fd -e ts -e tsx | xargs cat | grep -A 10 "ColumnCaseType"

Length of output: 36103

apps/judicial-system/web/src/routes/Court/components/CasesInProgressTable/CasesInProgressTable.tsx (1)

144-152: LGTM! Props added to support extension label display.

The addition of decision and parentCaseId props to ColumnCaseType aligns with the PR objective to display the "Framlenging" label for extension cases.

Let's verify that the ColumnCaseType component handles these new props correctly:

✅ Verification successful

Props are correctly implemented in ColumnCaseType component

The component properly handles all the new props (decision and parentCaseId) and uses them appropriately:

  • Displays the case type using displayCaseType helper with both type and decision props
  • Shows the extension label (Framlenging) when parentCaseId is present
  • All props are properly typed and marked as optional
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify ColumnCaseType component implementation
# Search for the component definition to ensure it properly handles the new props
ast-grep --pattern 'const ColumnCaseType = ({ type, decision, parentCaseId }: Props) => {'

Length of output: 92


Script:

#!/bin/bash
# Let's try to find the ColumnCaseType component with a more flexible pattern
ast-grep --pattern 'const ColumnCaseType = $_'

# Also search for the file directly as it's likely in a separate component file
fd "ColumnCaseType" --type file

# As a backup, let's use ripgrep to find the component definition
rg "ColumnCaseType" -A 5

Length of output: 13849


Script:

#!/bin/bash
# Let's examine the ColumnCaseType component implementation to verify how it handles the props
cat "apps/judicial-system/web/src/components/Table/ColumnCaseType/ColumnCaseType.tsx"

Length of output: 1037

@gudjong gudjong added the deprecated:automerge (Disabled) Merge this PR as soon as all checks pass label Nov 7, 2024
@kodiakhq kodiakhq bot merged commit 30a0e38 into main Nov 7, 2024
36 checks passed
@kodiakhq kodiakhq bot deleted the j-s/fix-extended-tag branch November 7, 2024 17:43
jonnigs pushed a commit that referenced this pull request Nov 12, 2024
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
deprecated:automerge (Disabled) Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants