Only show visited repos and hide at all if less than 4 repos (#4753)

This commit is contained in:
qwerty287 2025-01-20 17:23:52 +02:00 committed by GitHub
parent 62e7e0d73a
commit 089f7f4c47
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 6 deletions

View file

@ -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 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;
});
return bLastAccess - aLastAccess;
});
}
function sortReposByLastActivity(repos: Repo[]): Repo[] {

View file

@ -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>