From 089f7f4c479219f4a1434534f3fcdb66717f0c02 Mon Sep 17 00:00:00 2001 From: qwerty287 <80460567+qwerty287@users.noreply.github.com> Date: Mon, 20 Jan 2025 17:23:52 +0200 Subject: [PATCH] Only show visited repos and hide at all if less than 4 repos (#4753) --- web/src/compositions/useRepos.ts | 14 ++++++++------ web/src/views/Repos.vue | 5 ++++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/web/src/compositions/useRepos.ts b/web/src/compositions/useRepos.ts index d094a847b74..b341333481b 100644 --- a/web/src/compositions/useRepos.ts +++ b/web/src/compositions/useRepos.ts @@ -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[] { diff --git a/web/src/views/Repos.vue b/web/src/views/Repos.vue index dfa03c8001a..749e8d1cd5c 100644 --- a/web/src/views/Repos.vue +++ b/web/src/views/Repos.vue @@ -10,7 +10,10 @@
-
+