Skip to content

Comments

[WEB-3504]chore: issue properties refactor#6724

Merged
sriramveeraghanta merged 3 commits intopreviewfrom
chore_issue_properties_refactor
Mar 10, 2025
Merged

[WEB-3504]chore: issue properties refactor#6724
sriramveeraghanta merged 3 commits intopreviewfrom
chore_issue_properties_refactor

Conversation

@vamsikrishnamathala
Copy link
Member

@vamsikrishnamathala vamsikrishnamathala commented Mar 7, 2025

Description

This update includes code refactor for Issue properties in List view, kanban view and spreadsheet view.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

Test Scenarios

References

WEB-3504

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Extended issue details now include an additional properties section, offering richer contextual information.
    • Spreadsheet views have been enhanced with dynamic icon and column mappings for clearer, more consistent visual representation.
    • New constants for spreadsheet properties have been introduced to improve data organization.
    • A new functional component for rendering spreadsheet property icons has been added.
  • Refactor

    • Configurations and type definitions for issue display properties have been streamlined to improve consistency across the issue detail and spreadsheet layouts.
    • Simplified type definitions and component structures for better maintainability.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 7, 2025

Walkthrough

The changes update and consolidate constants, type definitions, and component structures related to issue display properties and spreadsheet views. New constants and a new component have been introduced to standardize spreadsheet property metadata and icons. The modifications include reformatting of type definitions, introduction of mappings for icons and columns, and removal of outdated constants. Changes span across constants, type declarations, and both CE and core component implementations to streamline how issue properties are represented and rendered.

Changes

File(s) Change Summary
packages/constants/.../common.ts Consolidated import statement formatting; added new constants SPREADSHEET_PROPERTY_LIST and SPREADSHEET_PROPERTY_DETAILS for mapping display property keys to detailed metadata.
packages/types/.../view-props.d.ts Reformatted TIssueLayouts into a single-line declaration; introduced new type TSpreadsheetColumn as a React functional component type.
web/ce/components/issues/issue-layouts/additional-properties.tsx Added new React component WorkItemLayoutAdditionalProperties for displaying additional properties of issues.
web/ce/components/issues/issue-layouts/utils.tsx Introduced SpreadSheetPropertyIconMap for icon mappings; added SPREADSHEET_COLUMNS constant for spreadsheet column components.
web/core/components/issues/issue-layouts/... Integrated IssueAdditionalProperties into IssueProperties; refactored spreadsheet files by removing SPREADSHEET_PROPERTY_DETAILS and consolidating column definitions; replaced removed types/constants with imports; added new SpreadSheetPropertyIcon component for dynamic icon rendering.

Possibly related PRs

Suggested labels

🌟improvement

Suggested reviewers

  • SatishGandham
  • sriramveeraghanta
  • rahulramesha

Poem

I'm a rabbit tapping away in code,
New constants and icons lighten my load.
With properties aligned in a neat, fresh row,
Spreadsheet views now beautifully flow.
I hop with joy in this refactored abode 🐇
Coding carrots crunch with every mode!

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (2)
web/core/components/issues/issue-layouts/utils.tsx (1)

711-721: Consider a fallback for missing icons.
When iconKey is not found in SpreadSheetPropertyIconMap, the component returns null. You could provide a default icon or a warning to help debugging.

    if (!Icon) 
-     return null;
+     return <SomeDefaultIcon className="h-4 w-4" />;
web/core/components/issues/issue-layouts/spreadsheet/columns/header-column.tsx (1)

53-53: Optional fallback for missing icons.
You rely on propertyDetails.icon to decide which icon to display. If the key is invalid or unrecognized, SpreadSheetPropertyIcon returns null. Consider a fallback icon or a placeholder when icon metadata is unexpectedly missing.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a953013 and edeeb70.

