2026-01-07 09:31:02 +00:00
|
|
|
import React from 'react';
|
2026-02-03 08:46:01 +00:00
|
|
|
import { CartItem as CartItemType } from '../../stores/cartStore';
|
2026-01-07 09:31:02 +00:00
|
|
|
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 }) => {
|
2026-02-03 08:46:01 +00:00
|
|
|
// Access product details from nested object
|
|
|
|
|
const { product } = item;
|
|
|
|
|
|
|
|
|
|
const price = item.selectedLicense ? item.selectedLicense.price : product.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"
|
2026-02-07 15:07:09 +00:00
|
|
|
className="flex flex-col md:flex-row items-center gap-4 p-4 group hover:border-border/50 transition-all"
|
2026-01-13 18:47:57 +00:00
|
|
|
>
|
|
|
|
|
{/* Thumbnail */}
|
refactor: Phase 3a — Global color class migration to SUMI semantics
- Replace all kodo-* color classes across ~100 TSX files:
kodo-void → background, kodo-ink → card, kodo-graphite → muted,
kodo-steel → muted-foreground, kodo-cyan → primary, kodo-magenta → destructive,
kodo-lime → success, kodo-red → destructive, kodo-gold → warning
- Replace cyan-500, magenta-500, lime-500 default Tailwind colors with
semantic equivalents (primary, destructive, success)
- Fix WaveformVisualizer hardcoded hex colors to SUMI values
- Delete global-effects.css (conflicting, redundant with index.css)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 00:51:49 +00:00
|
|
|
<div className="w-full md:w-24 h-24 rounded-lg overflow-hidden flex-shrink-0 bg-muted">
|
2026-01-13 18:47:57 +00:00
|
|
|
<img
|
2026-02-03 08:46:01 +00:00
|
|
|
src={product.coverUrl}
|
2026-02-12 01:09:29 +00:00
|
|
|
className="w-full h-full object-cover group-hover:scale-105 transition-transform duration-[var(--sumi-duration-slow)]"
|
2026-02-03 08:46:01 +00:00
|
|
|
alt={product.title}
|
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
|
|
|
{/* Info */}
|
|
|
|
|
<div className="flex-1 w-full text-center md:text-left">
|
2026-02-12 01:09:29 +00:00
|
|
|
<h4 className="font-bold text-foreground text-lg">{product.title}</h4>
|
2026-02-07 15:07:09 +00:00
|
|
|
<p className="text-muted-foreground text-sm mb-2">{product.author}</p>
|
2026-01-13 18:47:57 +00:00
|
|
|
<div className="flex items-center justify-center md:justify-start gap-2 text-xs">
|
refactor: Phase 3a — Global color class migration to SUMI semantics
- Replace all kodo-* color classes across ~100 TSX files:
kodo-void → background, kodo-ink → card, kodo-graphite → muted,
kodo-steel → muted-foreground, kodo-cyan → primary, kodo-magenta → destructive,
kodo-lime → success, kodo-red → destructive, kodo-gold → warning
- Replace cyan-500, magenta-500, lime-500 default Tailwind colors with
semantic equivalents (primary, destructive, success)
- Fix WaveformVisualizer hardcoded hex colors to SUMI values
- Delete global-effects.css (conflicting, redundant with index.css)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 00:51:49 +00:00
|
|
|
<span className="px-2 py-1 bg-card border border-border rounded flex items-center gap-1">
|
2026-02-07 15:07:09 +00:00
|
|
|
<Tag className="w-3 h-3 text-muted-foreground" /> {licenseName} License
|
2026-01-13 18:47:57 +00:00
|
|
|
</span>
|
refactor: Phase 3a — Global color class migration to SUMI semantics
- Replace all kodo-* color classes across ~100 TSX files:
kodo-void → background, kodo-ink → card, kodo-graphite → muted,
kodo-steel → muted-foreground, kodo-cyan → primary, kodo-magenta → destructive,
kodo-lime → success, kodo-red → destructive, kodo-gold → warning
- Replace cyan-500, magenta-500, lime-500 default Tailwind colors with
semantic equivalents (primary, destructive, success)
- Fix WaveformVisualizer hardcoded hex colors to SUMI values
- Delete global-effects.css (conflicting, redundant with index.css)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 00:51:49 +00:00
|
|
|
<span className="px-2 py-1 bg-card border border-border rounded uppercase font-bold text-muted-foreground">
|
2026-02-03 08:46:01 +00:00
|
|
|
{product.type}
|
2026-01-13 18:47:57 +00:00
|
|
|
</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">
|
2026-02-12 01:09:29 +00:00
|
|
|
<div className="text-xl font-mono font-bold text-foreground">
|
2026-01-13 18:47:57 +00:00
|
|
|
${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-02-07 15:07:09 +00:00
|
|
|
className="text-muted-foreground hover:text-destructive hover:bg-destructive/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>
|
|
|
|
|
);
|
|
|
|
|
};
|