Skip to content

Create TipConfirmation component for success/error states #252

@davedumto

Description

@davedumto

Description

After a tip transaction is submitted, users need clear feedback about whether the transaction succeeded or failed. We need to create a TipConfirmation component that displays transaction results with appropriate actions.

Current State

  • TipModal component handles the transaction flow
  • No dedicated UI for showing transaction success/error states
  • Users need visual confirmation and next steps after tipping

What Needs to Happen

  1. Create a new TipConfirmation component at components/tipping/TipConfirmation.tsx
  2. Implement success state UI:
    • Success icon/animation (checkmark, confetti, etc.)
    • Success message ("Tip sent successfully!")
    • Amount sent display
    • Recipient username
    • Transaction hash with link to Stellar Explorer
    • "Send Another Tip" button
    • "Close" button
  3. Implement error state UI:
    • Error icon
    • Error message display (user-friendly error text)
    • Technical error details (collapsible/expandable)
    • "Try Again" button
    • "Close" button
  4. Handle different error types:
    • Wallet signature rejected
    • Insufficient balance
    • Network errors
    • Invalid transaction
    • Timeout errors
  5. Add transaction hash link generation:
    • Testnet: https://stellar.expert/explorer/testnet/tx/{hash}
    • Mainnet: https://stellar.expert/explorer/public/tx/{hash}
  6. Create TypeScript interfaces for props
  7. Add animations for state transitions

Code Structure

// components/tipping/TipConfirmation.tsx
import { getStellarExplorerUrl } from '@/lib/stellar/config';

interface TipConfirmationProps {
  state: 'success' | 'error';
  amount?: string;
  recipientUsername?: string;
  txHash?: string;
  error?: {
    message: string;
    details?: string;
    code?: string;
  };
  onClose: () => void;
  onRetry?: () => void;
  onSendAnother?: () => void;
}

export function TipConfirmation({
  state,
  amount,
  recipientUsername,
  txHash,
  error,
  onClose,
  onRetry,
  onSendAnother
}: TipConfirmationProps) {
  const explorerUrl = txHash ? getStellarExplorerUrl('tx', txHash) : null;

  if (state === 'success') {
    return (
      // Success UI with:
      // - Success icon/animation
      // - Amount and recipient
      // - Transaction hash link
      // - "Send Another Tip" and "Close" buttons
    );
  }

  return (
    // Error UI with:
    // - Error icon
    // - Error message
    // - Technical details (expandable)
    // - "Try Again" and "Close" buttons
  );
}

Files Affected

  • components/tipping/TipConfirmation.tsx (NEW)
  • components/tipping/index.ts (UPDATE) - Add export
  • lib/stellar/config.ts (UPDATE) - Add getStellarExplorerUrl() helper function

Acceptance Criteria

  • TipConfirmation component created with TypeScript
  • Success state displays:
    • Success icon/animation
    • Amount sent and recipient username
    • Transaction hash with clickable link to Stellar Explorer
    • "Send Another Tip" and "Close" buttons
  • Error state displays:
    • Error icon
    • User-friendly error message
    • Expandable technical error details
    • "Try Again" and "Close" buttons
  • Different error types handled with specific messages
  • Stellar Explorer links work correctly for both testnet and mainnet
  • getStellarExplorerUrl() helper added to lib/stellar/config.ts
  • Component has smooth transitions/animations
  • Component is accessible (ARIA attributes, keyboard navigation)
  • Component is responsive on mobile and desktop
  • Loom video submitted showing both success and error states with different error scenarios

Useful Resources

Notes

  • Make error messages user-friendly, not technical jargon
  • Consider adding a "Share" button to share successful tips on social media
  • Success animation should be celebratory but not overwhelming
  • Ensure transaction hash is copyable (click to copy functionality)
  • Error details should help users troubleshoot (e.g., "Check your wallet balance")

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programtippingCrypto tipping feature using Stellar

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions