Here are some ideas for adding a 'random PR' mode to your existing 'random issue' functionality:
- Add a toggle switch between "Issues" and "PRs" next to the fetch button
- Update the UI to show current mode
- Modify
getRandomIssue()to filter based on the selected mode
- Add a separate "Random PR" button
- Share most of the existing logic but filter for PRs instead of issues
- Support
?type=pror?type=issuein the URL - Good for sharing direct links to either mode
- Keep the current button but add a modifier key (e.g., Shift+Click) for PR mode
- Add mode indicator/selector
- Update status fields to show PR-specific counts
- Consider different styling for PRs vs issues in the output
- Current filter:
!issue.pull_request && issue.state === 'open' - For PRs:
!!issue.pull_request && issue.state === 'open'
- Track current mode in a variable
- Update URL when mode changes (if using URL parameters)
- Save mode preference in localStorage
- The GitHub API already includes PRs in the issues endpoint
- No additional API calls needed, just different filtering