Skip to content

Commit

Permalink
Only show visited repos and hide at all if less than 4 repos (woodpec…
Browse files Browse the repository at this point in the history
  • Loading branch information
qwerty287 authored Jan 20, 2025
1 parent 62e7e0d commit 089f7f4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
14 changes: 8 additions & 6 deletions web/src/compositions/useRepos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,14 @@ export default function useRepos() {
}

function sortReposByLastAccess(repos: Repo[]): Repo[] {
return repos.sort((a, b) => {
const aLastAccess = lastAccess.value.get(a.id) ?? 0;
const bLastAccess = lastAccess.value.get(b.id) ?? 0;

return bLastAccess - aLastAccess;
});
return repos
.filter((r) => lastAccess.value.get(r.id) !== undefined)
.sort((a, b) => {
const aLastAccess = lastAccess.value.get(a.id)!;
const bLastAccess = lastAccess.value.get(b.id)!;

return bLastAccess - aLastAccess;
});
}

function sortReposByLastActivity(repos: Repo[]): Repo[] {
Expand Down
5 changes: 4 additions & 1 deletion web/src/views/Repos.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

<Transition name="fade" mode="out-in">
<div v-if="search === '' && repos.length > 0" class="grid gap-8">
<div v-if="reposLastAccess.length > 0" class="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-2">
<div
v-if="reposLastAccess.length > 0 && repos.length > 4"
class="grid grid-cols-1 gap-4 md:grid-cols-2 lg:grid-cols-2"
>
<RepoItem v-for="repo in reposLastAccess" :key="repo.id" :repo="repo" />
</div>

Expand Down

0 comments on commit 089f7f4

Please sign in to comment.