-
Notifications
You must be signed in to change notification settings - Fork 26
hide bounties from docs sidebar #1544
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe Sidebar's Changes
Sequence Diagram(s)sequenceDiagram
participant Sidebar
participant sortTree
participant Sorter
Note over sortTree,Sorter #D6EAF8: New step: filter out "bounties"
Sidebar->>sortTree: provide raw tree
sortTree-->>sortTree: filter nodes where name == "bounties" (removed)
sortTree->>Sorter: pass filtered tree
Sorter->>Sorter: apply files-before-folders + canonical ordering
Sorter-->>Sidebar: return sorted tree (no bounties)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
Deploying chat with
|
| Latest commit: |
d4fbee3
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://022c7b7b.chat-46r.pages.dev |
| Branch Preview URL: | https://fix-docs-bounties.chat-46r.pages.dev |
There was a problem hiding this 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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
docs/view/src/components/ui/Sidebar.astro(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
docs/**
📄 CodeRabbit inference engine (AGENTS.md)
Store long-form documentation under docs/
Files:
docs/view/src/components/ui/Sidebar.astro
| const sorted = nodes | ||
| .filter((node) => node.name !== "bounties") | ||
| .sort((a, b) => { | ||
| // First sort by type: files before folders | ||
| if (a.type !== b.type) { | ||
| return a.type === "file" ? -1 : 1; | ||
| } | ||
| // For files only - custom ordering | ||
| if (a.type === "file" && b.type === "file") { | ||
| // Force introduction to be first regardless of filename | ||
| if (a.name.includes("introduction")) return -1; | ||
| if (b.name.includes("introduction")) return 1; | ||
| // For files only - custom ordering | ||
| if (a.type === "file" && b.type === "file") { | ||
| // Force introduction to be first regardless of filename | ||
| if (a.name.includes("introduction")) return -1; | ||
| if (b.name.includes("introduction")) return 1; | ||
| // Then getting-started | ||
| if (a.name.includes("getting-started")) return -1; | ||
| if (b.name.includes("getting-started")) return 1; | ||
| // Then getting-started | ||
| if (a.name.includes("getting-started")) return -1; | ||
| if (b.name.includes("getting-started")) return 1; | ||
| // Then project-structure | ||
| if (a.name.includes("project-structure")) return -1; | ||
| if (b.name.includes("project-structure")) return 1; | ||
| // Then project-structure | ||
| if (a.name.includes("project-structure")) return -1; | ||
| if (b.name.includes("project-structure")) return 1; | ||
| // Then cli-reference | ||
| if (a.name.includes("cli-reference")) return -1; | ||
| if (b.name.includes("cli-reference")) return 1; | ||
| // Then cli-reference | ||
| if (a.name.includes("cli-reference")) return -1; | ||
| if (b.name.includes("cli-reference")) return 1; | ||
| // Then bounties (last) | ||
| if (a.name.includes("bounties")) return -1; | ||
| if (b.name.includes("bounties")) return 1; | ||
| } | ||
| // Then bounties (last) | ||
| if (a.name.includes("bounties")) return -1; | ||
| if (b.name.includes("bounties")) return 1; | ||
| } | ||
| // Default alphabetical | ||
| return a.name.localeCompare(b.name); | ||
| }); | ||
| // Default alphabetical | ||
| return a.name.localeCompare(b.name); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion | 🟠 Major
Remove dead code on lines 79-81.
The filtering approach on line 54 correctly removes bounties from the sidebar. However, lines 79-81 contain sorting logic for bounties that will never execute since all "bounties" nodes are already filtered out before sorting begins.
Apply this diff to remove the dead code:
// Then cli-reference
if (a.name.includes("cli-reference")) return -1;
if (b.name.includes("cli-reference")) return 1;
-
- // Then bounties (last)
- if (a.name.includes("bounties")) return -1;
- if (b.name.includes("bounties")) return 1;
}
// Default alphabetical📝 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.
| const sorted = nodes | |
| .filter((node) => node.name !== "bounties") | |
| .sort((a, b) => { | |
| // First sort by type: files before folders | |
| if (a.type !== b.type) { | |
| return a.type === "file" ? -1 : 1; | |
| } | |
| // For files only - custom ordering | |
| if (a.type === "file" && b.type === "file") { | |
| // Force introduction to be first regardless of filename | |
| if (a.name.includes("introduction")) return -1; | |
| if (b.name.includes("introduction")) return 1; | |
| // For files only - custom ordering | |
| if (a.type === "file" && b.type === "file") { | |
| // Force introduction to be first regardless of filename | |
| if (a.name.includes("introduction")) return -1; | |
| if (b.name.includes("introduction")) return 1; | |
| // Then getting-started | |
| if (a.name.includes("getting-started")) return -1; | |
| if (b.name.includes("getting-started")) return 1; | |
| // Then getting-started | |
| if (a.name.includes("getting-started")) return -1; | |
| if (b.name.includes("getting-started")) return 1; | |
| // Then project-structure | |
| if (a.name.includes("project-structure")) return -1; | |
| if (b.name.includes("project-structure")) return 1; | |
| // Then project-structure | |
| if (a.name.includes("project-structure")) return -1; | |
| if (b.name.includes("project-structure")) return 1; | |
| // Then cli-reference | |
| if (a.name.includes("cli-reference")) return -1; | |
| if (b.name.includes("cli-reference")) return 1; | |
| // Then cli-reference | |
| if (a.name.includes("cli-reference")) return -1; | |
| if (b.name.includes("cli-reference")) return 1; | |
| // Then bounties (last) | |
| if (a.name.includes("bounties")) return -1; | |
| if (b.name.includes("bounties")) return 1; | |
| } | |
| // Then bounties (last) | |
| if (a.name.includes("bounties")) return -1; | |
| if (b.name.includes("bounties")) return 1; | |
| } | |
| // Default alphabetical | |
| return a.name.localeCompare(b.name); | |
| }); | |
| // Default alphabetical | |
| return a.name.localeCompare(b.name); | |
| }); | |
| const sorted = nodes | |
| .filter((node) => node.name !== "bounties") | |
| .sort((a, b) => { | |
| // First sort by type: files before folders | |
| if (a.type !== b.type) { | |
| return a.type === "file" ? -1 : 1; | |
| } | |
| // For files only - custom ordering | |
| if (a.type === "file" && b.type === "file") { | |
| // Force introduction to be first regardless of filename | |
| if (a.name.includes("introduction")) return -1; | |
| if (b.name.includes("introduction")) return 1; | |
| // Then getting-started | |
| if (a.name.includes("getting-started")) return -1; | |
| if (b.name.includes("getting-started")) return 1; | |
| // Then project-structure | |
| if (a.name.includes("project-structure")) return -1; | |
| if (b.name.includes("project-structure")) return 1; | |
| // Then cli-reference | |
| if (a.name.includes("cli-reference")) return -1; | |
| if (b.name.includes("cli-reference")) return 1; | |
| } | |
| // Default alphabetical | |
| return a.name.localeCompare(b.name); | |
| }); |
🤖 Prompt for AI Agents
In docs/view/src/components/ui/Sidebar.astro around lines 53 to 86, the sorting
block includes an unreachable check for "bounties" at lines 79-81 because nodes
with name "bounties" are filtered out earlier; remove the two lines that test
for a.name.includes("bounties") and b.name.includes("bounties") (the "Then
bounties (last)" branch) so the custom file-ordering logic no longer contains
dead code and the default alphabetical fallback remains intact.
|
@aka-sacci-ccr wanna merge? |
What is this contribution about?
Screenshots/Demonstration
Review Checklist
Summary by CodeRabbit