Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WEB-2388] chore: theme changes and workspace draft issue total count updated #5805

Merged
merged 2 commits into from
Oct 11, 2024

Conversation

anmolsinghbhatia
Copy link
Collaborator

@anmolsinghbhatia anmolsinghbhatia commented Oct 11, 2024

Summary:
This PR includes workspace draft issues and theme change.

Summary by CodeRabbit

  • New Features

    • Enhanced draft issue handling with improved logic for creating cycle and module issues.
    • Updated display logic for the CountChip component to reflect total pagination count.
    • Introduced a new IssueTypeIdentifier component to enrich the information displayed in the draft issue block.
  • Bug Fixes

    • Corrected model reference in the deletion logic for draft issues.
  • Style

    • Minor adjustment to the header style for the primary variant; no new properties added.

Copy link
Contributor

coderabbitai bot commented Oct 11, 2024

Walkthrough

The pull request includes modifications to the WorkspaceDraftIssueViewSet class, specifically updating the destroy method to reference DraftIssue instead of Issue. It also enhances the create_draft_to_issue method to manage cycle and module issues. Additionally, the headerStyle object in the UI was altered, although the change appears to be redundant. The WorkspaceDraftHeader component's logic for displaying the CountChip was updated to use total pagination count. New types and components related to issue identification were also introduced.

Changes

File Path Change Summary
apiserver/plane/app/views/workspace/draft.py Updated WorkspaceDraftIssueViewSet to reference DraftIssue in destroy method and enhanced create_draft_to_issue for cycle and module issues.
packages/types/src/workspace-draft-issues/base.d.ts Added type_id: string; property to TWorkspaceDraftIssue.
packages/ui/src/header/helper.tsx Modified headerStyle for EHeaderVariant.PRIMARY, though the change is a duplicate and does not add new properties.
web/app/[workspaceSlug]/(projects)/drafts/header.tsx Changed condition for displaying CountChip to use paginationInfo?.total_count instead of paginationInfo?.count.
web/ce/components/issues/issue-details/issue-identifier.tsx Introduced new type TIssueTypeIdentifier and new component IssueTypeIdentifier.
web/core/components/issues/workspace-draft/draft-issue-block.tsx Added import for IssueTypeIdentifier and conditional rendering based on issue.type_id.

Possibly related PRs

  • [WEB-2043] chore: updated permissions for delete operation #5231: This PR introduces permission checks for delete operations, which are relevant to the changes in the destroy method of the WorkspaceDraftIssueViewSet class in the main PR, as both involve managing permissions for deletion.
  • [WEB-2388] dev: workspace draft issues #5772: This PR focuses on workspace draft issues, including the WorkspaceDraftIssueViewSet class, which is directly related to the changes made in the main PR regarding draft issues and their management.
  • [WEB-2388] fix: workspace draft issues #5800: This PR also addresses workspace draft issues, specifically modifying serializers and components related to draft issues, which aligns with the changes made in the main PR regarding the WorkspaceDraftIssueViewSet and its associated methods.

Suggested labels

🌐frontend, 🎨UI / UX, 🧹chore

Suggested reviewers

  • sriramveeraghanta
  • SatishGandham
  • rahulramesha

Poem

In a workspace where drafts take flight,
A rabbit hops with joy and delight.
Issues transformed, cycles in line,
With headers adjusted, all is just fine.
Count chips now tally the total with glee,
Hopping along, oh what fun it will be! 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

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: 0

🧹 Outside diff range and nitpick comments (1)
web/app/[workspaceSlug]/(projects)/drafts/header.tsx (1)

47-51: Approved: Updated pagination count logic

The change from paginationInfo?.count to paginationInfo?.total_count looks good. This update likely provides a more accurate representation of the total number of draft issues.

For improved readability, consider using a ternary operator instead of an if-else statement with an empty fragment:

-            {paginationInfo?.total_count && paginationInfo?.total_count > 0 ? (
-              <CountChip count={paginationInfo?.total_count} />
-            ) : (
-              <></>
-            )}
+            {paginationInfo?.total_count && paginationInfo?.total_count > 0 ? (
+              <CountChip count={paginationInfo.total_count} />
+            ) : null}

This change eliminates the need for an empty fragment and makes the code more concise.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 6200890 and 5e43e9c.

📒 Files selected for processing (3)
  • apiserver/plane/app/views/workspace/draft.py (1 hunks)
  • packages/ui/src/header/helper.tsx (1 hunks)
  • web/app/[workspaceSlug]/(projects)/drafts/header.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/ui/src/header/helper.tsx
🧰 Additional context used
🔇 Additional comments (1)
apiserver/plane/app/views/workspace/draft.py (1)

213-213: Approved: Correctly updated the model in permission decorator

Changing model=Issue to model=DraftIssue in the @allow_permission decorator aligns the model with the destroy method's purpose of deleting draft issues. This ensures that permission checks are accurately applied to the DraftIssue model.

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

🧹 Outside diff range and nitpick comments (3)
web/ce/components/issues/issue-details/issue-identifier.tsx (2)

37-37: New component IssueTypeIdentifier needs implementation

The IssueTypeIdentifier component is correctly defined, but it currently renders an empty fragment. If this is intentional and the implementation is planned for the future, consider adding a TODO comment to clarify the intent and track the pending work.

Consider adding a TODO comment like this:

export const IssueTypeIdentifier: FC<TIssueTypeIdentifier> = observer((props) => {
  // TODO: Implement IssueTypeIdentifier component
  return <></>;
});