📒 Files selected for processing (9)
  • packages/constants/src/issue/common.ts (3 hunks)
  • packages/types/src/view-props.d.ts (2 hunks)
  • web/ce/components/issues/issue-layouts/additional-properties.tsx (1 hunks)
  • web/ce/components/issues/issue-layouts/utils.tsx (1 hunks)
  • web/core/components/issues/issue-layouts/properties/all-properties.tsx (2 hunks)
  • web/core/components/issues/issue-layouts/spreadsheet/columns/header-column.tsx (2 hunks)
  • web/core/components/issues/issue-layouts/spreadsheet/issue-column.tsx (1 hunks)
  • web/core/components/issues/issue-layouts/spreadsheet/spreadsheet-view.tsx (1 hunks)
  • web/core/components/issues/issue-layouts/utils.tsx (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (19)
packages/types/src/view-props.d.ts (1)

212-217: Well-structured new type for spreadsheet columns.

The new TSpreadsheetColumn type is well-defined with clear prop types that follow best practices. This is a good addition for stronger typing in the spreadsheet implementation.

web/ce/components/issues/issue-layouts/additional-properties.tsx (1)

1-10: New component structure is good, but currently empty.

The new IssueAdditionalProperties component is well-structured with proper type definitions. However, it currently renders an empty fragment. Make sure to implement the actual rendering logic in a follow-up PR (if that's the plan) or complete the implementation.

Is this component intentionally an empty placeholder for future implementation, or should it be rendering some content already?

web/core/components/issues/issue-layouts/properties/all-properties.tsx (2)

36-37: Good import organization with clear comment.

The import follows best practices with appropriate comment labeling.


513-515: Clean integration of the new component.

The IssueAdditionalProperties component is integrated well with proper props being passed. The clear comment above helps developers understand its purpose in the component hierarchy.

web/core/components/issues/issue-layouts/spreadsheet/spreadsheet-view.tsx (1)

4-4: Good refactoring to use centralized constants.

Moving from a local constant to an imported one from @plane/constants improves code organization and maintainability. This is a positive change that aligns with good software engineering practices.

web/core/components/issues/issue-layouts/utils.tsx (3)

3-3: Good adoption of React’s FC type.
This import of FC clarifies the intent to use a typed functional component, which improves code readability and maintainability.


30-30: No issues with adding ISvgIcons.
Ensuring that icons share a common set of props through ISvgIcons helps maintain consistency across the codebase.


39-39:

Details

❓ Verification inconclusive

Potential circular-import concern.
SpreadSheetPropertyIconMap is imported from the same folder as this file. Verify that this doesn’t create a circular reference.


🏁 Script executed:

#!/bin/bash
# Description: Search for circular dependencies involving "issue-layouts/utils".
# We'll look for any import lines from "issue-layouts/utils" in these files to confirm there's no cyc import.

fd . --extension ts --extension tsx --exclude node_modules --exec rg 'from\s+\".*issue-layouts/utils\"'

Length of output: 65613


Circular Dependency Concern – Please Verify Alias Resolution

I re-ran the search using a corrected regex to check for circular imports in the "issue-layouts/utils.tsx" file. There was no clear evidence of a circular dependency from the automated search. However, note that the file imports SpreadSheetPropertyIconMap using an alias (i.e. "@/plane-web/components/issues/issue-layouts/utils"). Please manually verify that the alias correctly resolves to a location distinct from this file (and not a self‑reference) to ensure there isn’t an unintended circular dependency.

• Verify the module alias mapping for "@" to ensure it does not resolve back to the same file.
• Confirm that no other files create a dependency cycle involving issue-layouts/utils.

web/core/components/issues/issue-layouts/spreadsheet/issue-column.tsx (1)

9-11: Good reduction of imports into a single columns entry point.
Importing SPREADSHEET_COLUMNS from one source centralizes the column definitions, eliminating duplicated code. The additional comment (“// utils”) is purely informational and not interfering with functionality.

web/core/components/issues/issue-layouts/spreadsheet/columns/header-column.tsx (2)

3-5: No significant concerns with new icon imports.
These icons from lucide-react and the reference to SPREADSHEET_PROPERTY_DETAILS appear correctly integrated.


10-12: Centralized usage of UI components.
Combining CustomMenu, Row, and SpreadSheetPropertyIcon from shared modules keeps the code DRY.

packages/constants/src/issue/common.ts (4)

1-1: Improved import organization.

Consolidating the imports for TIssueGroupByOptions, TIssueOrderByOptions, and IIssueDisplayProperties into a single line improves readability and maintainability.


148-165: Well-structured property keys constant.

The ISSUE_DISPLAY_PROPERTIES_KEYS array provides a centralized, type-safe list of all available issue display properties, which will help maintain consistency across the application.


214-229: Good separation of concerns for spreadsheet properties.

The SPREADSHEET_PROPERTY_LIST constant creates a dedicated list specifically for spreadsheet views, making it clear which properties are available in this context.


231-353: Comprehensive property metadata structure.

The SPREADSHEET_PROPERTY_DETAILS constant provides a well-organized mapping of property keys to their metadata, including internationalization titles, sorting options, and associated icons. This centralization will help maintain consistency across various UI components.

web/ce/components/issues/issue-layouts/utils.tsx (4)

1-14: Good organization of icon imports.

The imports are well-organized, making it easy to see which icons are being used in the component.


16-17: Enhanced type safety with additional type imports.

Adding IIssueDisplayProperties and TSpreadsheetColumn types improves type checking and ensures consistency with the constants defined in the common file.


19-34: Comprehensive spreadsheet column component imports.

The imports are well-organized and correspond directly to the column components used in the SPREADSHEET_COLUMNS constant.


55-70:

Details

❓ Verification inconclusive

Well-structured spreadsheet column mapping.

The SPREADSHEET_COLUMNS constant provides a comprehensive mapping between property keys and their corresponding column components. This structure aligns well with the SPREADSHEET_PROPERTY_DETAILS constant in the common file, creating a cohesive system for managing issue property representations.

I'd recommend ensuring this component mapping is kept in sync with the SPREADSHEET_PROPERTY_LIST and SPREADSHEET_PROPERTY_DETAILS constants when properties are added or removed in the future.


🏁 Script executed:

#!/bin/bash
# Verify that all properties in SPREADSHEET_PROPERTY_LIST have corresponding entries in SPREADSHEET_COLUMNS

# Find all properties in SPREADSHEET_PROPERTY_LIST
echo "Checking for consistency between SPREADSHEET_PROPERTY_LIST and SPREADSHEET_COLUMNS..."

# Get the property list from common.ts
property_list=$(rg -U "export const SPREADSHEET_PROPERTY_LIST.*?];" packages/constants/src/issue/common.ts --json | jq -r '.data.lines.text')
echo "Property List found:"
echo "$property_list"

# Get the column mapping from utils.tsx
column_mapping=$(rg -U "export const SPREADSHEET_COLUMNS.*?};" web/ce/components/issues/issue-layouts/utils.tsx --json | jq -r '.data.lines.text')
echo "Column Mapping found:"
echo "$column_mapping"

# Compare to ensure all properties have corresponding column components
echo "Checking for missing mappings..."

Length of output: 694


Action: Verify Consistency Between Spreadsheet Property Declarations and Column Mappings

The mapping defined in SPREADSHEET_COLUMNS is well-structured and aligns with our approach in managing issue property representations. However, please ensure that this mapping remains synchronized with the spreadsheet property declarations, particularly with SPREADSHEET_PROPERTY_LIST (and by extension, SPREADSHEET_PROPERTY_DETAILS). Our automated check did not retrieve any output for these constants, so it’s important to manually verify that:

  • All properties listed in SPREADSHEET_PROPERTY_LIST in packages/constants/src/issue/common.ts are properly represented in the SPREADSHEET_COLUMNS mapping.
  • Any future additions or removals of properties are consistently updated in both the property list and the component mapping.

Overall, the mapping looks solid; just be cautious to update both sides when property changes occur.

@vamsikrishnamathala vamsikrishnamathala marked this pull request as draft March 7, 2025 15:42
@makeplane
Copy link

makeplane bot commented Mar 7, 2025

Pull Request Linked with Plane Issues

References

Comment Automatically Generated by Plane

@vamsikrishnamathala vamsikrishnamathala changed the title [WEB-3301]chore: issue properties refactor [WEB-3504]chore: issue properties refactor Mar 7, 2025
@vamsikrishnamathala vamsikrishnamathala marked this pull request as ready for review March 10, 2025 06:57
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
web/ce/components/issues/issue-layouts/utils.tsx (1)

38-52: ⚠️ Potential issue

Fix typos in icon map keys

There are typos in the icon map keys that could lead to incorrect icon rendering:

 export const SpreadSheetPropertyIconMap: Record<string, FC<ISvgIcons>> = {
   Users: Users,
-  CalenderDays: CalendarDays,
-  CalenderCheck2: CalendarCheck2,
+  CalendarDays: CalendarDays,
+  CalendarCheck2: CalendarCheck2,
   Triangle: Triangle,
   Tag: Tag,
   DiceIcon: DiceIcon,
   ContrastIcon: ContrastIcon,
   Signal: Signal,
   CalendarClock: CalendarClock,
   DoubleCircleIcon: DoubleCircleIcon,
   Link2: Link2,
   Paperclip: Paperclip,
   LayersIcon: LayersIcon,
 };
🧹 Nitpick comments (1)
web/ce/components/issues/issue-layouts/utils.tsx (1)

37-69: Consider adding a SpreadSheetPropertyIcon component

For consistency with the implementation pattern, consider adding a utility component to retrieve and render the appropriate icon based on the property name:

type TSpreadSheetPropertyIconProps = {
  iconKey: string;
  className?: string;
};

export const SpreadSheetPropertyIcon: FC<TSpreadSheetPropertyIconProps> = ({ iconKey, className = "" }) => {
  const Icon = SpreadSheetPropertyIconMap[iconKey] || (() => null);
  return <Icon className={className} />;
};

This would make it easier to use the icons consistently throughout the application.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between edeeb70 and 63bb868.

📒 Files selected for processing (2)
  • web/ce/components/issues/issue-layouts/additional-properties.tsx (1 hunks)
  • web/ce/components/issues/issue-layouts/utils.tsx (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)
🔇 Additional comments (2)
web/ce/components/issues/issue-layouts/additional-properties.tsx (1)

1-9: Component is exported but contains no implementation

The IssueAdditionalProperties component is properly exported but currently renders an empty fragment. While this might be intentional for a staged refactoring approach, ensure that this is not an oversight and that implementation will be added in a future PR or commit.

web/ce/components/issues/issue-layouts/utils.tsx (1)

54-69: LGTM! Comprehensive mapping of issue display properties to spreadsheet columns

The SPREADSHEET_COLUMNS constant provides a complete mapping between issue display properties and their corresponding spreadsheet column components. This is a good approach for organizing the columns and will make maintenance easier.

@vamsikrishnamathala vamsikrishnamathala marked this pull request as draft March 10, 2025 07:03
@vamsikrishnamathala vamsikrishnamathala marked this pull request as ready for review March 10, 2025 07:41
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
web/ce/components/issues/issue-layouts/additional-properties.tsx (1)

1-10: New component needs implementation

This component is currently just a skeleton with no implementation, returning an empty fragment. While this may be intentional as part of the refactoring process, ensure you add the required functionality in a subsequent PR or commit.

Consider enhancing this component with:

  1. JSDoc comments describing its purpose and usage
  2. Proper implementation that renders the issue properties based on displayProperties
import React, { FC } from "react";
import { IIssueDisplayProperties, TIssue } from "@plane/types";

+/**
+ * Component to display additional properties for work items based on the display settings
+ * @param displayProperties - Properties to be displayed
+ * @param issue - The issue/work item data to render properties from
+ */
export type TWorkItemLayoutAdditionalProperties = {
  displayProperties: IIssueDisplayProperties;
  issue: TIssue;
};

-export const WorkItemLayoutAdditionalProperties: FC<TWorkItemLayoutAdditionalProperties> = (props) => <></>;
+export const WorkItemLayoutAdditionalProperties: FC<TWorkItemLayoutAdditionalProperties> = ({ displayProperties, issue }) => {
+  // TODO: Implement rendering of additional properties based on displayProperties
+  return <></>;
+};
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 63bb868 and 27c6d0e.

📒 Files selected for processing (1)
  • web/ce/components/issues/issue-layouts/additional-properties.tsx (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Analyze (python)
🔇 Additional comments (2)
web/ce/components/issues/issue-layouts/additional-properties.tsx (2)

4-7: Type definition looks good

The exported type definition is clear and properly structured with the necessary properties.


9-9: Consider implementing per a previous review

This component should be exported to be used with other components as previously suggested.

@sriramveeraghanta sriramveeraghanta merged commit a9045ad into preview Mar 10, 2025
5 of 6 checks passed
@sriramveeraghanta sriramveeraghanta deleted the chore_issue_properties_refactor branch March 10, 2025 11:44
This was referenced Mar 10, 2025
@coderabbitai coderabbitai bot mentioned this pull request Mar 24, 2025
6 tasks
lifeiscontent pushed a commit that referenced this pull request Aug 18, 2025
* chore: issue properties refactor

* chore: added export to props

* chore: updated component name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants