algospaced-dsa / algospaced-ui /src /components /store /GiftPresentationModal.tsx
iamfebin's picture
feat: player economy, item catalog, vault inventory, and companion gifting
aa1fcca
Raw History Blame Contribute Delete
5.15 kB
import React from 'react';
import { X, Heart, Sparkles, Castle } from 'lucide-react';
import type { StoreItem } from '../../types/storeTypes';
import type { GiftReactionData } from './giftReactions';
import { useCompanionStore } from '../../features/companion/store/useCompanionStore';
interface GiftPresentationModalProps {
giftItem: StoreItem;
reaction: GiftReactionData;
onClose: () => void;
onOpenCompanion?: () => void;
}
export const GiftPresentationModal: React.FC<GiftPresentationModalProps> = ({
giftItem,
reaction,
onClose,
onOpenCompanion
}) => {
const companionState = useCompanionStore();
const bondTier = companionState.bondTier;
const bondPoints = companionState.bondPoints;
return (
<div
className="fixed inset-0 z-50 bg-ink-black/60 backdrop-blur-xs flex items-center justify-center p-4 animate-in fade-in duration-200 select-none"
onClick={onClose}
>
<div
className="bg-[#FFFDF0] border-[4px] border-ink-black rounded-xl max-w-lg w-full shadow-[8px_8px_0px_0px_#1E293B] flex flex-col overflow-hidden"
onClick={e => e.stopPropagation()}
>
{/* Header */}
<div className="bg-gradient-to-r from-amber-400 via-rose-300 to-amber-300 border-b-[3px] border-ink-black px-4 py-2.5 flex items-center justify-between">
<div className="flex items-center gap-2">
<Heart className="w-5 h-5 text-rose-600 fill-rose-600 animate-pulse" />
<span className="font-arcade text-xs text-ink-black font-extrabold uppercase tracking-wide">
{reaction.title}
</span>
</div>
<button
type="button"
onClick={onClose}
className="p-1 hover:bg-white/50 rounded text-ink-black cursor-pointer transition-colors"
title="Close"
>
<X className="w-4 h-4" />
</button>
</div>
{/* Content */}
<div className="p-5 flex flex-col gap-4">
{/* Princess Portrait & Badge */}
<div className="flex items-center gap-4 bg-amber-100/60 p-3.5 rounded-lg border-2 border-amber-300">
<div className="w-20 h-20 border-[3px] border-ink-black rounded overflow-hidden bg-amber-50 shadow-[3px_3px_0px_0px_#1E293B] shrink-0">
<img
src={`/sprites/princess/${reaction.emotion}.webp`}
alt="Princess Aurelia"
className="w-full h-full object-cover object-top"
/>
</div>
<div className="flex flex-col gap-1">
<div className="flex items-center gap-1.5 text-xs font-arcade font-bold text-rose-700 flex-wrap">
<Sparkles className="w-3.5 h-3.5 text-rose-600 fill-rose-600" />
<span>+{reaction.bondBonus} Companion Bond</span>
<span className="text-slate-400 font-normal">|</span>
<span className="bg-rose-100 text-rose-800 px-2 py-0.5 rounded border border-rose-300 text-[10px] uppercase tracking-wide">
Tier: {bondTier} ({bondPoints} pts)
</span>
</div>
<h3 className="font-headline-md font-bold text-lg text-ink-black">
Princess Aurelia
</h3>
<p className="text-xs text-slate-600 font-sans">
Received with gratitude: <strong className="text-ink-black">{giftItem.name}</strong>
</p>
</div>
</div>
{/* Aurelia's Response Dialogue */}
<div className="bg-white p-4 border-[2px] border-ink-black rounded shadow-[2px_2px_0px_0px_rgba(0,0,0,0.1)]">
<h4 className="font-arcade text-[9px] text-amber-800 uppercase tracking-wider mb-2 font-bold flex items-center gap-1.5">
<span>Aurelia Speaks</span>
</h4>
<p className="font-serif italic text-sm text-ink-black leading-relaxed">
{reaction.dialogue}
</p>
</div>
{/* Action Footer */}
<div className="flex items-center justify-end gap-3 pt-2">
<button
type="button"
onClick={onClose}
className="font-arcade text-xs px-4 py-2 bg-paper-white hover:bg-slate-200 text-ink-black border-[2px] border-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none cursor-pointer font-bold"
>
Continue
</button>
{onOpenCompanion && (
<button
type="button"
onClick={() => {
onClose();
onOpenCompanion();
}}
className="font-arcade text-xs px-4 py-2 bg-[#f59e0b] hover:bg-amber-400 text-ink-black border-[2px] border-ink-black shadow-[2px_2px_0px_0px_#1E293B] active:translate-y-0.5 active:shadow-none cursor-pointer font-bold flex items-center gap-1.5"
>
<Castle className="w-3.5 h-3.5" />
<span>Visit Aurelia</span>
</button>
)}
</div>
</div>
</div>
</div>
);
};