Skip to content

Mariano/fixes - #161

Merged
Marfuen merged 2 commits into
mainfrom
mariano/fixes
Mar 19, 2025
Merged

Marfuen merged 2 commits into
mainfrom
mariano/fixes

Conversation

@Marfuen

@Marfuen Marfuen commented Mar 19, 2025 •

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features
    • Enhanced navigation across the app by updating links and redirections to include your organization identifier. This improvement ensures that pages such as frameworks, risks, tests, vendors, and notifications now lead to organization-specific views for a more personalized user experience.

@vercel

vercel Bot commented Mar 19, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
app 🔄 Building (Inspect) Visit Preview 💬 Add feedback Mar 19, 2025 10:37pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
comp-portal ⬜️ Skipped (Inspect) Mar 19, 2025 10:37pm

@coderabbitai

coderabbitai Bot commented Mar 19, 2025 •

Copy link
Copy Markdown

Walkthrough

This update refactors various components and pages to dynamically construct URL paths using the organization identifier. Static paths have been replaced with dynamic ones by extracting the orgId via useParams or session data, ensuring that links, redirects, and notification record identifiers now correctly reflect organization-specific contexts. Several files also received formatting and indentation improvements without changing their underlying functionality.

Changes

Files Change Summary
apps/app/src/app/[locale]/.../components/FrameworkProgress.tsx, RequirementStatusChart.tsx, .../overview/frameworks/[frameworkId]/components/table/FrameworkControlsTableColumns.tsx, apps/app/src/components/tables/risk-register/columns.tsx, apps/app/src/components/tables/risk-tasks/columns.tsx, apps/app/src/components/tables/risk-tasks/empty-states.tsx, apps/app/src/components/tables/tests/empty-states.tsx, apps/app/src/jobs/tasks/notifications/risk-task-notification.ts,
apps/app/src/app/[locale]/.../risk/[riskId]/layout.tsx, apps/app/src/app/[locale]/.../vendors/(overview)/page.tsx, apps/app/src/app/[locale]/.../tests/all/[testId]/actions/createTestComment.ts
Updated link generation and redirection logic to incorporate dynamic organization IDs (using orgId from useParams or session data) in href attributes, record IDs, and revalidation paths.
apps/app/src/app/[locale]/.../risk/[riskId]/comments/page.tsx, .../risk/[riskId]/page.tsx, .../risk/[riskId]/tasks/[taskId]/page.tsx, apps/app/src/app/[locale]/.../tests/(overview)/page.tsx Made formatting and indentation adjustments for consistency, with minor modifications to redirect paths in some cases.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Component
    participant Router
    User->>Component: Clicks on a dynamically generated link
    Note right of Component: Extracts orgId via useParams/session
    Component->>Router: Constructs URL using `/[orgId]/...` and navigates
    Router->>User: Renders the organization-specific page
Loading

Possibly related PRs

Poem

I’m a bunny with code so bright,
Hopping through routes from morning to night.
Dynamic links now lead the way,
With orgId making every day gay,
I hop on through the code maze with delight! 🐇

Tip

⚡🧪 Multi-step agentic review comment chat (experimental)
  • We're introducing multi-step agentic chat in review comments. This experimental feature enhances review discussions with the CodeRabbit agentic chat by enabling advanced interactions, including the ability to create pull requests directly from comments.
    - To enable this feature, set early_access to true under in the settings.
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
  • @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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@Marfuen
Marfuen merged commit 34e4280 into main Mar 19, 2025

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 3

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e3f29ab and 3303e73.

