2026-01-07 09:31:02 +00:00
|
|
|
import React from 'react';
|
|
|
|
|
import { Card } from '../ui/card';
|
|
|
|
|
import { Tag, ShieldCheck } from 'lucide-react';
|
|
|
|
|
|
|
|
|
|
interface OrderSummaryProps {
|
|
|
|
|
subtotal: number;
|
|
|
|
|
taxRate?: number;
|
|
|
|
|
discount?: { code: string; amount: number; type: 'percent' | 'fixed' };
|
|
|
|
|
currency?: string;
|
|
|
|
|
onCheckout?: () => void;
|
|
|
|
|
loading?: boolean;
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
export const OrderSummary: React.FC<OrderSummaryProps> = ({
|
|
|
|
|
subtotal,
|
|
|
|
|
taxRate = 0.08,
|
|
|
|
|
discount,
|
2026-01-07 09:31:02 +00:00
|
|
|
currency = 'USD',
|
|
|
|
|
onCheckout,
|
2026-01-13 18:47:57 +00:00
|
|
|
loading = false,
|
2026-01-07 09:31:02 +00:00
|
|
|
}) => {
|
2026-01-13 18:47:57 +00:00
|
|
|
const discountAmount = discount
|
|
|
|
|
? discount.type === 'percent'
|
|
|
|
|
? subtotal * (discount.amount / 100)
|
|
|
|
|
: discount.amount
|
2026-01-07 09:31:02 +00:00
|
|
|
: 0;
|
2026-01-13 18:47:57 +00:00
|
|
|
|
2026-01-07 09:31:02 +00:00
|
|
|
const taxableAmount = Math.max(0, subtotal - discountAmount);
|
|
|
|
|
const taxAmount = taxableAmount * taxRate;
|
|
|
|
|
const total = taxableAmount + taxAmount;
|
|
|
|
|
|
|
|
|
|
const formatPrice = (amount: number) => {
|
|
|
|
|
return new Intl.NumberFormat('en-US', {
|
|
|
|
|
style: 'currency',
|
|
|
|
|
currency,
|
|
|
|
|
}).format(amount);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div className="space-y-6">
|
2026-01-13 18:47:57 +00:00
|
|
|
<Card variant="gaming" className="p-6">
|
2026-01-16 00:59:31 +00:00
|
|
|
<h3 className="font-bold text-white mb-6 uppercase tracking-wider text-sm border-b border-kodo-steel pb-2">
|
2026-01-13 18:47:57 +00:00
|
|
|
Order Summary
|
|
|
|
|
</h3>
|
2026-01-07 09:31:02 +00:00
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
<div className="space-y-3 text-sm mb-6">
|
2026-01-16 00:59:31 +00:00
|
|
|
<div className="flex justify-between text-kodo-content-dim">
|
2026-01-13 18:47:57 +00:00
|
|
|
<span>Subtotal</span>
|
|
|
|
|
<span className="text-white font-mono">
|
|
|
|
|
{formatPrice(subtotal)}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
2026-01-07 09:31:02 +00:00
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
{discount && (
|
|
|
|
|
<div className="flex justify-between text-kodo-lime">
|
|
|
|
|
<span className="flex items-center gap-2">
|
|
|
|
|
<Tag className="w-3 h-3" /> Discount ({discount.code})
|
|
|
|
|
</span>
|
|
|
|
|
<span className="font-mono">-{formatPrice(discountAmount)}</span>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
2026-01-13 18:47:57 +00:00
|
|
|
)}
|
|
|
|
|
|
2026-01-16 00:59:31 +00:00
|
|
|
<div className="flex justify-between text-kodo-content-dim">
|
2026-01-13 18:47:57 +00:00
|
|
|
<span>Estimated Tax ({(taxRate * 100).toFixed(0)}%)</span>
|
|
|
|
|
<span className="text-white font-mono">
|
|
|
|
|
{formatPrice(taxAmount)}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-01-16 00:59:31 +00:00
|
|
|
<div className="border-t border-kodo-steel pt-4 mb-6">
|
2026-01-13 18:47:57 +00:00
|
|
|
<div className="flex justify-between items-end">
|
|
|
|
|
<span className="font-bold text-white">Total</span>
|
|
|
|
|
<span className="text-2xl font-mono font-bold text-kodo-cyan">
|
|
|
|
|
{formatPrice(total)}
|
|
|
|
|
</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2026-01-07 09:31:02 +00:00
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
{onCheckout && (
|
|
|
|
|
<button
|
aesthetic-improvements: remove excessive hover effects from high-priority files
- Removed scale transforms (hover:scale-[1.02], hover:scale-110, group-hover:scale-110/105) from cards and images
- Removed decorative shadow/glow effects (hover:shadow-neon-cyan/20, hover:shadow-lg) from cards
- Removed hover-lift class (translateY + shadow) from base Card and Button components
- Replaced excessive effects with subtle hover:bg-white/5 or hover:opacity-90
- Preserved functional hover states (group-hover:opacity-100 for play overlays, hover:bg-accent/50 for interactive feedback)
- Updated 14 files: ProductCard, TrackCard, CourseCard, EquipmentCard, PostCard, ProfileView, card.tsx, SearchPage, PlayerControls, OrderSummary, DiscoverView, PlaylistCard, Sidebar, button.tsx
- Effects are now subtle and purposeful, aligning with Surgical Minimalism
- Action 11.4.1.3 complete
2026-01-16 09:34:41 +00:00
|
|
|
className="w-full h-12 bg-gradient-to-r from-kodo-cyan-dim to-kodo-cyan text-kodo-void border border-transparent font-bold tracking-wide rounded-lg disabled:opacity-50 disabled:cursor-not-allowed transition-opacity duration-200 hover:opacity-90"
|
2026-01-13 18:47:57 +00:00
|
|
|
onClick={onCheckout}
|
|
|
|
|
disabled={loading}
|
|
|
|
|
>
|
|
|
|
|
{loading ? 'PROCESSING...' : 'PROCEED TO CHECKOUT'}
|
|
|
|
|
</button>
|
|
|
|
|
)}
|
|
|
|
|
</Card>
|
2026-01-07 09:31:02 +00:00
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
<div className="bg-kodo-ink/50 p-4 rounded-xl border border-kodo-steel/50 flex items-start gap-3">
|
|
|
|
|
<ShieldCheck className="w-5 h-5 text-kodo-gold flex-shrink-0" />
|
|
|
|
|
<div>
|
|
|
|
|
<h4 className="font-bold text-white text-sm mb-1">Secure Checkout</h4>
|
2026-01-16 00:59:31 +00:00
|
|
|
<p className="text-xs text-kodo-content-dim leading-relaxed">
|
2026-01-13 18:47:57 +00:00
|
|
|
Transactions are encrypted. Downloads are available immediately
|
|
|
|
|
after payment.
|
|
|
|
|
</p>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
2026-01-13 18:47:57 +00:00
|
|
|
</div>
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
};
|