Skip to content

Cleanup #128

Merged
Marfuen merged 9 commits into
mainfrom
mariano/cleanup
Mar 12, 2025
Merged

Cleanup #128
Marfuen merged 9 commits into
mainfrom
mariano/cleanup

Conversation

@Marfuen

@Marfuen Marfuen commented Mar 12, 2025

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

  • New Features

    • Enhanced responsiveness in table layouts, with non-essential columns conditionally hidden on smaller screens.
    • Added clickable links for easier navigation to detail screens in various components.
  • Style

    • Improved styling for components, including the Editable Department and Vendor Overview, enhancing visual organization.
    • Reorganized loading views provide a cleaner and more consistent presentation.
  • Refactor

    • Streamlined overall alignment and grouping of dashboard elements to deliver a smoother and more intuitive user interface.
    • Introduced a mobile-friendly UI component for API key creation, improving responsiveness and maintainability.
    • Updated table structures to enhance semantic organization and clarity.

@vercel

vercel Bot commented Mar 12, 2025

Copy link
Copy Markdown

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

Name Status Preview Comments Updated (UTC)
app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 12, 2025 7:03pm
2 Skipped Deployments
Name Status Preview Comments Updated (UTC)
comp-portal ⬜️ Skipped (Inspect) Mar 12, 2025 7:03pm
web ⬜️ Skipped (Inspect) Mar 12, 2025 7:03pm

@coderabbitai

coderabbitai Bot commented Mar 12, 2025

Copy link
Copy Markdown

Walkthrough

This pull request introduces several code formatting enhancements, responsive design updates, and minor refactors across various components. Specific changes include reindenting JSX code, removing unused variables, and modifying the layout of table headers and cells for improved responsiveness. In the tables for evidence and people, navigation has been shifted from row click events to explicit link-based interactions, and sorting functionality has been adjusted by swapping certain column headers. No public APIs have been altered.

Changes

File(s) Change Summary
apps/app/src/app/[locale]/(app)/(dashboard)/evidence/[id]/components/EvidenceDetails.tsx,
apps/app/src/app/[locale]/(app)/(dashboard)/evidence/[id]/components/ReviewSection.tsx,
apps/app/src/app/[locale]/(app)/(dashboard)/evidence/components/EvidenceList.tsx
Code reformatting and indentation improvements; removal of unused destructured variables; no functional changes.
apps/app/src/app/[locale]/(app)/(dashboard)/evidence/components/SkeletonTable.tsx Revised table header and cell structure with additional headers and cells conditionally hidden on smaller screens for responsive design.
apps/app/src/app/[locale]/(app)/(dashboard)/evidence/components/data-table/EvidenceListTable.tsx Removed router-based navigation on row click; replaced with conditional CSS styling using the cn function.
apps/app/src/app/[locale]/(app)/(dashboard)/evidence/components/data-table/columns.tsx Updated column rendering: replaced tooltip with a Button wrapping a Link for navigation; applied responsive CSS classes for various columns.
apps/app/src/app/[locale]/(app)/(dashboard)/evidence/components/data-table/data-table-header.tsx Adjusted header rendering with conditional classes to hide specific headers on small screens.
apps/app/src/app/[locale]/(app)/(dashboard)/people/components/EmployeesListSkeleton.tsx Overhauled skeleton layout to use table components from @bubba/ui/table and added responsive design elements.
apps/app/src/components/tables/people/data-table-header.tsx Swapped the "email" and "name" columns for sorting; updated button texts and handlers accordingly; adjusted header visibility classes.
apps/app/src/components/tables/people/data-table.tsx Restructured table columns: switched roles of "name" and "email" columns, integrated Link component for navigation, and streamlined header and cell rendering with responsive behavior.
apps/app/src/app/[locale]/(app)/(dashboard)/people/[employeeId]/components/EditableDepartment.tsx Added utility function import; modified JSX structure for improved styling and layout; enhanced responsiveness.
apps/app/src/app/[locale]/(app)/(dashboard)/vendors/(overview)/page.tsx Simplified JSX structure by removing nested divs and applying direct class names for layout adjustments.
apps/app/src/components/vendors/charts/category-chart.tsx Removed predefined category colors; renamed interface and updated prop types; adjusted filtering logic and chart margins.
apps/app/src/components/vendors/charts/status-chart.tsx Added logic for handling zero values in data; adjusted chart margins and bar styling.
apps/app/src/components/vendors/charts/vendors-by-category.tsx Updated comments and variable naming for clarity; no functional changes.
apps/app/src/components/vendors/charts/vendors-by-status.tsx Added CSS class names to Card components for layout adjustments; no functional changes.
apps/app/src/components/vendors/charts/vendors-overview.tsx Restructured JSX to improve layout and visual presentation of components.
apps/app/src/components/tables/api-keys/create-api-key-dialog.tsx Introduced a new mobile-friendly UI component using a Sheet for mobile views; abstracted repeated code into functions for maintainability.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant DataTable
    participant LinkComponent
    participant DetailPage

    User->>DataTable: Clicks on Name column (button/link)
    DataTable->>LinkComponent: Triggers navigation
    LinkComponent->>DetailPage: Loads detail view
    DetailPage-->>User: Displays detailed information
