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
|
|
|
|
aesthetic-improvements: align spacing to 8px grid (Action 11.2.1.3)
- Created automated script (scripts/align-8px-grid.py) to align all spacing to 8px grid
- Replaced non-8px-aligned spacing: gap-3/p-3/m-3 (12px) → gap-4/p-4/m-4 (16px), gap-5/p-5/m-5 (20px) → gap-6/p-6/m-6 (24px), gap-10/p-10/m-10 (40px) → gap-12/p-12/m-12 (48px), gap-20/p-20/m-20 (80px) → gap-24/p-24/m-24 (96px)
- Preserved: 4px values (gap-1, p-1, m-1) as they may be intentional fine-tuning, responsive breakpoints (sm:, md:, lg:), test files, documentation
- Modified files across all components to ensure consistent 8px grid alignment
- Action 11.2.1.3: Align all elements to 8px grid - COMPLETE
2026-01-16 10:50:46 +00:00
|
|
|
<div className="space-y-4 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>
|
aesthetic-improvements: reduce decorative cyan in marketplace, gamification, commerce, and education (80/20 rule, batch 10)
- Marketplace: LicenceDetailsModal decorative icon and price text, ProductDetailView decorative author text, ReviewProductModal decorative icon, LicenceCard decorative price text (4 instances)
- Gamification: AchievementCard decorative XP reward text, LeaderboardView loading spinner and decorative XP text, ProfileXPView loading spinner and decorative icons, AchievementsView loading spinner (5 instances)
- Commerce: WishlistView decorative price text, PromoCodeModal decorative icon, CartItem decorative license tag icon, OrderSummary decorative total price text (4 instances)
- Education: MyCoursesView decorative icon (1 instance)
- Total: ~14 files, ~14 instances replaced
- Preserved: Functional links (LicenceDetailsModal legal contract link), active/selected states (CourseLearningView active lesson, QuizModal selected answer - already preserved), primary actions, design system variants
- Action 11.3.1.3 in progress (tenth batch: marketplace, gamification, commerce, and education components)
2026-01-16 10:23:25 +00:00
|
|
|
<span className="text-2xl font-mono font-bold text-kodo-steel">
|
2026-01-13 18:47:57 +00:00
|
|
|
{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
|
|
|
|
aesthetic-improvements: align spacing to 8px grid (Action 11.2.1.3)
- Created automated script (scripts/align-8px-grid.py) to align all spacing to 8px grid
- Replaced non-8px-aligned spacing: gap-3/p-3/m-3 (12px) → gap-4/p-4/m-4 (16px), gap-5/p-5/m-5 (20px) → gap-6/p-6/m-6 (24px), gap-10/p-10/m-10 (40px) → gap-12/p-12/m-12 (48px), gap-20/p-20/m-20 (80px) → gap-24/p-24/m-24 (96px)
- Preserved: 4px values (gap-1, p-1, m-1) as they may be intentional fine-tuning, responsive breakpoints (sm:, md:, lg:), test files, documentation
- Modified files across all components to ensure consistent 8px grid alignment
- Action 11.2.1.3: Align all elements to 8px grid - COMPLETE
2026-01-16 10:50:46 +00:00
|
|
|
<div className="bg-kodo-ink/50 p-4 rounded-xl border border-kodo-steel/50 flex items-start gap-4">
|
2026-01-13 18:47:57 +00:00
|
|
|
<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>
|
|
|
|
|
);
|
|
|
|
|
};
|