📒 Files selected for processing (15)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/components/FrameworkProgress.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/components/RequirementStatusChart.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/overview/frameworks/[frameworkId]/components/table/FrameworkControlsTableColumns.tsx (3 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/[riskId]/comments/page.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/[riskId]/layout.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/[riskId]/page.tsx (2 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/[riskId]/tasks/[taskId]/page.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/(overview)/page.tsx (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/[testId]/actions/createTestComment.ts (1 hunks)
  • apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/(overview)/page.tsx (1 hunks)
  • apps/app/src/components/tables/risk-register/columns.tsx (1 hunks)
  • apps/app/src/components/tables/risk-tasks/columns.tsx (1 hunks)
  • apps/app/src/components/tables/risk-tasks/empty-states.tsx (1 hunks)
  • apps/app/src/components/tables/tests/empty-states.tsx (3 hunks)
  • apps/app/src/jobs/tasks/notifications/risk-task-notification.ts (1 hunks)
🧰 Additional context used
🧬 Code Definitions (4)
apps/app/src/components/tables/risk-tasks/columns.tsx (1)
apps/app/src/components/tables/risk-register/columns.tsx (1) (1)
  • columns (25-111)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/components/RequirementStatusChart.tsx (1)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/overview/frameworks/[frameworkId]/components/table/FrameworkControlsTableColumns.tsx (1) (1)
  • OrganizationControlType (21-37)
apps/app/src/components/tables/risk-register/columns.tsx (2)
apps/app/src/components/tables/risk-tasks/columns.tsx (1) (1)
  • columns (25-103)
apps/app/src/components/tables/policies/columns.tsx (1) (1)
  • columns (23-76)
apps/app/src/components/tables/risk-tasks/empty-states.tsx (1)
apps/app/src/components/tables/tests/empty-states.tsx (1) (1)
  • NoResults (13-44)
🔇 Additional comments (29)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/[riskId]/layout.tsx (1)

26-26: LGTM! Dynamic path correctly implemented

The redirect path now correctly includes the organization ID with a proper leading slash, ensuring users are redirected to their organization-specific risk page.

apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/all/[testId]/actions/createTestComment.ts (1)

34-34: LGTM! Path revalidation correctly updated

The revalidation path now correctly includes the organization ID, ensuring that the proper context-specific path is revalidated after a comment is created.

apps/app/src/jobs/tasks/notifications/risk-task-notification.ts (1)

52-52: Improved recordId by incorporating organization context

The update to include owner.organizationId in the recordId path ensures proper organization-specific context in notifications. This change is consistent with the app-wide effort to dynamically construct URL paths using organization identifiers.

apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/[riskId]/comments/page.tsx (1)

11-86: Code formatting improvements

The indentation has been standardized throughout the file using tabs instead of a mix of spaces and tabs. This improves readability and consistency with the codebase style. No functional changes were made.

apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/(overview)/page.tsx (1)

11-74: Code formatting and dynamic URL improvements

The indentation has been standardized throughout the file using tabs. Additionally, the redirect URL now correctly includes the organization context (/${session.user.organizationId}/risk/register), consistent with the app-wide effort to use dynamic organization-specific URLs.

apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/[riskId]/page.tsx (1)

9-250: Code formatting and indentation improvements

The file has been reformatted with consistent tab indentation throughout, improving readability while maintaining the same functionality. The redirect on line 71 now properly includes the organization context (/${session.user.organizationId}/risk), aligning with the app-wide effort to use dynamic organization-specific URLs.

apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/overview/frameworks/[frameworkId]/components/table/FrameworkControlsTableColumns.tsx (3)

20-20: Good addition of the useParams hook import.

This import allows the component to access the route parameters dynamically, which is essential for the URL structure changes.


65-65: Well implemented parameter extraction.

Correctly extracting the organization ID from route parameters and using TypeScript's generic type to ensure proper typing.


76-76: Appropriately updated link with dynamic orgId.

The href has been properly updated to use the dynamic organization ID from the route parameters, making the routing more consistent with the application's overall structure.

apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/tests/(overview)/page.tsx (4)

11-46: Clean formatting improvements to the TestsOverview component.

The indentation changes improve readability without changing the component's functionality.


28-28: Good update to include dynamic orgId in redirect path.

The redirect path now correctly incorporates the user's organization ID, maintaining consistency with the application's dynamic routing approach.


48-107: Well-formatted database transaction code.

The indentation and structure changes make the complex Promise.all database queries more readable while maintaining functionality.


109-121: Consistently formatted metadata function.

The formatting changes in the generateMetadata function follow the same pattern as the rest of the file, maintaining consistency.

apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/[riskId]/tasks/[taskId]/page.tsx (4)

13-13: Improved type for params property.

The formatting change to the params property type maintains consistency with other similar interfaces in the codebase.


17-42: Well-formatted component logic.

The indentation changes improve readability of the component's session validation and task retrieval logic without changing functionality.


31-31: Good update to include dynamic orgId in redirect path.

The redirect path now correctly uses the user's organization ID when a task is not found, maintaining consistency with the application's routing approach.


45-62: Consistently formatted data fetching functions.

The indentation changes to the getTask and getUsers functions improve readability while maintaining the same functionality.

Also applies to: 64-87

apps/app/src/components/tables/risk-tasks/columns.tsx (5)

10-10: Good addition of the useParams hook import.

This import allows the component to access the route parameters dynamically, consistent with the changes in other files.


12-23: Well-formatted RiskTaskType interface.

The indentation changes to the RiskTaskType interface improve readability without changing the type structure.


25-27: Correctly implemented parameter extraction.

The useParams hook is used properly to extract the organization ID, following the same pattern as in other files.


39-39: Appropriate update to include dynamic orgId in link path.

The link path now correctly incorporates the organization ID from the route parameters, maintaining consistency with the application's dynamic routing approach.


29-102: Well-formatted column definitions.

The indentation changes to the column definitions improve readability while maintaining the same functionality across all columns.

apps/app/src/components/tables/risk-register/columns.tsx (3)

11-11: Good addition of useParams hook

Adding the useParams hook from next/navigation is a necessary step for the refactoring of URL paths to include organization context.


27-27: Well implemented parameter extraction

Extracting the orgId from URL parameters with proper type definition ensures type safety in your routing.


40-40: Good implementation of dynamic URL construction

The refactoring to include the organization ID in the URL structure is a good practice for maintaining organization-specific context in navigation.

apps/app/src/components/tables/risk-tasks/empty-states.tsx (2)

19-19: Correctly updated parameter extraction

The expanded parameter extraction now includes both orgId and riskId, which properly supports the dynamic URL construction pattern being implemented across the application.


39-39: Properly updated navigation path

The Button's onClick handler now correctly redirects to a path that includes the organization context, maintaining consistency with the overall architecture changes.

apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/(home)/components/RequirementStatusChart.tsx (2)

11-11: Good addition of useParams hook

Adding the useParams hook is necessary for accessing the organization ID from the URL parameters.


64-64: Well implemented parameter extraction

Extracting the orgId with proper type safety ensures the correct usage in URL construction.

Comment on lines +34 to +37
<Button
variant="outline"
onClick={() => router.push(`${orgId}/tests`)}
>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add leading slash to prevent incorrect navigation

The path construction is missing a leading slash, which could lead to incorrect navigation. The correct format should be /${orgId}/tests for absolute paths.

-						onClick={() => router.push(`${orgId}/tests`)}
+						onClick={() => router.push(`/${orgId}/tests`)}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Button
variant="outline"
onClick={() => router.push(`${orgId}/tests`)}
>
<Button
variant="outline"
onClick={() => router.push(`/${orgId}/tests`)}
>

</p>
<Button asChild className="mt-4">
<Link href="/overview/frameworks">
<Link href={`${orgId}/overview/frameworks`}>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Add leading slash to prevent incorrect navigation

The href attribute is missing a leading slash, which could lead to incorrect navigation. This is inconsistent with other links in the same file (lines 156, 166, 176) that correctly use a leading slash.

-							<Link href={`${orgId}/overview/frameworks`}>
+							<Link href={`/${orgId}/overview/frameworks`}>
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<Link href={`${orgId}/overview/frameworks`}>
<Link href={`/${orgId}/overview/frameworks`}>


return (
<Link
href={`${orgId}/overview/frameworks/${framework.framework.id}`}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue

Missing leading slash in URL path

The URL construction appears to be missing a leading slash before the orgId variable. Unlike other implementations (e.g., /${orgId}/risk/...), this could potentially result in a relative URL rather than an absolute path from the root.

Apply this change:

-href={`${orgId}/overview/frameworks/${framework.framework.id}`}
+href={`/${orgId}/overview/frameworks/${framework.framework.id}`}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
href={`${orgId}/overview/frameworks/${framework.framework.id}`}
href={`/${orgId}/overview/frameworks/${framework.framework.id}`}

This branch was successfully deployed

1 active and 1 inactive deployments
Preview – app — 3303e737 Deployed Mar 19, 2025 by vercel[bot]
Preview – comp-portal — 3303e737 Deployed Mar 19, 2025 by vercel[bot]
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