mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-04-15 01:41:56 +00:00
Only show visited repos and hide at all if less than 4 repos (#4753)
This commit is contained in:
@@ -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>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user