From f737275d234ad714d684d21aa4d3f78e10709875 Mon Sep 17 00:00:00 2001 From: jikrana Date: Sun, 30 Aug 2026 08:52:31 +0530 Subject: [PATCH] fix: show empty state when filters match zero repositories --- src/pages/RepositoriesPage.jsx | 139 ++++++++++++++++++--------------- 1 file changed, 74 insertions(+), 65 deletions(-) diff --git a/src/pages/RepositoriesPage.jsx b/src/pages/RepositoriesPage.jsx index f5884f4..9fbbd81 100644 --- a/src/pages/RepositoriesPage.jsx +++ b/src/pages/RepositoriesPage.jsx @@ -54,7 +54,7 @@ export default function RepositoriesPage() { const { sorted, sortConfig, onSort } = useSortedData(filtered, 'healthScore', 'desc') const visible = sorted.slice(0, shown) - if(loading) return + if (loading) return if (!model) return null const TABLE_COLS = [ @@ -66,6 +66,8 @@ export default function RepositoriesPage() { ['pushed_at', 'Repository Activity'], ] + const showNoSearchResults = search.trim() && filtered.length === 0 + return (
- {allRepos?.length ? ( - <> - {/* Table view */} -
- - - - {TABLE_COLS.map(([k, l]) => ( - - ))} - - - - {visible.map((r, i) => ( - - - - - - - - + + {!allRepos?.length && ( +
+ } + title="No repositories available" + description="We couldn't find any repositories for this organization yet." + buttonText="Go to Home" + onButtonClick={() => navigate('/')} + /> +
+ )} + + {allRepos?.length > 0 && showNoSearchResults && ( +
+ } + title="No matching repositories" + description="No repositories match your search. Try a different search term." + buttonText="Clear Search" + onButtonClick={() => setSearch('')} + /> +
+ )} + + {allRepos?.length > 0 && !showNoSearchResults && ( +
+
- -
{r.name}
- {r.orgLogin &&
{r.orgLogin}
} -
-
{r.stargazers_count.toLocaleString()}{r.forks_count.toLocaleString()} 30 ? 'var(--red)' : 'var(--text2)' }}>{r.open_issues_count} -
- - Last push: {r.pushed_at?.slice(0, 10)} - -
-
+ + + {TABLE_COLS.map(([k, l]) => ( + ))} - -
- setShown(s => s + 20)} /> -
- ) - : ( -
- } - title="No repositories available" - description="We couldn't find any repositories for this organization yet." - buttonText="Go to Home" - onButtonClick={() => navigate('/')} - /> -
- )} - + + + + {visible.map((r, i) => ( + + + +
{r.name}
+ {r.orgLogin &&
{r.orgLogin}
} +
+ + {r.stargazers_count.toLocaleString()} + {r.forks_count.toLocaleString()} + 30 ? 'var(--red)' : 'var(--text2)' }}>{r.open_issues_count} + + +
+ + Last push: {r.pushed_at?.slice(0, 10)} + +
+ + + ))} + + + setShown(s => s + 20)} /> + ) } + + ) +} \ No newline at end of file