Loading

Possibly related PRs

  • Charts #85: The changes in the main PR related to the EvidenceDetails.tsx file involve code formatting and the removal of an unused variable, while the retrieved PR focuses on modifications to the EvidenceDetails.tsx file that include changes to import statements and the introduction of a new function for handling mutations, indicating a direct connection at the code level.

Poem

I’m a rabbit, hopping through the code,
Skipping over spaces in a rhythmic mode.
Tables now dance with responsive flair,
Every click leads you with gentle care.
Code’s a garden — I celebrate each change with a happy air!
🐇🌸

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.

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 91851ec and 0a0940f.

📒 Files selected for processing (1)
  • apps/app/src/app/[locale]/(app)/(dashboard)/(home)/components/FrameworkProgress.tsx (4 hunks)
🔇 Additional comments (6)
apps/app/src/app/[locale]/(app)/(dashboard)/(home)/components/FrameworkProgress.tsx (6)

14-15: Added necessary imports for responsive design implementation.

These imports enable the responsive behavior improvements in this component, with useMediaQuery for screen size detection and ReactNode for more flexible component rendering.


34-35: Good implementation of responsive detection.

The isMobile constant correctly uses the useMediaQuery hook to detect small screens, with the breakpoint properly aligned with Tailwind's sm breakpoint (640px).


42-42: Type enhancement for better component flexibility.

Changing the label prop type from string to ReactNode allows for more versatile label content, enabling the conditional rendering implemented later.


77-78: Improved text alignment and rendering.

Added text-center class to ensure proper centering of label text, maintaining consistent styling.


163-169: Enhanced responsive label for evidence tasks.

Good implementation of conditional rendering for the evidence tasks label, showing a shorter version on mobile screens and the full text on larger screens.


173-178: Enhanced responsive label for cloud tests.

Similar to the evidence tasks, this correctly implements conditional rendering for cloud tests labels based on screen size, providing a better mobile experience.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 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.

…yling. Added max-width constraints and truncation for department display, ensuring a cleaner layout on mobile devices.
…d VendorOverview to use a grid layout, ensuring full-width display. Enhanced charts to handle zero values gracefully, maintaining visual integrity. Adjusted margins and overflow properties for better presentation across devices.
@vercel vercel Bot temporarily deployed to Preview – web March 12, 2025 18:36 Inactive
@vercel vercel Bot temporarily deployed to Preview – comp-portal March 12, 2025 18:36 Inactive

@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: 1

🧹 Nitpick comments (3)
apps/app/src/app/[locale]/(app)/(dashboard)/vendors/(overview)/page.tsx (1)

24-28: Potential unused variable.

The overview data is fetched on line 24 but doesn't appear to be used in the component rendering. Consider either using this data or removing the unused fetch.

apps/app/src/components/vendors/charts/status-chart.tsx (2)

54-60: Good improvement for handling the all-zero case!

Adding logic to handle when all data values are zero ensures the chart remains visually meaningful rather than disappearing or looking broken. The approach of setting all values to 1 creates equal-sized bars, while preserving the original zero values in tooltips.

