Skip to content

Commit b8e900f

Browse files
committed
feat(repositories): add open_issues_count sort
1 parent ec7befc commit b8e900f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/pages/repositories.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
<button class="icon" type="button" title="sort by forks" @click="sort('forks')">
1414
<icon-git-fork />
1515
</button>
16+
<button class="icon" type="button" title="sort by issues" @click="sort('issues')">
17+
<icon-circle-dot />
18+
</button>
1619
<button class="icon" type="button" title="sort by language" @click="sort('language')">
1720
<icon-packages />
1821
</button>
@@ -33,7 +36,7 @@
3336
import { computed, ref, useTemplateRef } from "vue";
3437
import { refDebounced } from "@vueuse/core";
3538
import { useSortable } from "@vueuse/integrations/useSortable";
36-
import { IconGitFork, IconPackages, IconSortAZ, IconStar } from "@tabler/icons-vue";
39+
import { IconCircleDot, IconGitFork, IconPackages, IconSortAZ, IconStar } from "@tabler/icons-vue";
3740
import { useRepositoriesStore } from "@/store/repositories";
3841
import { useSettingsStore } from "@/store/settings";
3942
import RepoItem from "@/components/repo-item.vue";
@@ -54,12 +57,14 @@ const filteredItems = computed(() => {
5457
const reposRef = useTemplateRef("reposElement");
5558
useSortable(reposRef, repositories, { handle: ".repo__header-actions-handler" });
5659
57-
function sort(option: "alphabetic" | "stars" | "forks" | "language"): void {
60+
type SortOption = "alphabetic" | "stars" | "forks" | "issues" | "language";
61+
function sort(option: SortOption): void {
5862
repositories.value.sort((a, b) => {
5963
switch (option) {
6064
case "alphabetic": return a.name.localeCompare(b.name);
6165
case "stars": return b.stargazers_count - a.stargazers_count;
6266
case "forks": return b.forks_count - a.forks_count;
67+
case "issues": return b.open_issues_count - a.open_issues_count;
6368
case "language":
6469
return (a.language && b.language) ?
6570
a.language.localeCompare(b.language) :

0 commit comments

Comments
 (0)