2026-01-07 09:31:02 +00:00
|
|
|
import React from 'react';
|
|
|
|
|
import { CartItem as CartItemType } from '../../types';
|
|
|
|
|
import { Card } from '../ui/card';
|
|
|
|
|
import { Button } from '../ui/button';
|
|
|
|
|
import { Trash2, Tag } from 'lucide-react';
|
|
|
|
|
|
|
|
|
|
interface CartItemProps {
|
|
|
|
|
item: CartItemType;
|
|
|
|
|
onRemove: (id: string) => void;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export const CartItem: React.FC<CartItemProps> = ({ item, onRemove }) => {
|
|
|
|
|
const price = item.selectedLicense ? item.selectedLicense.price : item.price;
|
2026-01-13 18:47:57 +00:00
|
|
|
const licenseName = item.selectedLicense
|
|
|
|
|
? item.selectedLicense.name
|
|
|
|
|
: 'Standard';
|
2026-01-07 09:31:02 +00:00
|
|
|
|
|
|
|
|
return (
|
2026-01-13 18:47:57 +00:00
|
|
|
<Card
|
|
|
|
|
variant="default"
|
aesthetic-improvements: replace secondary cyan hover states with steel (batch 2)
- Card components: CartItem, WishlistView, PostCard, GroupCard, PlaylistsView, UserCard (7 files)
- Settings components: BackupsView, SessionManagement, CloudIntegrationView, OfflineQueueManager (4 files)
- DashboardPage: stat cards and activity items hover states (2 instances)
- FeedView: input and button hover states (2 instances)
- Upload zones: MetadataForm, CreatePlaylistModal, CreateProductView, AddEquipmentView, CreateGroupModal (5 files, 6 instances)
- UserCard: avatar border hover state
- Total: ~18 files, ~20 instances replaced
- Preserved: Focus rings (cyan), active/selected states (cyan)
- Action 11.3.1.2 in progress (second batch complete)
2026-01-16 09:53:34 +00:00
|
|
|
className="flex flex-col md:flex-row items-center gap-4 p-4 group hover:border-kodo-steel/50 transition-all"
|
2026-01-13 18:47:57 +00:00
|
|
|
>
|
|
|
|
|
{/* Thumbnail */}
|
2026-01-16 00:59:31 +00:00
|
|
|
<div className="w-full md:w-24 h-24 rounded-lg overflow-hidden flex-shrink-0 bg-kodo-graphite">
|
2026-01-13 18:47:57 +00:00
|
|
|
<img
|
|
|
|
|
src={item.coverUrl}
|
|
|
|
|
className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-500"
|
|
|
|
|
alt={item.title}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
2026-01-07 09:31:02 +00:00
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
{/* Info */}
|
|
|
|
|
<div className="flex-1 w-full text-center md:text-left">
|
|
|
|
|
<h4 className="font-bold text-white text-lg">{item.title}</h4>
|
2026-01-16 00:59:31 +00:00
|
|
|
<p className="text-kodo-content-dim text-sm mb-2">{item.author}</p>
|
2026-01-13 18:47:57 +00:00
|
|
|
<div className="flex items-center justify-center md:justify-start gap-2 text-xs">
|
|
|
|
|
<span className="px-2 py-1 bg-kodo-ink border border-kodo-steel rounded flex items-center gap-1">
|
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
|
|
|
<Tag className="w-3 h-3 text-kodo-steel" /> {licenseName} License
|
2026-01-13 18:47:57 +00:00
|
|
|
</span>
|
2026-01-16 00:59:31 +00:00
|
|
|
<span className="px-2 py-1 bg-kodo-ink border border-kodo-steel rounded uppercase font-bold text-kodo-content-dim">
|
2026-01-13 18:47:57 +00:00
|
|
|
{item.type}
|
|
|
|
|
</span>
|
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
|
|
|
|
2026-01-13 18:47:57 +00:00
|
|
|
{/* Price & Actions */}
|
|
|
|
|
<div className="flex flex-row md:flex-col items-center gap-4 md:gap-2 w-full md:w-auto justify-between">
|
|
|
|
|
<div className="text-xl font-mono font-bold text-white">
|
|
|
|
|
${price.toFixed(2)}
|
2026-01-07 09:31:02 +00:00
|
|
|
</div>
|
2026-01-13 18:47:57 +00:00
|
|
|
<Button
|
|
|
|
|
variant="ghost"
|
|
|
|
|
size="sm"
|
2026-01-16 00:59:31 +00:00
|
|
|
className="text-kodo-content-dim hover:text-kodo-red hover:bg-kodo-red/10"
|
2026-01-13 18:47:57 +00:00
|
|
|
onClick={() => onRemove(item.cartId)}
|
|
|
|
|
>
|
|
|
|
|
<Trash2 className="w-4 h-4" />
|
|
|
|
|
</Button>
|
|
|
|
|
</div>
|
2026-01-07 09:31:02 +00:00
|
|
|
</Card>
|
|
|
|
|
);
|
|
|
|
|
};
|