Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions frontend/app/claim/[token]/claim-page-client.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import { useEffect, useState } from 'react';
import { ClaimStatusCard } from '@/components/claim-status-card';
import { AccountStatus } from '@/lib/api/types';
import { BridgeletClient, BridgeletApiError } from '@/lib/api/client';
import { ClaimView, loadClaimView, toStroops } from '@/lib/claim-view';
import { BridgeletClient } from '@/lib/api/client';
import { ClaimView, loadClaimView, markTokenClaimed } from '@/lib/claim-view';

interface ClaimPageClientProps {
token: string;
Expand Down Expand Up @@ -37,10 +37,17 @@ export function ClaimPageClient({ token, supportEmail, initialView }: ClaimPageC
if (!result.success) {
throw new Error(result.error ?? 'Claim could not be completed. Please try again.');
}
// #435: record this session as the one that claimed the token
markTokenClaimed(token);
setView((prev) => ({
...(prev ?? { status: AccountStatus.CLAIMED }),
status: result.isPartial ? AccountStatus.PARTIAL_SWEEP : AccountStatus.CLAIMED,
sweepNote: result.message,
// #435: we just claimed it in this session
claimedByMe: true,
// #433: destination and amount for success state
sweepDestination: destinationAddress,
sweepAmountStroops: prev?.amountStroops,
}));
}

Expand Down Expand Up @@ -75,6 +82,9 @@ export function ClaimPageClient({ token, supportEmail, initialView }: ClaimPageC
sweepNote={view.sweepNote}
supportEmail={supportEmail}
onClaim={handleClaim}
claimedByMe={view.claimedByMe}
sweepDestination={view.sweepDestination}
sweepAmountStroops={view.sweepAmountStroops}
/>
);
}
Loading