Lewis/settings UI#306
Conversation
- Refactored SelectAssignee component for improved modularity and reusability across vendor and risk forms. - Updated various forms to utilize the new SelectAssignee component, ensuring consistent UI and functionality. - Improved code formatting and structure for better readability and maintainability. - Added loading states for vendor and risk overview pages to enhance user experience during data fetching.
- Standardized formatting and structure in EvidenceAssigneeChart, EvidenceStatusChart, PolicyAssigneeChart, and PolicyStatusChart components for improved readability and maintainability. - Updated chart data handling and tooltip components for better user experience. - Improved loading state in the loading component for the evidence overview page. - Ensured consistent use of Tailwind CSS classes across all chart components.
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎ |
WalkthroughThis pull request primarily consists of cosmetic changes across multiple components within the app. The updates involve reformatting and adjusting indentation, standardizing import paths, and reorganizing JSX structures. A few files also include minor layout modifications such as adjustments in column counts, updated grid class names, and the introduction of a new helper function and a Loading component. No functional logic or public API changes have been introduced. Changes
Sequence Diagram(s)sequenceDiagram
actor User
participant Page as Vendors Page
participant Loader as getVendors (cached)
participant DB as Vendor Service
User->>Page: Request vendors page (with search parameters)
Page->>Loader: Invoke getVendors(searchParams)
Loader->>DB: Validate session & fetch vendor data using orgId
DB-->>Loader: Return vendor data
Loader-->>Page: Provide vendor data
Page->>User: Render Vendors Table with updated DataTableToolbar
Possibly related PRs
Poem
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (10)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/settings/page.tsx (1)
43-61: Effective Use of Caching in organizationDetails with a Minor Optional Chaining Note
TheorganizationDetailsfunction is neatly encapsulated within acachecall and follows best practices in session validation and database querying.
Suggestion: Since you already check for the presence ofsession?.session.activeOrganizationIdon line 48, you may consider removing the optional chaining in the database query (line 53) for clarity:- where: { id: session?.session.activeOrganizationId }, + where: { id: session.session.activeOrganizationId },apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/(overview)/components/policy-status-chart.tsx (3)
48-59: Standardized Tooltip Component Formatting
The StatusTooltip component has been reformatted for enhanced readability. While the use ofanyfor props is common in quick implementations, consider strongly typing these props in the future for improved clarity and type safety.
129-134: Effective Calculation of the Most Common Status
The use of Array.reduce to determine the most common status based on the count is appropriate. One possible improvement for future consideration is handling tie cases explicitly, though the current implementation is acceptable for most scenarios.
167-235: Well-Structured Chart Rendering and Labeling
The chart rendering section, including the PieChart, ChartTooltip, and the inline Label rendering function, is clean and readable. The inline function for rendering custom labels is clear; however, if the labeling logic becomes more complex, consider refactoring it into a separate component for improved modularity.apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/[vendorId]/tasks/[taskId]/components/title/update-task-sheet.tsx (1)
79-105: Clear renderStatus Function with a Minor Suggestion
TherenderStatusfunction effectively maps task statuses to their respective colors and formats the status text. As a minor improvement, consider using a global replacement (e.g., using a regular expression likestatus.replace(/_/g, " ")) if there’s any chance of multiple underscores.apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/[vendorId]/tasks/[taskId]/components/secondary-fields/secondary-fields.tsx (2)
146-184: Auto-submit Behavior on Status Change
Within the "Status" FormField, the onValueChange handler calls bothfield.onChangeand immediately triggers an auto-submit usingform.handleSubmit(onSubmit)(). While this pattern provides immediate feedback, please ensure that this automatic submission is the intended UX behavior.
186-229: Due Date Field with Calendar Integration
The due date field is nicely integrated with a Popover-based calendar. Similar to the status field, the auto-submission on date selection is a design choice—confirm that immediate submission aligns with user expectations.apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/frameworks/components/FrameworkCard.tsx (1)
176-180: Consider removing commented codeThe commented-out section for trend information isn't being used. If this is planned for a future implementation, consider adding a TODO comment explaining the plan, otherwise it might be cleaner to remove it entirely.
- {/* <div className="flex items-center"> - <TrendingUp className="h-3.5 w-3.5 mr-1.5" /> - Trend: +5% - </div> */}Or add a TODO comment:
+ {/* TODO: Implement trend information in a future iteration <div className="flex items-center"> <TrendingUp className="h-3.5 w-3.5 mr-1.5" /> Trend: +5% </div> */}apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/(overview)/loading.tsx (1)
1-21: Well-implemented loading component.The Loading component follows the application pattern for skeleton loaders. It properly utilizes React.Suspense with a DataTableSkeleton fallback configured with appropriate column count, filter count, and cell widths.
However, the Suspense component is closed without any children. If this is intentional as a pattern to only show the fallback, it should be documented with a comment for clarity.
- <Suspense - fallback={ - <DataTableSkeleton - columnCount={3} - filterCount={2} - cellWidths={[ - "10rem", - "30rem", - "10rem", - ]} - shrinkZero - /> - } - /> + {/* Using Suspense for loading state only */} + <Suspense + fallback={ + <DataTableSkeleton + columnCount={3} + filterCount={2} + cellWidths={[ + "10rem", + "30rem", + "10rem", + ]} + shrinkZero + /> + } + > + {/* Actual content will be loaded by parent */} + </Suspense>apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/(overview)/page.tsx (1)
119-122: Consider more detailed error handling.The error handling for invalid search parameters now returns an empty array instead of redirecting. While this is cleaner, you might want to consider adding more detailed user feedback for invalid parameters.
if (!result.success) { console.error("Invalid search params:", result.error); - return []; + // Consider adding telemetry/monitoring here to track invalid requests + // Alternatively, consider throwing a more specific error that can be caught by an error boundary + return []; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (29)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/(overview)/components/evidence-assignee-chart.tsx(1 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/(overview)/components/evidence-status-chart.tsx(1 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/[evidenceId]/components/ReviewSection.tsx(2 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/all/loading.tsx(1 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/frameworks/components/FrameworkCard.tsx(2 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/(overview)/components/policy-assignee-chart.tsx(1 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/(overview)/components/policy-status-chart.tsx(1 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/(overview)/page.tsx(1 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/(overview)/RisksTable.tsx(1 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/(overview)/components/table/RiskColumns.tsx(1 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/(overview)/loading.tsx(0 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/(overview)/page.tsx(3 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/[riskId]/page.tsx(1 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/settings/page.tsx(1 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/(overview)/components/VendorColumns.tsx(1 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/(overview)/components/VendorsTable.tsx(1 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/(overview)/loading.tsx(1 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/(overview)/page.tsx(1 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/[vendorId]/components/secondary-fields/update-secondary-fields-form.tsx(1 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/[vendorId]/components/tasks/create-vendor-task-form.tsx(1 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/[vendorId]/tasks/[taskId]/components/secondary-fields/secondary-fields.tsx(2 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/[vendorId]/tasks/[taskId]/components/title/update-task-sheet.tsx(2 hunks)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/components/create-vendor-form.tsx(2 hunks)apps/app/src/components/forms/organization/delete-organization.tsx(1 hunks)apps/app/src/components/forms/organization/update-organization-name.tsx(1 hunks)apps/app/src/components/forms/policies/UpdatePolicyOverview.tsx(2 hunks)apps/app/src/components/forms/risks/create-risk-form.tsx(2 hunks)apps/app/src/components/forms/risks/risk-overview.tsx(2 hunks)packages/ui/src/components/card.tsx(1 hunks)
💤 Files with no reviewable changes (1)
- apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/(overview)/loading.tsx
🧰 Additional context used
🧬 Code Definitions (12)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/(overview)/loading.tsx (1)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/(overview)/loading.tsx (1)
Loading(4-21)
apps/app/src/components/forms/organization/update-organization-name.tsx (1)
packages/ui/src/components/card.tsx (1)
CardFooter(78-78)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/settings/page.tsx (12)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/(overview)/page.tsx (1)
generateMetadata(87-99)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/[riskId]/page.tsx (1)
generateMetadata(231-243)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/(overview)/page.tsx (1)
generateMetadata(77-89)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/(overview)/page.tsx (1)
generateMetadata(167-179)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/employees/[employeeId]/page.tsx (1)
generateMetadata(53-66)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/(overview)/page.tsx (1)
generateMetadata(157-169)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/integrations/page.tsx (1)
generateMetadata(52-64)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/[riskId]/tasks/[taskId]/page.tsx (1)
generateMetadata(55-67)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/settings/api-keys/page.tsx (1)
generateMetadata(29-41)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/[vendorId]/page.tsx (1)
generateMetadata(222-234)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/[policyId]/page.tsx (1)
generateMetadata(40-53)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/backup-overview/page.tsx (1)
generateMetadata(39-51)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/[evidenceId]/components/ReviewSection.tsx (5)
apps/app/src/components/SelectAssignee.tsx (1)
SelectAssignee(21-152)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/[evidenceId]/components/EvidenceStatusSection.tsx (1)
EvidenceStatusSection(18-72)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/[evidenceId]/components/EvidenceDepartmentSection.tsx (1)
EvidenceDepartmentSection(19-57)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/[evidenceId]/components/EvidenceFrequencySection.tsx (1)
EvidenceFrequencySection(19-59)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/[evidenceId]/components/EvidenceNextReviewSection.tsx (1)
EvidenceNextReviewSection(3-29)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/[vendorId]/components/tasks/create-vendor-task-form.tsx (2)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/[vendorId]/actions/task/create-task-action.ts (1)
createVendorTaskAction(10-54)apps/app/src/components/SelectAssignee.tsx (1)
SelectAssignee(21-152)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/frameworks/components/FrameworkCard.tsx (3)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/frameworks/types.ts (1)
FrameworkInstanceWithControls(10-18)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/frameworks/lib/getFrameworkDetails.ts (1)
getFrameworkDetails(4-6)packages/ui/src/components/card.tsx (6)
Card(76-76)CardHeader(77-77)CardTitle(79-79)CardDescription(80-80)CardContent(81-81)CardFooter(78-78)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/(overview)/components/VendorsTable.tsx (1)
apps/app/src/utils/auth.ts (1)
Member(90-90)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/[vendorId]/tasks/[taskId]/components/title/update-task-sheet.tsx (3)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/[vendorId]/actions/task/update-task-action.ts (1)
updateVendorTaskAction(11-73)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/[vendorId]/actions/schema.ts (1)
updateVendorTaskSchema(69-84)apps/app/src/components/SelectAssignee.tsx (1)
SelectAssignee(21-152)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/[vendorId]/components/secondary-fields/update-secondary-fields-form.tsx (2)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/[vendorId]/actions/update-vendor-action.ts (1)
updateVendorAction(10-66)apps/app/src/components/SelectAssignee.tsx (1)
SelectAssignee(21-152)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/[riskId]/page.tsx (3)
apps/app/src/components/tables/risk-tasks/server-columns.tsx (1)
getServerColumnHeaders(3-11)apps/app/src/components/risks/risk-overview.tsx (1)
RiskOverview(14-60)apps/app/src/components/tables/risk-tasks/columns.tsx (1)
RiskTaskType(12-23)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/(overview)/page.tsx (2)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/(overview)/components/VendorsTable.tsx (1)
VendorsTable(21-65)apps/app/src/lib/get-session.ts (1)
getServersideSession(5-21)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/components/create-vendor-form.tsx (3)
apps/app/src/utils/auth.ts (1)
Member(90-90)apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/actions/create-vendor-action.ts (1)
createVendorAction(21-54)apps/app/src/components/SelectAssignee.tsx (1)
SelectAssignee(21-152)
🔇 Additional comments (159)
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/settings/page.tsx (3)
11-15: Enhanced Function Signature Formatting in OrganizationSettings
The updated parameter declaration now leverages consistent indentation, which improves readability without any changes to functionality.
16-25: Clear and Consistent Component Implementation
The component correctly extracts the locale, applies static param settings, and fetches organization details before rendering the child components. The conditional use of optional chaining (e.g.,organization?.name ?? "") is appropriately used for safe rendering.
29-41: Consistent Formatting in generateMetadata Function
ThegenerateMetadatafunction has been reformatted to align with the codebase standards. The extraction oflocale, setting of static parameters, and fetching of translations withgetI18nmirrors what is seen in similar modules.apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/(overview)/components/policy-status-chart.tsx (11)
7-11: Updated Card Component Imports
The Card component imports have been reformatted to list each component on its own line. This improves readability and consistency.
14-17: Enhanced Chart Component Imports
The import statements for chart-related components (including the type declaration for ChartConfig) have been standardized. This adjustment not only improves readability but also reinforces type safety.
28-32: Improved Interface Formatting for PolicyOverviewData
The properties in the PolicyOverviewData interface are now consistently indented, which enhances clarity. The descriptive naming of fields makes the interface self-explanatory.
36-36: Clear Optional Prop Definition in PolicyStatusChartProps
The PolicyStatusChartProps interface now clearly indicates that the data prop is optional (and can be null). This explicit typing helps prevent potential runtime issues.
40-43: Consistent CHART_COLORS Constant Definition
The mapping of status names to their corresponding HSL color strings is clear and consistently formatted. This enhances maintainability by ensuring color codes are easily identifiable.
66-93: Graceful Handling of Missing Data
The conditional block for when no data is provided returns a well-structured Card with helpful messaging and visual cues. The usage of UI components like CardHeader, Badge, and CardContent is consistent with the design system.
95-120: Optimized Chart Data Calculation with useMemo
Using React.useMemo to compute filtered chart data based on provided props is a good optimization. The filtering of items that have a falsyvalueimproves efficiency and ensures only relevant data is rendered.
122-127: Type-Safe Chart Configuration
The chartConfig object utilizes thesatisfies ChartConfigassertion, which is a neat way to ensure it adheres to the defined interface. This practice enforces compile-time checks and enhances maintainability.
137-154: Clear Rendering of Most Common Status Badge
The conditional rendering of the Badge component that displays the most common status is well implemented. It effectively uses the provided data to enhance the visual feedback of the chart.
157-164: Robust Progress Bar Calculation
The inline style for the progress bar correctly computes the width while safely avoiding division by zero by using Math.max. This is a good defensive coding practice that ensures UI stability.
240-257: Clear and Accessible Legend Rendering
Mapping over chartData to render legend entries is implemented in a straightforward and visually clear manner. Each legend item correctly reflects its corresponding status and count, contributing to a user-friendly UI.apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/[vendorId]/components/tasks/create-vendor-task-form.tsx (8)
9-12: Cosmetic Update: Accordion Imports FormattingThe reformatting of the Accordion component imports improves code consistency and readability. These changes are purely cosmetic with no impact on functionality.
37-37: Update Import Path: SelectAssigneeThe import path for
SelectAssigneehas been updated to an absolute path (@/components/SelectAssignee), aligning it with the established conventions in the codebase.
40-44: Component Signature & Prop DestructuringThe changes to the component’s declaration—specifically the destructuring of the
assigneesprop and its inline type annotation—are cosmetic. They improve clarity and consistency without modifying the functionality.
47-50: Hook Usage: useQueryState and useParamsThe formatting for the hook calls (using
useQueryStateanduseParams) has been improved for readability. The updates do not alter the logic but make the code easier to read.
52-60: Action Hook Setup: createTaskThe invocation and configuration of
useAction(with its onSuccess and onError callbacks) have been reformatted. The refactored layout maintains the same functionality while enhancing readability.
62-71: Form Initialization with useFormThe form configuration, including the use of
zodResolverand the definition of defaultValues, is now more neatly organized. This cosmetic adjustment improves clarity and consistency with no functional implications.
73-75: onSubmit HandlerThe definition of the onSubmit function is concise and clearly formatted. There are no changes to the underlying logic; the update is solely for improved code clarity.
77-217: UI Markup & Layout AdjustmentsThe JSX returned by the component has been reformatted for consistent indentation and spacing. These cosmetic changes affect:
- The structure of the
<Accordion>and related items.- The alignment of form fields and buttons.
- The overall readability of the component’s layout.
All changes preserve the original functionality while aligning with updated styling and formatting conventions.
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/[vendorId]/components/secondary-fields/update-secondary-fields-form.tsx (11)
8-14: Cosmetic Import Formatting
The reformatting of the import block from@comp/ui/form(lines 8–14) enhances readability and establishes consistent visual grouping.
16-21: Consistent Select Component Grouping
The standardized grouping and indentation of imports from@comp/ui/select(lines 16–21) improves clarity and maintains code consistency across components.
28-28: Absolute Path Import for SelectAssignee
Changing the import path forSelectAssigneeto an absolute path ("@/components/SelectAssignee") improves maintainability by aligning with the project's import strategy.
32-38: Component Prop Types and Parameter Formatting
The functionUpdateSecondaryFieldsForm(lines 32–38) clearly defines its props (i.e.,vendorandassignees) with proper type annotations and consistent indentation. This ensures clarity when using these props within the component.
41-48: Action Hook Initialization
The initialization of theuseActionhook (lines 41–48) is done correctly with well-definedonSuccessandonErrorcallbacks leveraging thetoastnotifications. This provides immediate feedback on vendor updates.
50-60: Form Setup with useForm and zodResolver
The use ofuseForm(lines 50–60) withzodResolverfor schema-based validation is implemented correctly. Default values are accurately set from thevendorprop, ensuring that the form has the correct initial state.
62-74: onSubmit Handler Logic
TheonSubmitfunction (lines 62–74) correctly handles the normalization ofassigneeIdby converting an empty string tonulland then passes all the required fields to theupdateVendor.executemethod. The logic is clear and preserves the intended behavior.
76-98: Assignee Field Implementation
The implementation of the assignee field using theFormFieldand integrating theSelectAssigneecomponent (lines 76–98) is clean and maintains the established form control pattern. The disabled state tied to the action's status is handled appropriately.
99-126: Vendor Status Field via Select Component
The vendor status field (lines 99–126) is implemented using aSelectcomponent with clear separation of concerns. The dynamic rendering of the current status and the mapping overVENDOR_STATUS_TYPESensure both functionality and ease of reading.
127-165: Vendor Category Field with Readable Formatting
The category field (lines 127–165) not only uses aSelectcomponent, but also transforms the enum values into a user-friendly format. This attention to detail contributes to a better user experience when selecting vendor categories.
167-184: Submission Button and Loader Management
The submit button (lines 167–184) correctly manages its state by disabling the button during execution and providing visual feedback via theLoader2spinner. This conditional rendering ensures a responsive and intuitive user interface.apps/app/src/components/forms/organization/update-organization-name.tsx (1)
93-107: Update to CardFooter Styling in UpdateOrganizationName.
TheCardFootercomponent now usesclassName="flex justify-between", effectively removing thebg-accent/30styling. This change appears intended to simplify the styling and align it with the standard set in other areas (such as in the delete organization component). Please verify that the adjusted styling meets the design requirements and maintains visual consistency across similar components.packages/ui/src/components/card.tsx (1)
67-72: Refined CardFooter Styling in Card Component.
The updatedCardFooternow applies the classes"flex items-center p-6 border-t text-xs bg-accent/20 text-muted-foreground", which provides a more defined background and text color. This enhancement should help standardize the footer appearance across different card usages. Please double-check the new styles in various contexts (e.g., light/dark modes) to ensure appropriate contrast and visual appeal.apps/app/src/components/forms/organization/delete-organization.tsx (1)
64-70: Simplified CardFooter Styling in DeleteOrganization.
TheCardFooterhere has been updated toclassName="flex justify-between", removing the previously applied background color (e.g.bg-accent/30). This simplification helps to keep the visual style minimal in this context. Please confirm that the new styling still provides sufficient visual separation for the footer content, especially given the significance of deletion actions.apps/app/src/components/forms/policies/UpdatePolicyOverview.tsx (3)
3-15: Improved Imports Organization.
The updated import block now includes the newSelectAssigneecomponent and a reordering of related imports (e.g., from@comp/db/types). These changes enhance clarity and maintainability without impacting functionality.
44-48: Refined policyStatuses Array Formatting.
ThepolicyStatusesarray is now formatted with consistent indentation:const policyStatuses: PolicyStatus[] = [ "draft", "published", "needs_review", ] as const;This purely cosmetic change improves readability.
102-310: Consistent JSX Layout and Formatting Enhancements.
The remainder of the component—spanning the JSX layout of the form—is now consistently formatted using grid layouts and improved indentation. These adjustments ensure better readability and maintainability while preserving the original functionality. No functional changes have been introduced.apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/[vendorId]/tasks/[taskId]/components/title/update-task-sheet.tsx (12)
3-3: Simplify Import Path for SelectAssignee
The import has been updated to use an absolute path, which improves clarity and consistency across the codebase.
6-10: Consistent Import Ordering for Accordion Components
The imports forAccordion,AccordionContent,AccordionItem, andAccordionTriggerare now clearly grouped with uniform indentation. This enhances readability and maintainability.
15-21: Standardized Import Structure for Form Components
Reordering and grouping of the form component imports (Form,FormControl,FormField,FormItem,FormLabel, andFormMessage) improve the code’s readability.
25-29: Clear Import Structure for Select Components
The updated, consistently ordered import block forSelectcomponents (includingSelect,SelectContent,SelectItem,SelectTrigger, andSelectValue) aids in clarity.
45-46: Updated Interface for Task and Assignees
TheUpdateTaskSheetPropsinterface now clearly defines that thetaskincludes an optionalassigneeobject with its user details, and thatassigneesis a well-typed list. Verify that downstream components are updated accordingly.
50-51: Effective Use of State and Routing Parameters
The hooksuseQueryStateanduseParamsare used appropriately to manage state and retrieve parameters (e.g.,taskId). The naming is clear and the usage fits well into the component’s flow.
53-61: Proper Configuration of the Update Action
The configuration ofuseActionwith success and error callbacks (displaying toast messages and updating the query state) is succinct and effective.
63-73: Accurate Default Values in useForm Hook
The default values provided touseFormare correctly derived fromtaskand URL parameters. This ensures that the form is pre-populated as expected.
75-77: Streamlined onSubmit Handler
TheonSubmitfunction cleanly executes the task update. Its simplicity keeps the form submission logic focused and maintainable.
210-213: Confirm Auto-Submission on Status Change
Within the<Select>for the status field, theonValueChangehandler calls bothfield.onChange(value)and immediately invokesform.handleSubmit(onSubmit)(). This triggers an auto-submit upon any status change. Please confirm if this auto-update behavior is intentional, as it might lead to unexpected submissions if the user also intends to click the Update button later.
242-259: Effective Integration of SelectAssignee Component
The<SelectAssignee>component is used appropriately, with all necessary props (assigneeId,assignees,onAssigneeChange,disabled, andwithTitle) correctly passed. Its integration maintains consistency with the overall form design.
266-277: Clear Call-to-Action with Update Button
The update button is clearly defined and properly disabled when the update action is executing, preventing duplicate submissions and ensuring a smooth user experience.apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/[vendorId]/tasks/[taskId]/components/secondary-fields/secondary-fields.tsx (13)
3-3: Refined Import Path for SelectAssignee
The updated import on line 3 uses a concise path which improves clarity. Ensure that this update is consistent with other similar imports across the codebase.
10-15: Consistent Import Formatting for Form Components
The reformatting of the Form-related imports (Form, FormControl, FormField, etc.) enhances readability. The grouping neatly aligns with your project’s styling conventions.
19-23: Polished Import Formatting for Select Components
The updated grouping for the Select components (Select, SelectContent, SelectItem, SelectTrigger, SelectValue) is clear and organized.
35-58: Improved Component Formatting for SecondaryFields
The structural reformatting of theSecondaryFieldscomponent (lines 35–58) enhances clarity without altering behavior. The layout now portrays the component’s hierarchy more clearly.
60-68: Precise Destructuring in TaskSecondaryFieldsForm
The refined parameter destructuring and type definitions in theTaskSecondaryFieldsFormcomponent improve clarity. This change aligns well with modern TypeScript practices.
69-76: Clean useAction Hook Setup
The configuration of theuseActionhook with success and error callbacks is well structured. The toast notifications provide clear feedback on task updates.
78-88: Enhanced useForm Initialization
The default values and schema resolver setup for the form are clearly defined. The conditional initialization of thedueDatefield is both clear and effective.
90-92: Streamlined onSubmit Handler
The onSubmit handler directly delegates form submission to the updateTask action. This concise approach maintains clarity and functionality.
94-120: Clear Implementation of renderStatus Function
TherenderStatusfunction correctly maps task statuses to their corresponding color codes and formats the display. Its structure is both concise and readable.
122-124: Well-Structured Form Initialization
The integration of the<Form>and<form>elements is neatly organized, aiding in readability and maintenance.
125-144: Effective Assignee Field Integration
The FormField for the "Assignee" field is implemented clearly. The use of the customSelectAssigneecomponent along with proper control binding makes the code easy to follow.
231-247: Responsive Save Button Implementation
The submit button is well-implemented: it properly reflects the update status by displaying a loading spinner and disabling interactions as needed.
248-250: Tidy Component Closure
The final structure properly closes both the form and the component, maintaining a clean and legible JSX hierarchy.apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/frameworks/components/FrameworkCard.tsx (3)
6-6: Good improvement to component compositionUsing the specialized card components from the UI library instead of a single Card component improves the semantic structure of the component and follows better composition principles.
83-181: Well-structured component layout with improved semanticsThe refactored JSX structure with appropriate Card subcomponents (CardHeader, CardTitle, CardDescription, etc.) creates a more maintainable and semantically correct layout. The responsive design consideration (hiding the status badge on small screens) is also a good improvement.
79-80:Details
❓ Verification inconclusive
Placeholder for last activity date might be misleading
The current implementation always shows today's date rather than actual framework activity data. Consider replacing this with real activity timestamp data from the framework instance if available.
🏁 Script executed:
#!/bin/bash # Check if there's an actual lastUpdated field in frameworkInstance type rg -A 10 "type FrameworkInstance" --glob "*.ts"Length of output: 928
Action Required: Confirm Future Data Integration for Last Activity Date
The current implementation in
FrameworkCard.tsxuses the current date as a fallback since no real activity timestamp exists in the framework instance types. Verification via the search indicates that theFrameworkInstance(and its extension inFrameworkInstanceWithControls) does not include a property such aslastUpdatedor similar to represent the real last activity date.
- The absence of a dedicated timestamp property means that the placeholder (
new Date().toLocaleDateString()) is the only available option at this time.- If real activity data is intended, consider updating the framework instance type (or its source data) to include an actual activity timestamp, then update this component accordingly.
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/components/create-vendor-form.tsx (11)
7-10: Cosmetic Reformatting of Accordion Imports
The reordering and consistent indentation for the Accordion components improve readability. There are no functional changes.
14-19: Consistent Formatting for Form Imports
The grouped and indented import of Form-related components is clear and consistent, enhancing code clarity without impacting functionality.
23-27: Well-Formatted Select Imports
The adjusted indentation for the Select component imports improves visual clarity. This cosmetic change is well executed.
38-38: Standardizing Import Path for SelectAssignee
Changing the import from a relative path to an absolute path (@/components/SelectAssignee) aligns with project best practices and enhances maintainability and consistency across files.
42-47: Validation Schema Formatting
ThecreateVendorSchemafields are clearly defined with appropriate validations and defaults. These cosmetic adjustments improve readability without affecting the logic.
51-52: Component Props Destructuring
The destructuring of theassigneesprop in theCreateVendorFormcomponent is concise and adheres to coding standards. No changes are needed here.
53-77: Query State Hooks Formatting
The usage ofuseQueryStatefor retrieving various query parameters is consistently formatted and clear. These changes enhance readability without altering functionality.
81-97: Vendor Creation Action Handling
TheuseActionhook implementation forcreateVendorActionis well structured with proper success and error notifications and router redirection. The cosmetic reformatting in this block preserves the intended behavior.
99-107: React Hook Form Initialization
The form initialization usinguseFormandzodResolveris clearly defined with sensible default values. The improved formatting makes the code more approachable and maintainable.
109-112: Submission Handler onSubmit
The onSubmit function is succinct and effectively delegates to the action executor. This straightforward functionality is preserved and clearly presented.
113-323: JSX Layout and Form Structure
The updated JSX layout, including the Accordion structure and all FormField components, has been reformatted to improve readability and consistency. All components (such as Input, Textarea, Select, and SelectAssignee) are arranged clearly, and the code’s logic remains intact.apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/(overview)/RisksTable.tsx (4)
14-14: Good addition of the DataTableToolbar component.The introduction of the DataTableToolbar centralizes UI controls for the table, improving organization and maintainability.
26-35: Code organization looks good.The hooks setup is clean and well-structured, with proper memoization of the columns to avoid unnecessary recalculations when dependencies change.
55-72: Good restructuring with DataTableToolbar.The UI restructuring using DataTableToolbar improves organization while maintaining the same functionality. The approach of using children to pass in the DataTableSortList provides good component composition.
37-49:Details
✅ Verification successful
Note the removal of default sorting.
The initialState no longer contains sorting configuration that was likely present in the previous version. Verify this was intentional and won't affect user experience negatively.
🏁 Script executed:
#!/bin/bash # Check the git history to see what sorting configuration was removed git show HEAD~1:apps/app/src/app/[locale]/\(app\)/\(dashboard\)/[orgId]/risk/\(overview\)/RisksTable.tsx | grep -A 15 "initialState"Length of output: 391
Action: Confirm Absence of Default Sorting in RisksTable.tsx
After verifying the HEAD~1 snapshot of the file, the
initialStateconfiguration only contains pagination settings (with no default sorting defined). This indicates that no default sorting was present in the previous version, and its absence in the current code appears intentional. Please confirm that this behavior aligns with the desired functionality and won’t negatively impact the user experience.apps/app/src/components/forms/risks/create-risk-form.tsx (4)
5-5: Improved import path.The import path for SelectAssignee has been simplified to use an absolute reference, which is consistent with the standardization effort across the codebase.
10-14: Consistent formatting.The import groupings are now properly formatted with consistent indentation, improving readability.
Also applies to: 17-23, 26-31
46-68: Well-structured query state setup.The query state setup is well-organized with clear comments and consistent formatting. Each state has appropriate default values and parsing.
96-277: Consistent form structure.The form structure has been reformatted with consistent indentation while maintaining all functionality. The hierarchical structure of form fields within accordions makes the form organization clear and maintainable.
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/all/loading.tsx (1)
6-14:Details
✅ Verification successful
Updated skeleton configuration.
The DataTableSkeleton configuration has been updated to match the current table layout with 5 columns and consistent cell widths. The changes ensure the loading state accurately represents the actual table structure.
Verify that these changes align with the actual evidence table structure to ensure a seamless transition when data loads.
🏁 Script executed:
#!/bin/bash # Check for the actual table structure in evidence components fd "evidence.*table" "apps/app/src" | xargs rg -l "cellWidths|columns" | xargs catLength of output: 1449
Skeleton Configuration Verified
The updated DataTableSkeleton now correctly reflects the evidence table’s layout by configuring 5 columns with the following cell widths:
- 1st column: 10rem
- 2nd column: 30rem
- 3rd column: 10rem
- 4th column: 10rem
- 5th column: 10rem
After reviewing the EvidenceTable component (which constructs its columns via
getEvidenceColumns()), no discrepancies were found between the skeleton’s configuration and the actual table structure. Please verify that thegetEvidenceColumnsimplementation continues to align with these dimensions when making further changes.apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/(overview)/components/evidence-status-chart.tsx (7)
7-12: Enhanced Card Component Imports.
The Card component imports are now reformatted with consistent indentation, which improves readability without affecting functionality.
23-28: Interface Formatting Improvement.
TheEvidenceOverviewDatainterface is reformatted for visual consistency. No logic changes were introduced.
41-73: Conditional Rendering Block Reformatting.
The block handling the "no data" case is now indented uniformly, making the component’s structure clearer.
75-95: Chart Data Calculation Clarity.
The memoized calculation ofchartDatais reformatted for improved readability while preserving its original logic.
97-102: Type-Safe Chart Configuration.
Using thesatisfies ChartConfigoperator forchartConfigenforces type safety and is now clearly formatted.
103-109: Most Common Status Calculation Formatting.
The useMemo hook that computes the most common status is now easier to read and maintains its intended functionality.
111-233: Consistent JSX Rendering Structure.
The comprehensive JSX block has been reformatted with consistent indentation and spacing, enhancing maintainability with no changes in behavior.apps/app/src/components/forms/risks/risk-overview.tsx (2)
5-5: Cleaned Import for SelectAssignee.
The updated import now uses the simplified path (@/components/SelectAssignee), which increases clarity and aligns with project conventions.
40-229: Uniform Formatting in UpdateRiskOverview.
The UpdateRiskOverview component’s indentation and formatting have been standardized across the file. These cosmetic adjustments improve readability without modifying the component’s logic.apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/(overview)/page.tsx (4)
12-17: Improved Function Parameter Indentation.
The parameters in thePoliciesOverviewfunction are now indented consistently, which enhances the overall code clarity.
20-32: Consistent JSX Return Formatting.
The JSX structure within thePoliciesOverviewcomponent is uniformly formatted for improved readability with no functional changes.
34-165: Streamlined Data Fetching Logic.
ThegetPoliciesOverviewfunction has been reformatted to organize asynchronous database calls more clearly; its logic remains unchanged.
167-180: Metadata Function Formatting.
ThegenerateMetadatafunction now uses a consistent indentation style, making the code easier to read while preserving its behavior.apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/(overview)/components/evidence-assignee-chart.tsx (8)
6-12: Enhanced Import Formatting for Card Components.
The Card component imports are now neatly organized, which improves consistency across the codebase.
30-38: AssigneeData Interface Reformat.
TheAssigneeDatainterface is reformatted to display each property on its own line, enhancing readability without altering the type structure.
40-81: No Data Fallback UI Formatting.
The conditional block that renders a fallback UI when no data is available is now uniformly indented to improve clarity.
83-89: Refined Sorted Data Calculation.
The memoized computation for sorting assignee data is now divided into clear steps (sorting, slicing, then reversing) for easier comprehension.
91-96: Chart Data Mapping Clarity.
The mapping function that createschartDatafromsortedDatais formatted to clearly express its purpose, with no logic changes.
97-107: Type-Safe Chart Configuration.
The chart configuration object now correctly employs thesatisfies ChartConfigoperator and is formatted for quick understanding.
108-120: Clear Summary Calculation.
The memoized computations fortotalEvidenceandtopAssigneeare now better formatted to showcase their intent while remaining functionally identical.
121-217: Comprehensive Chart Rendering Block.
The JSX rendering block for the evidence chart is reformatted with consistent spacing, making it more maintainable without modifying its functionality.apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/evidence/[evidenceId]/components/ReviewSection.tsx (9)
4-12: Enhanced Import Organization for Type Definitions.
The type imports from@comp/db/typesare now grouped and indented properly, which enhances clarity and maintainability.
24-24: Streamlined SelectAssignee Import.
The import forSelectAssigneenow adheres to project standards, ensuring a cleaner and more direct path.
26-41: ReviewSectionProps Interface Reformatting.
The interfaceReviewSectionPropshas been reformatted by placing each property on its own line, greatly improving its readability without altering its structure.
43-50: Improved Component Parameter Destructuring.
The destructuring of props in theReviewSectioncomponent is now neatly organized, making the function signature clearer and easier to maintain.
51-64: State Initialization Clarity.
The initialization of state variables (frequency, department, assigneeId, status, isSaving) is formatted clearly, contributing to better code comprehension.
66-75: Action Hook Configuration and Handlers.
TheuseActionhook and its associated success/error handlers are now grouped and indented for clarity, without impacting execution.
77-86: handleSaveChanges Simplification.
ThehandleSaveChangesfunction is concise and its formatting now makes its intent immediately clear with no behavioral changes.
88-90: Event Handlers Formatting.
The formatting forhandleDepartmentChangeandhandleStatusChangehas been standardized, which improves the overall legibility of event management.
96-150: Clean and Structured JSX Markup.
The return block (JSX) is reformatted with consistent indentation and spacing. These improvements enhance maintainability while keeping the UI logic intact.apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/policies/(overview)/components/policy-assignee-chart.tsx (12)
5-11: LGTM! Clean formatting of UI component imports.The import statement formatting looks good and follows a consistent indentation pattern, improving readability.
13-17: LGTM! Consistent formatting of chart imports.The chart-related imports are now consistently formatted, matching the style of other import blocks.
22-29: LGTM! Well-structured Recharts component imports.The Recharts library imports are properly formatted with consistent indentation.
31-39: LGTM! Clean interface definition.The AssigneeData interface is well-structured with consistent indentation for all properties.
45-50: LGTM! Clear color constants definition.The CHART_COLORS constant is well-formatted with helpful comments for each color.
55-85: LGTM! Well-structured empty state handling.The conditional rendering for empty state is cleanly formatted with a logical component hierarchy.
87-93: LGTM! Clean data sorting implementation.The useMemo implementation for sorting data is well-formatted and follows best practices.
95-101: LGTM! Clear data transformation logic.The chart data mapping is cleanly structured and easy to follow.
103-120: LGTM! Well-organized chart configuration.The chart configuration object is clearly structured with consistent formatting.
122-126: LGTM! Clean calculation logic.The total policies calculation is implemented correctly with proper memoization.
128-133: LGTM! Well-implemented top assignee logic.The top assignee calculation is implemented correctly with proper memoization.
135-246: LGTM! Clean component return structure.The component return statement is well-organized with consistent indentation, making the JSX structure easy to follow.
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/[riskId]/page.tsx (10)
16-25: LGTM! Clear interface definition.The PageProps interface is well-structured with consistent indentation for all properties.
28-33: LGTM! Clean variable initialization.The destructuring of params and subsequent API calls are well-formatted.
34-40: LGTM! Clear search parameters handling.The destructuring of searchParams with default values is well-formatted.
42-53: LGTM! Well-structured tasks loading.The column headers retrieval and task loading logic are properly formatted.
55-57: LGTM! Clear redirect handling.The null risk check and redirect are properly formatted.
59-74: Updated breadcrumb label to improve UI consistency.The breadcrumb label has been changed from "Risk" to "Risks" to better reflect that it links to the risks overview page.
77-101: LGTM! Clean getRisk implementation.The getRisk function is well-structured with proper error handling and database querying.
103-205: LGTM! Well-structured getTasks implementation.The getTasks function is properly formatted with clean indentation for the complex query structure.
207-229: LGTM! Clean getAssignees implementation.The getAssignees function is well-implemented with proper session validation and database querying.
231-243: LGTM! Clean metadata generation.The generateMetadata function is well-formatted with proper locale handling.
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/(overview)/page.tsx (4)
18-20: Added orgId to params interface.The orgId parameter has been added to the params interface, allowing direct access to the organization ID.
29-30: LGTM! Updated destructuring to include orgId.The destructuring statement now includes orgId from the params object.
77-83: Enhanced UI with breadcrumb navigation.The RisksTable component is now wrapped in a PageWithBreadcrumb component, providing better contextual navigation.
35-37:Details
❓ Verification inconclusive
Modified search parameter handling.
The search parameter is now passed directly without the fallback to an empty string, which may affect search behavior when no search term is provided.
🏁 Script executed:
#!/bin/bash # Check how the getRisks function handles undefined search parameters rg --type typescript "export const getRisks|export function getRisks" -A 5Length of output: 111
I'll run a revised shell script that targets TypeScript files (*.ts and *.tsx) to find the definition of
getRisksand verify its handling of undefined search parameters:
🏁 Script executed:
#!/bin/bash # Searching for the definition of the getRisks function in .ts and .tsx files rg -g '*.ts' -g '*.tsx' "export (const|getRisks|function getRisks)" -A 10Length of output: 73480
Verify search parameter handling in getRisks
The change now passes the
searchvalue directly (line 35–37 inapps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/(overview)/page.tsx) without the previous fallback to an empty string. This update may lead to unexpected behavior ifgetRisksis not designed to handle an undefined or null search parameter. Please manually verify thatgetRiskseither internally defaults undefined values appropriately or otherwise handles the absence of a search term as intended.apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/risk/(overview)/components/table/RiskColumns.tsx (5)
8-8: LGTM! Added DataTableColumnHeader import.Added import for DataTableColumnHeader component, which will be used for column headers.
11-31: Enhanced title column with better structure and filtering.The title column now includes unique id, DataTableColumnHeader component, and meta information for improved filtering and sorting.
32-46: Enhanced status column with better structure and filtering.The status column now includes unique id, DataTableColumnHeader component, and meta information for improved filtering and sorting.
47-65: Enhanced department column with better structure and filtering.The department column now includes unique id, DataTableColumnHeader component, and meta information for improved filtering and sorting.
66-103: Enhanced assignee column with better structure and filtering.The assignee column now includes unique id, DataTableColumnHeader component, and meta information for improved filtering capabilities.
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/(overview)/components/VendorColumns.tsx (3)
8-8: Good addition of the DataTableColumnHeader component.Adding the DataTableColumnHeader component provides a consistent header appearance across all columns in the table.
10-107: Good restructuring of columns definition.The changes improve the structure by:
- Assigning explicit IDs to each column
- Using DataTableColumnHeader consistently
- Adding metadata for better filtering and search functionality
- Enabling column filtering where appropriate
This restructuring aligns with best practices for TanStack Table and provides better maintainability.
19-19:Details
❓ Verification inconclusive
Verify organization ID reference.
The link URL now uses
row.original.organizationIddirectly from the row data instead of potentially getting it from a parameter. This should work correctly as long as each row contains the correct organizationId.
🏁 Script executed:
#!/bin/bash # Check if VendorRegisterTableRow type includes organizationId grep -r "VendorRegisterTableRow" --include="*.ts*" . | grep -i "organizationId"Length of output: 77
Action: Verify the organizationId property on row data
The updated code now constructs the link URL using
row.original.organizationId. However, our initial search for the expected type definition (e.g., in a type likeVendorRegisterTableRow) did not return any results confirming that this property is defined. Please manually verify that the object referenced byrow.originalindeed contains a validorganizationIdfield. Consider the following:
- Check that the type or interface for the row data (possibly named
VendorRegisterTableRowor similar) includes anorganizationIdproperty.- Ensure that all rows passed to this component contain the correct organizationId required for the link URL.
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/(overview)/components/VendorsTable.tsx (5)
11-13: Good imports for improved functionality.Adding useParams simplifies access to route parameters, and the DataTableToolbar component provides a more consistent UI pattern across the application.
16-18: Improved type formatting.The reformatting of the VendorRegisterTableRow type improves readability while maintaining the same structure.
28-30: Simplified organization ID retrieval.Switching from useSession to useParams for retrieving the orgId simplifies the code by directly accessing the URL parameter rather than extracting it from the session.
32-45: Well-structured data table configuration.The table configuration is now more streamlined:
- Directly using columns without passing orgId (consistent with VendorColumns.tsx changes)
- Setting appropriate pagination defaults
- Adding shallow and clearOnDefault options for better state management
This improves the component's maintainability and performance.
47-64: Improved component structure with DataTableToolbar.The updated JSX structure is cleaner and more consistent:
- Using DataTableToolbar for standardized action handling
- Incorporating DataTableSortList within the toolbar
- Maintaining the CreateVendorSheet component for vendor creation
This approach provides better separation of concerns and a more consistent UI pattern.
apps/app/src/app/[locale]/(app)/(dashboard)/[orgId]/vendors/(overview)/page.tsx (3)
17-35: Improved function signature and data fetching approach.The updated Page function has better parameter formatting and uses the new getVendors helper function for cleaner data retrieval.
91-145: Good extraction of vendor fetching logic.Creating a cached getVendors function:
- Improves code organization and separation of concerns
- Enhances performance through caching
- Centralizes data validation and error handling
The approach of returning an empty array instead of redirecting on validation failures is a cleaner pattern for handling invalid parameters.
147-171: Well-structured getAssignees function.The reformatted getAssignees function maintains the same functionality with improved readability.
Summary by CodeRabbit
New Features
Style
Refactor