feat: add repository filter dropdown in RHS sidebar#1024
Conversation
- Add dropdown to filter PRs/reviews/assignments/unreads by repository - Extract unique repo names from displayed items - Reset filter when switching RHS tabs - Only show dropdown when multiple repos are present
|
Warning Review limit reached
More reviews will be available in 25 minutes and 18 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ 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 |
|
This PR has been automatically labelled "stale" because it hasn't had recent activity. |
| } | ||
|
|
||
| // Extract unique repo names for filter dropdown | ||
| const repoNames = [...new Set( |
There was a problem hiding this comment.
The repo-name extraction logic is duplicated. Please factor it into a small helper at module scope so both call sites stay in sync if the GitHub response shape ever changes.
function getRepoName(item) {
if (item.repository_url) {
return item.repository_url.replace(/.+\/repos\//, '');
}
return item.repository?.full_name ?? null;
}
| >{title}</a> | ||
| </strong> | ||
| {repoNames.length > 1 && ( | ||
| <select |
There was a problem hiding this comment.
This needs an aria-label='Filter by repository'. Also I worry that a native will look out of place next to Mattermost's styled UI. Other plugin dropdowns use react-select. Perhaps switch to that one ? Also since sectionHeader uses default inline layout, adding the next to a long title may wrap awkwardly on narrow RHS widths.
| sectionHeader: { | ||
| padding: '15px', | ||
| }, | ||
| repoFilter: { |
There was a problem hiding this comment.
Hard-coded border will be invisible on dark themes and the transparent background will inherit the dark RHS color leaving the option text unreadable. This plugin already has a convention for theme-aware styles via makeStyleFromTheme, see sidebar_buttons.jsx:
import {makeStyleFromTheme, changeOpacity} from 'mattermost-redux/utils/theme_utils';
// ... bottom of file, replacing the plain `style` object:
const getStyle = makeStyleFromTheme((theme) => ({
sectionHeader: {
padding: '15px',
},
repoFilter: {
marginLeft: '8px',
padding: '2px 4px',
fontSize: '12px',
borderRadius: '4px',
border: `1px solid ${changeOpacity(theme.centerChannelColor, 0.2)}`,
background: 'transparent',
color: theme.centerChannelColor,
},
}));
Summary
Adds a repository filter dropdown to the GitHub plugin RHS sidebar, allowing users to filter PRs, reviews, assignments, and unread notifications by specific repository.
Resolves #265
Changes
<select>dropdown in the RHS header that lists all unique repositories from the current itemsRelease Notes
Screenshots
The dropdown appears next to the title in the RHS header, styled minimally to match the existing UI.