Add filtering by stars and last-activity (UI + sorting)#2746
Open
DhruvGupta6177 wants to merge 1 commit into
Open
Add filtering by stars and last-activity (UI + sorting)#2746DhruvGupta6177 wants to merge 1 commit into
DhruvGupta6177 wants to merge 1 commit into
Conversation
This PR adds UI controls and logic allowing users to filter repositories by minimum stars and recent activity (months) on both the index and language pages. Summary of changes: - Added Min Stars and Active Within sliders to `pages/index.vue` and `pages/language/[slug].vue`. - Implemented reactive filtering (`filteredRepositories`) and sorting by stars and/or last activity. - Added `formatStars()` helper and a Reset button. - Fixed a small typo in `pages/index.vue`. How to test: 1. Run `npm install` and `npm run dev`. 2. Open `/` and `/language/<slug>`. 3. Adjust sliders to verify filtering and sorting work in real time. This PR targets `master`.
|
@DhruvGupta6177 is attempting to deploy a commit to the DeepSource Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds client-side filtering + sorting controls to repository listing pages so users can narrow results by minimum star count and recent activity.
Changes:
- Add “Min stars” and “Active within” range filters + reset button to the index page and per-language page.
- Compute
filteredRepositoriesbased on selected thresholds and apply sorting for stars / recency. - Add helper formatting for star counts (e.g., K suffix).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| pages/language/[slug].vue | Adds UI controls and computed filtering/sorting for language-scoped repos. |
| pages/index.vue | Adds the same UI controls and computed filtering/sorting for the full repo list. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+56
to
+65
| let repos = allRepos.filter(r => { | ||
| if (minStars.value && Number(r.stars) < Number(minStars.value)) return false | ||
| if (activeWithinMonths.value) { | ||
| const months = Number(activeWithinMonths.value) | ||
| const last = dayjs(r.last_modified) | ||
| if (!last.isValid()) return false | ||
| if (now.diff(last, 'month') > months) return false | ||
| } | ||
| return true | ||
| }) |
Comment on lines
+70
to
+82
| const filteredRepositories = computed(() => { | ||
| const now = dayjs() | ||
|
|
||
| let repos = allRepos.filter(r => { | ||
| if (minStars.value && Number(r.stars) < Number(minStars.value)) return false | ||
| if (activeWithinMonths.value) { | ||
| const months = Number(activeWithinMonths.value) | ||
| const last = dayjs(r.last_modified) | ||
| if (!last.isValid()) return false | ||
| if (now.diff(last, 'month') > months) return false | ||
| } | ||
| return true | ||
| }) |
Comment on lines
+84
to
+90
| // Sorting: prioritize active filter (recent), then stars. If both present, sort by stars desc then last_modified desc | ||
| if (minStars.value && activeWithinMonths.value) { | ||
| repos.sort((a, b) => { | ||
| if (b.stars !== a.stars) return b.stars - a.stars | ||
| return new Date(b.last_modified) - new Date(a.last_modified) | ||
| }) | ||
| } else if (minStars.value) { |
Comment on lines
+5
to
+6
| <label class="text-sm text-vanilla-400">Min stars:</label> | ||
| <input type="range" min="0" max="50000" step="10" v-model.number="minStars" class="w-64" /> |
Comment on lines
+11
to
+12
| <label class="text-sm text-vanilla-400">Active within:</label> | ||
| <input type="range" min="0" max="24" step="1" v-model.number="activeWithinMonths" class="w-64" /> |
Comment on lines
+45
to
+56
| const minStars = ref(0) | ||
| const activeWithinMonths = ref(0) | ||
|
|
||
| function resetFilters() { | ||
| minStars.value = 0 | ||
| activeWithinMonths.value = 0 | ||
| } | ||
|
|
||
| const filteredRepositories = computed(() => { | ||
| const now = dayjs() | ||
|
|
||
| let repos = allRepos.filter(r => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds UI controls and logic allowing users to filter repositories by minimum stars and recent activity (months) on both the index and language pages.
Summary of changes:
pages/index.vueandpages/language/[slug].vue.filteredRepositories) and sorting by stars and/or last activity.formatStars()helper and a Reset button.pages/index.vue.How to test:
npm installandnpm run dev./and/language/<slug>.This PR targets
master.