diff --git a/src/components/vouch/VouchImpactPreview.tsx b/src/components/vouch/VouchImpactPreview.tsx new file mode 100644 index 0000000..7fc82b0 --- /dev/null +++ b/src/components/vouch/VouchImpactPreview.tsx @@ -0,0 +1,115 @@ +import { ArrowRight, Award, DollarSign, TrendingDown } from 'lucide-react' +import { Card } from '../ui/Card' +import { Button } from '../ui/Button' +import type { VouchRequest } from '../../types' + +const VOUCH_REPUTATION_BOOST = 12 + +interface VouchImpactPreviewProps { + request: VouchRequest + onConfirm: () => void + onClose: () => void + confirming: boolean +} + +export function VouchImpactPreview({ + request, + onConfirm, + onClose, + confirming, +}: VouchImpactPreviewProps) { + const currentRate = 8 + const boostedScore = request.score + VOUCH_REPUTATION_BOOST + const newRate = 6 + + const impacts = [ + { + label: 'Reputation Score', + before: request.score.toString(), + after: boostedScore.toString(), + icon: Award, + color: '#F59E0B', + }, + { + label: 'Interest Rate', + before: `${currentRate}%`, + after: `${newRate}%`, + icon: TrendingDown, + color: '#22C55E', + }, + { + label: 'Monthly Payment (est.)', + before: `$${Math.round(request.loanAmount * (currentRate / 100) / 12).toLocaleString()}`, + after: `$${Math.round(request.loanAmount * (newRate / 100) / 12).toLocaleString()}`, + icon: DollarSign, + color: '#2563EB', + }, + ] + + return ( +
+ You are about to vouch for{' '} + + {request.learnerWallet} + +
++ {impact.label} +
++ A Silver tier vouch adds {VOUCH_REPUTATION_BOOST} reputation points, + reducing the learner's interest rate from {currentRate}% to {newRate}%. + This transaction requires wallet signing. +
++ This will remove your vouch and the learner will lose the reputation bonus. + This action cannot be undone. +
+- Vouch for learners and help them access - better loan terms. Coming soon. -
++ Vouch for learners and help them access better loan terms. +
+Loading vouch requests...
++ Could not fetch vouch requests. Please try again later. +
+ ++ There are no learners requesting vouches right now. Check back later. +
+Loading active vouches...
++ Could not fetch your active vouches. Please try again later. +
+ ++ You haven't vouched for anyone yet. Go to the Pending Requests tab to find learners. +
+Rep Boost
+Interest
+Expiry
+Repayment
+