diff --git a/packages/shared/src/features/giveback/components/GivebackContributionSummary.tsx b/packages/shared/src/features/giveback/components/GivebackContributionSummary.tsx index ef7103fa074..85db304a66c 100644 --- a/packages/shared/src/features/giveback/components/GivebackContributionSummary.tsx +++ b/packages/shared/src/features/giveback/components/GivebackContributionSummary.tsx @@ -7,7 +7,7 @@ import { TypographyTag, TypographyType, } from '../../../components/typography/Typography'; -import { GiftIcon, InfoIcon } from '../../../components/icons'; +import { InfoIcon } from '../../../components/icons'; import { IconSize } from '../../../components/Icon'; import { ProfilePicture, @@ -18,16 +18,15 @@ import { useGivebackContribution } from '../hooks/useGivebackContribution'; import { useContributionActions } from '../hooks/useContributionActions'; import { formatDonationAmount } from '../utils'; -// Personal recap shown above the action catalog: how much the visitor has -// unlocked for their causes and the next reward they're working toward. No -// rank, level or leaderboard — the campaign starts from scratch, so this stays -// a purely personal progress cue. +// Personal stat card above the action catalog. A rounded-square avatar (matching +// daily.dev's app tiles) carries identity with a small level badge tucked in its +// corner; the money you've unlocked is the hero number beside it. Clean and +// concrete, no floating ring, no game-y framing. export const GivebackContributionSummary = (): ReactElement => { const { user } = useAuthContext(); - const { earnedPoints, nextReward, pointsToNext, currentLevel, isPending } = + const { earnedPoints, currentLevel, isPending } = useGivebackContribution(true); - // Shares the catalog's query key, so this adds no extra request. Sums the - // visitor's completions across every action into one "actions taken" count. + // Shares the catalog's query key, so this adds no extra request. const { actions, isPending: isActionsPending } = useContributionActions(true); const actionsTaken = actions.reduce( (sum, action) => sum + action.userCompletions, @@ -35,118 +34,78 @@ export const GivebackContributionSummary = (): ReactElement => { ); if (isPending) { + // Matches the flat loaded layout (avatar + stat lines) so it doesn't flash + // from a card into a flat row when data lands. return ( - -
-
- + +
+ +
+
+ + ); } return ( - + {user && (
- + Lvl {currentLevel}
)} - - - Your contribution - - - - + {formatDonationAmount(earnedPoints)} + + + {!isActionsPending && ( + + - + + + + + It counts the moment you act. We trust you. If something gets + rejected, we just subtract it. + + - - - - - {formatDonationAmount(earnedPoints)} - - - unlocked for your causes - - - {!isActionsPending && ( - - {actionsTaken} {actionsTaken === 1 ? 'action' : 'actions'} taken - +
)} - - {nextReward && ( - - - Next reward - - - - - {nextReward.title} - - - - {formatDonationAmount(pointsToNext)} to go - - - )}
); };