From 755a89031f6ce48fe7c97659b3d0e9c07df2596f Mon Sep 17 00:00:00 2001 From: Amar Trebinjac Date: Thu, 20 Nov 2025 19:49:03 +0100 Subject: [PATCH 1/3] refactor: revert to old top readers logic --- .../profile/components/ProfileWidgets/BadgesAndAwards.tsx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/packages/shared/src/features/profile/components/ProfileWidgets/BadgesAndAwards.tsx b/packages/shared/src/features/profile/components/ProfileWidgets/BadgesAndAwards.tsx index a058b2248d..8daf0a504e 100644 --- a/packages/shared/src/features/profile/components/ProfileWidgets/BadgesAndAwards.tsx +++ b/packages/shared/src/features/profile/components/ProfileWidgets/BadgesAndAwards.tsx @@ -58,9 +58,6 @@ export const BadgesAndAwards = ({ return null; } - const totalTopReaderBadges = - topReaders?.reduce((sum, topReader) => sum + (topReader?.total || 0), 0) ?? - 0; const totalAwards = awards?.reduce((sum, award) => sum + (award?.count || 0), 0) ?? 0; @@ -86,7 +83,7 @@ export const BadgesAndAwards = ({
From 7f6090658de9c653802d26e4689efa4590cc965e Mon Sep 17 00:00:00 2001 From: Amar Trebinjac Date: Thu, 20 Nov 2025 19:56:51 +0100 Subject: [PATCH 2/3] add missing null check --- .../profile/components/ProfileWidgets/BadgesAndAwards.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/shared/src/features/profile/components/ProfileWidgets/BadgesAndAwards.tsx b/packages/shared/src/features/profile/components/ProfileWidgets/BadgesAndAwards.tsx index 8daf0a504e..c6964ca50c 100644 --- a/packages/shared/src/features/profile/components/ProfileWidgets/BadgesAndAwards.tsx +++ b/packages/shared/src/features/profile/components/ProfileWidgets/BadgesAndAwards.tsx @@ -83,7 +83,7 @@ export const BadgesAndAwards = ({
From 93ab7ff1569afeeea519a702eba07ee11932dc87 Mon Sep 17 00:00:00 2001 From: Amar Trebinjac Date: Thu, 20 Nov 2025 20:03:19 +0100 Subject: [PATCH 3/3] update tests --- .../components/ProfileWidgets/BadgesAndAwards.spec.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/shared/src/features/profile/components/ProfileWidgets/BadgesAndAwards.spec.tsx b/packages/shared/src/features/profile/components/ProfileWidgets/BadgesAndAwards.spec.tsx index c3e207abed..1e3d509619 100644 --- a/packages/shared/src/features/profile/components/ProfileWidgets/BadgesAndAwards.spec.tsx +++ b/packages/shared/src/features/profile/components/ProfileWidgets/BadgesAndAwards.spec.tsx @@ -193,7 +193,7 @@ describe('BadgesAndAwards component', () => { }); // Check summary cards - expect(screen.getByText('x8')).toBeInTheDocument(); // Total badges: 5 + 3 + expect(screen.getByText('x5')).toBeInTheDocument(); expect(screen.getByText('Top reader badge')).toBeInTheDocument(); // Check badge items @@ -245,7 +245,7 @@ describe('BadgesAndAwards component', () => { renderComponent(); expect(screen.getByText('Badges & Awards')).toBeInTheDocument(); - expect(screen.getByText('x8')).toBeInTheDocument(); // Total badges + expect(screen.getByText('x5')).toBeInTheDocument(); expect(screen.getByText('x0')).toBeInTheDocument(); // No awards expect(screen.queryByAltText('Award')).not.toBeInTheDocument(); });