mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-03-14 00:12:42 +00:00
Only show visited repos and hide at all if less than 4 repos (#4753)
This commit is contained in:
parent
62e7e0d73a
commit
089f7f4c47
2 changed files with 11 additions and 6 deletions
|
@ -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[] {
|
||||
|
|
|
@ -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>
|
||||
|
||||
|
|
Loading…
Reference in a new issue