fix: sidebar new issue button paper cuts#5863
fix: sidebar new issue button paper cuts#5863kidonng wants to merge 1 commit intomakeplane:previewfrom kidonng:fix/sidebar-new-issue
Conversation
WalkthroughThe changes in this pull request modify the Changes
Possibly related PRs
Suggested labels
Suggested reviewers
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? 🪧 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
🧹 Outside diff range and nitpick comments (3)
web/core/components/workspace/sidebar/quick-actions.tsx (3)
86-93: Improved click handler implementation. Consider adding a comment for clarity.The new click handler for the "New issue" button is well-implemented. It correctly checks the
disabledstate before proceeding, which prevents unintended actions when the button should be inactive. The use ofsetTrackElementfor analytics andtoggleCreateIssueModalto open the modal are appropriate.Consider adding a brief comment explaining the purpose of the
disabledcheck, especially since the button's visual state is controlled separately. This could improve code readability:onClick={() => { if (disabled) { + // Prevent action if user doesn't have permission or no projects are available return; } setTrackElement("APP_SIDEBAR_QUICK_ACTIONS"); toggleCreateIssueModal(true); }}
Line range hint
1-150: Consider cleaning up unused variables and functionsNow that the draft issue functionality has been removed, there are some unused variables and functions that could be cleaned up to improve code maintainability:
Consider removing or commenting out the following unused elements:
isDraftIssueModalOpenstate and its setterCreateUpdateIssueModalcomponent (if it's not used elsewhere in this file)removeWorkspaceDraftIssuefunctionworkspaceDraftIssuevariable- Any unused imports related to these removed elements
Here's a partial example of the cleanup:
- const [isDraftIssueModalOpen, setIsDraftIssueModalOpen] = useState(false); - const workspaceDraftIssue = workspaceSlug ? (storedValue?.[workspaceSlug] ?? undefined) : undefined; - const removeWorkspaceDraftIssue = () => { - const draftIssues = storedValue ?? {}; - if (workspaceSlug && draftIssues[workspaceSlug]) delete draftIssues[workspaceSlug]; - setValue(draftIssues); - return Promise.resolve(); - }; return ( <> - <CreateUpdateIssueModal - isOpen={isDraftIssueModalOpen} - onClose={() => setIsDraftIssueModalOpen(false)} - data={workspaceDraftIssue ?? {}} - onSubmit={() => removeWorkspaceDraftIssue()} - isDraft - /> <div className={cn("flex items-center justify-between gap-1 cursor-pointer", { "flex-col gap-0": isSidebarCollapsed, })} > {/* ... rest of the component ... */} </div> </> );After making these changes, be sure to remove any unused imports at the top of the file.
Remaining references to draft issues detected in the codebase.
Multiple instances of
draftIssuesare still present, suggesting that draft issue functionality is active. Please verify whether the removal of the commented-out code impacts these areas or if additional cleanup is necessary.
web/core/store/issue/helpers/base-issues.store.tsweb/core/store/issue/root.store.tsweb/core/store/issue/draft/issue.store.tsweb/core/components/issues/issue-modal/base.tsxweb/core/components/workspace/sidebar/quick-actions.tsxweb/core/components/workspace/sidebar/user-menu.tsxweb/core/hooks/use-issues-actions.tsxweb/core/hooks/store/use-issues.tsweb/core/constants/empty-state.tsweb/app/[workspaceSlug]/(projects)/drafts/header.tsx🔗 Analysis chain
Line range hint
1-150: Approval for removing commented-out code. Verify if functionality is needed elsewhere.The removal of the large block of commented-out code related to draft issues is a good practice. It improves code readability and maintainability by eliminating unused code.
Please confirm that the draft issue functionality has been intentionally removed or relocated. If it's still needed, ensure it's implemented elsewhere in the codebase.
To verify this, you can run the following command to search for any remaining references to draft issues:
If the functionality is indeed no longer needed, consider removing any related unused imports, state variables, or functions (e.g.,
removeWorkspaceDraftIssue) to keep the code clean and efficient.🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for references to draft issues in the codebase rg --type typescript --type tsx 'draftIssue|draft issue|lastDraftedIssue'Length of output: 110
Script:
#!/bin/bash # Search for references to draft issues in .ts and .tsx files rg 'draftIssue|draft issue|lastDraftedIssue' --glob '**/*.ts' --glob '**/*.tsx'Length of output: 3797
|
Hello @kidonng , thats a poor UX. Thanks for pointing it out, and raising the PR. |
|
This is handled in this PR. Thanks for reporting it, and taking time to submit a PR. |
The "New issue" button in the sidebar is deceptively larger than its actually clickable area:
I have encountered this paper cut bug several times, hence this proposed fix.
CleanShot.2024-10-18.at.11.45.08.mp4
Summary by CodeRabbit
New Features
Bug Fixes
Chores