Consider adding a brief comment explaining why setting values to 1 was chosen over other approaches (like percentage-based rendering) for future maintainers:

	// If all values are 0, add a fake value to make the chart display properly
	const allZeros = sortedData.every((d) => d.value === 0);
	if (allZeros) {
+		// Using value=1 creates equal-sized bars while preserving proportionality
		for (const d of sortedData) {
			d.value = 1; // Set a default value for display purposes
		}
	}

83-85: Appropriate margin adjustments for improved readability.

Increasing the margins provides more space for status labels and tick marks, improving the overall readability of the chart.

Consider using CSS variables for these margin values to make them more maintainable and potentially responsive:

-	const marginLeft = 120; // Increase left margin for labels
-	const marginRight = 40; // Increase right margin slightly
-	const marginBottom = 30; // Increase bottom margin for tick labels
+	// Define responsive margins based on available space
+	const marginLeft = Math.min(120, window.innerWidth * 0.2); // Responsive left margin
+	const marginRight = 40;
+	const marginBottom = 30;
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c615b31 and 4e4bf54.

📒 Files selected for processing (6)
  • apps/app/src/app/[locale]/(app)/(dashboard)/vendors/(overview)/page.tsx (1 hunks)
  • apps/app/src/components/vendors/charts/category-chart.tsx (5 hunks)
  • apps/app/src/components/vendors/charts/status-chart.tsx (5 hunks)
  • apps/app/src/components/vendors/charts/vendors-by-category.tsx (2 hunks)
  • apps/app/src/components/vendors/charts/vendors-by-status.tsx (1 hunks)
  • apps/app/src/components/vendors/charts/vendors-overview.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • apps/app/src/components/vendors/charts/vendors-by-status.tsx
🔇 Additional comments (21)
apps/app/src/components/vendors/charts/vendors-overview.tsx (1)

10-17: Enhanced responsive layout with improved structure

The changes implement a proper responsive grid layout that improves how the vendor charts are displayed across different device sizes. The implementation now:

  1. Uses a responsive grid that displays a single column on mobile and two columns on medium screens and above
  2. Properly contains each component in its own div with explicit width and height controls
  3. Adds appropriate spacing between components with the gap utility

This is a good improvement over the previous fragment-based implementation as it provides better structure and responsive behavior.

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

26-29: Layout structure simplified to enhance responsive design.

The changes remove the grid layout (previously grid grid-cols-1 md:grid-cols-2 gap-4) in favor of a simpler stacked layout with consistent spacing and padding. This aligns with changes made to the vendor overview components elsewhere in the codebase, creating a more consistent responsive experience.

apps/app/src/components/vendors/charts/status-chart.tsx (3)

158-159: Good visual and tooltip improvements.

Adding rounded corners to the bars enhances the visual appeal, and displaying the actual zero values in tooltips despite the visual representation ensures accurate data communication.


210-210: Improved label positioning.

Increasing the width allocation for labels from marginLeft - 2 to marginLeft - 10 helps prevent truncation and improves alignment with the chart bars.


119-119: Good overflow handling for responsive design.

Adding overflow-x-hidden to the chart container prevents horizontal scrolling when content exceeds the container width, maintaining a clean layout.

apps/app/src/components/vendors/charts/category-chart.tsx (12)

7-10: Interface renamed for better generalization

The interface has been renamed from VendorCategoryData to CategoryData, making it more generic and removing the vendor-specific prefix. This supports better reusability if the chart is needed for non-vendor category visualization in the future.


13-13: Updated prop type to match renamed interface

Prop type reference has been appropriately updated to use the renamed CategoryData interface, maintaining type consistency.


19-19: Default behavior change for empty departments

The default value for showEmptyDepartments has been changed from true to false, which alters the component's default behavior to hide departments with zero values instead of showing them.

Verify that all existing usages of this component are prepared for this change in default behavior. Components that relied on empty departments being shown by default might need to explicitly set this prop to true now.


24-24: Simplified variable naming in filter function

The variable name in the filter function has been changed from dept to d for consistency with the rest of the component.


31-31: Updated message for empty state

The message has been changed from "No departments with risks found" to "No categories with risks found" to align with the component's renaming from departments to categories.


