Skip to content

Commit 0c14040

Browse files
committed
Display archived groups when no active groups exist
1 parent f4cfe9d commit 0c14040

File tree

4 files changed

+296
-1
lines changed

4 files changed

+296
-1
lines changed

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@
8080
"devDependencies": {
8181
"@faker-js/faker": "10.1.0",
8282
"@tailwindcss/postcss": "^4.1.10",
83+
"@testing-library/jest-dom": "^6.9.1",
84+
"@testing-library/react": "^16.3.2",
8385
"@types/formidable": "^3.4.6",
8486
"@types/jest": "^29.5.14",
8587
"@types/node": "^22.15.21",

pnpm-lock.yaml

Lines changed: 153 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/pages/groups.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ function transformBalances(balances: Record<string, bigint>) {
2323
.map(([currency, amount]) => ({ currency, amount }));
2424
}
2525

26+
export const hasGroups = (groups: { data?: unknown[] | undefined }[]): boolean =>
27+
groups.some((x) => 0 !== (x.data?.length ?? 0));
28+
2629
const BalancePage: NextPageWithUser = () => {
2730
const { t } = useTranslation();
2831
const groupQuery = api.group.getAllGroupsWithBalances.useQuery();
@@ -44,7 +47,7 @@ const BalancePage: NextPageWithUser = () => {
4447
</Head>
4548
<MainLayout title={t('navigation.groups')} actions={actions} loading={groupQuery.isPending}>
4649
<div className="mt-7 flex flex-col gap-8 pb-36">
47-
{0 === groupQuery.data?.length ? (
50+
{!hasGroups([groupQuery, archivedGroupQuery]) ? (
4851
<div className="mt-[30vh] flex flex-col items-center justify-center gap-20">
4952
<CreateGroup>
5053
<Button>

0 commit comments

Comments
 (0)