32-37: Consider documenting the feature implementation plan

The addition of TIssueTypeIdentifier type and IssueTypeIdentifier component suggests the beginning of a new feature related to issue type identification. To ensure smooth collaboration and feature tracking:

  1. Consider adding a comment explaining the purpose and planned usage of these new additions.
  2. If this is part of a larger feature, it might be helpful to create and link to a feature specification document or issue tracker item.

This documentation will help other developers understand the context and future plans for these components.

web/core/components/issues/workspace-draft/draft-issue-block.tsx (1)

54-54: LGTM: New issue type identifier added correctly

The IssueTypeIdentifier component is correctly implemented with proper conditional rendering. This enhances the component by displaying the issue type when available.

For consistency with the surrounding code, consider wrapping the new component in a div with the same classes as the IdentifierText component:

-{issue?.type_id && <IssueTypeIdentifier issueTypeId={issue.type_id} />}
+{issue?.type_id && (
+  <div className="text-xs font-medium text-custom-text-300">
+    <IssueTypeIdentifier issueTypeId={issue.type_id} />
+  </div>
+)}

This will ensure consistent styling and layout with the project identifier.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 5e43e9c and 671ddbe.

📒 Files selected for processing (3)
  • packages/types/src/workspace-draft-issues/base.d.ts (1 hunks)
  • web/ce/components/issues/issue-details/issue-identifier.tsx (2 hunks)
  • web/core/components/issues/workspace-draft/draft-issue-block.tsx (2 hunks)
🧰 Additional context used
🔇 Additional comments (4)
packages/types/src/workspace-draft-issues/base.d.ts (1)

30-30: LGTM! Consider verifying the impact of this change.

The addition of the type_id property to the TWorkspaceDraftIssue type is appropriate and consistent with the existing structure. This change suggests that workspace draft issues now have a type classification, which could enhance the functionality and organization of draft issues.

To ensure this change doesn't introduce any unintended consequences, please run the following script to check for any usage of TWorkspaceDraftIssue that might need updating:

This script will help identify areas of the codebase that might need to be updated to accommodate the new type_id property.

✅ Verification successful

Verified: type_id Addition Confirmed Safe

The addition of the type_id property to the TWorkspaceDraftIssue type has been successfully verified. The property is consistently integrated across all usages in the codebase without introducing any conflicts or issues.

  • type_id: string; is appropriately added and aligns with existing type structures.
  • No existing implementations are adversely affected by this change.
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for usage of TWorkspaceDraftIssue type in the codebase

# Search for files that import or use TWorkspaceDraftIssue
rg --type typescript --type tsx "TWorkspaceDraftIssue" -l | xargs -I {} rg --type typescript --type tsx "TWorkspaceDraftIssue" -C 5 {}

# Search for any direct usage of the type (e.g., in variable declarations)
rg --type typescript --type tsx ": TWorkspaceDraftIssue" -C 5

# Search for any spread operations on TWorkspaceDraftIssue objects
rg --type typescript --type tsx "\.\.\.(\w+: TWorkspaceDraftIssue)" -C 5

Length of output: 380


Script:

#!/bin/bash
# Description: Check for usage of TWorkspaceDraftIssue type in the codebase

# Search for files that import or use TWorkspaceDraftIssue
rg --type ts --type tsx "TWorkspaceDraftIssue" -l | xargs -I {} rg --type ts --type tsx "TWorkspaceDraftIssue" -C 5 {}

# Search for any direct usage of the type (e.g., in variable declarations)
rg --type ts --type tsx ": TWorkspaceDraftIssue" -C 5

# Search for any spread operations on TWorkspaceDraftIssue objects
rg --type ts --type tsx "\.\.\.(\w+: TWorkspaceDraftIssue)" -C 5

Length of output: 327


Script:

#!/bin/bash
# Description: Check for usage of TWorkspaceDraftIssue type in the codebase using glob patterns

# Search for files that import or use TWorkspaceDraftIssue
rg "TWorkspaceDraftIssue" --glob "*.ts" --glob "*.tsx" -l | xargs -I {} rg "TWorkspaceDraftIssue" --glob "*.ts" --glob "*.tsx" -C 5 {}

# Search for any direct usage of the type (e.g., in variable declarations)
rg ": TWorkspaceDraftIssue" --glob "*.ts" --glob "*.tsx" -C 5

# Search for any spread operations on TWorkspaceDraftIssue objects
rg "\.\.\.(\w+: TWorkspaceDraftIssue)" --glob "*.ts" --glob "*.tsx" -C 5

Length of output: 20354

web/ce/components/issues/issue-details/issue-identifier.tsx (1)

32-35: LGTM: New type TIssueTypeIdentifier is well-defined

The new type TIssueTypeIdentifier is correctly defined with appropriate properties. It maintains consistency with existing size-related properties in the file.

web/core/components/issues/workspace-draft/draft-issue-block.tsx (2)

11-11: LGTM: New import added correctly

The new import for IssueTypeIdentifier is correctly placed and follows the established naming conventions. This import aligns with the new functionality added to the component.


Line range hint 1-138: Summary: Successful integration of IssueTypeIdentifier

The changes in this file effectively integrate the IssueTypeIdentifier component into the DraftIssueBlock. This addition enhances the component by displaying the issue type alongside the project identifier when available.

The implementation is clean, follows existing patterns, and doesn't introduce any breaking changes. It improves the information density of the component without compromising its structure or performance.

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.

4 participants