36-42: Added handling for charts with all zero values

A new feature has been added to handle the case when all values are zero. This prevents the chart from appearing empty by setting all values to 1 for display purposes, while still showing the actual zero values in tooltips.

This is a good enhancement that improves the user experience by providing visual feedback even when there's no meaningful data to display.


65-67: Adjusted chart margins for better visualization

The margin settings have been updated to provide more space:

  • Left margin increased to 120px (likely to accommodate longer category names)
  • Right margin increased to 40px
  • Bottom margin increased to 30px (likely for better tick label visibility)

These adjustments improve the overall readability and presentation of the chart.


69-69: Updated helper functions to use the renamed type

The getBarKey and getLabelKey functions have been updated to use the renamed CategoryData type, maintaining type consistency throughout the component.

Also applies to: 73-73


93-93: Added overflow control to chart container

The container div now includes max-w-full overflow-x-hidden classes to prevent horizontal overflow issues. This ensures the chart stays within its container without causing layout problems.


132-132: Simplified bar styling with theme colors

Bar styling has been improved by:

  • Using the theme's primary color (bg-primary) instead of custom colors
  • Adding conditional opacity for zero values
  • Adding dark mode support with dark:opacity-90

This approach makes the component more consistent with the application's theming system and improves dark mode support.


133-133: Enhanced tooltip to show accurate values

The tooltip now conditionally shows zero values when allZeros is true, ensuring that even though bars are displayed with a value of 1 for visualization purposes, the tooltip shows the accurate data.


184-184: Improved label positioning

The width calculation for label positioning has been changed from marginLeft - 2 to marginLeft - 10, providing more space for the category labels and reducing the risk of text overflow.

apps/app/src/components/vendors/charts/vendors-by-category.tsx (4)

31-33: Approving terminology update from "departments" to "categories"

The comment updates correctly align terminology with the actual data being processed (categories rather than departments), making the code more consistent and easier to understand.


35-35: LGTM!

Terminology alignment to use "categories" is consistent with the previous comment changes.


47-47: Enhanced Card styling for better responsiveness

Adding w-full h-full classes ensures the Card component takes full width and height of its container, improving the layout consistency.


51-51: Improved CardContent width control

The addition of the w-full class ensures proper width control of content within the card.

<CardContent className="w-full">
<VendorCategoryChart
data={categoriesToShow}
showEmptyDepartments={true}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Consider updating prop name to match terminology changes

While comments were updated to use "categories" instead of "departments", this prop name still uses the old terminology.

-	showEmptyDepartments={true}
+	showEmptyCategories={true}

🏁 Script executed:

#!/bin/bash
# Check if the VendorCategoryChart component uses this prop name
rg -A 3 -B 3 "showEmptyDepartments" --glob "*.{ts,tsx}"

Length of output: 3781


Update vendor charts prop name for consistency

Please rename the prop from showEmptyDepartments to showEmptyCategories in the vendor charts. In particular:

  • In apps/app/src/components/vendors/charts/vendors-by-category.tsx, update the prop when passing it to the chart component:
    -   showEmptyDepartments={true}
    +   showEmptyCategories={true}
  • In apps/app/src/components/vendors/charts/category-chart.tsx, update the VendorCategoryChartProps interface and its default value accordingly:
    -	interface VendorCategoryChartProps {
    -	  data: CategoryData[];
    -	  showEmptyDepartments?: boolean;
    -	}
    +	interface VendorCategoryChartProps {
    +	  data: CategoryData[];
    +	  showEmptyCategories?: boolean;
    +	}
    
    -	export function VendorCategoryChart({
    -	  data,
    -	  showEmptyDepartments = false,
    -	}: VendorCategoryChartProps) {
    +	export function VendorCategoryChart({
    +	  data,
    +	  showEmptyCategories = false,
    +	}: VendorCategoryChartProps) {

This update aligns the prop naming with the updated terminology in the comments and UI.

📝 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
showEmptyDepartments={true}
showEmptyCategories={true}

…s. Implemented media query for adaptive label display, ensuring concise text on smaller screens. Updated layout for better visual alignment and user experience across devices.
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