Files
co-lite/solvway-customer-portal/app/components/QRModal.tsx
T
ngqileandClaude Opus 5.5 5ee51d1913 chore: copy kept Tastefully modules and portals into Co-Lite
Backend modules from tastefully 8bd93d15: core-libs, core-session,
api-gateway, mobile-api, services-auth, services-system,
services-counter, services-member, services-log, services-email.
solvway-admin-portal from babyboo f64d096ea, solvway-customer-portal
from tastefully 8bd93d15. Copied as tracked files only.

Literal secrets replaced with environment placeholders:
- services-email: SMTP_PASSWORD, MAILGUN_API_KEY, SENDGRID_API_KEY,
  MAILJET_API_KEY, MAILJET_SECRET_KEY (optional, empty default)
- services-system: JUMIO_TOKEN, JUMIO_SECRET (optional)
- services-auth: USER_AUTH_API_SECRET (required); commented JWT secret removed
- core-libs: JWT_TOKEN default removed (required), XXL_JOB_TOKEN default
  removed, ipgeolocation key read from IPGEOLOCATION_API_KEY
- services-system EkycAppConfig: commented Jumio credentials removed

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EFUzfj5akPxyikzGc2iAHM
2026-11-26 15:55:45 +08:00

135 lines
5.1 KiB
TypeScript

"use client";
import { motion, AnimatePresence } from "framer-motion";
import { X, Star } from "lucide-react";
import MemberQR from "@/app/components/ui/MemberQR";
import { useTheme } from "@/app/lib/ThemeContext";
interface MemberInfo {
name: string;
id: string;
tier?: string;
}
interface QRModalProps {
open: boolean;
onClose: () => void;
member: MemberInfo;
}
export default function QRModal({ open, onClose, member }: QRModalProps) {
const { isDark } = useTheme();
return (
<AnimatePresence>
{open && (
<>
{/* Backdrop */}
<motion.div
key="backdrop"
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
exit={{ opacity: 0 }}
transition={{ duration: 0.2 }}
onClick={onClose}
className="fixed inset-0 z-[100]"
style={{ background: "rgba(0,0,0,0.6)", backdropFilter: "blur(6px)" }}
/>
{/* Centering shell — flexbox does the centering so Framer's y-transform stays clean */}
<div className="fixed inset-0 z-[101] flex items-center justify-center px-6 pointer-events-none">
<motion.div
key="modal"
initial={{ opacity: 0, scale: 0.88, y: 24 }}
animate={{ opacity: 1, scale: 1, y: 0 }}
exit={{ opacity: 0, scale: 0.92, y: 16 }}
transition={{ type: "spring", stiffness: 380, damping: 28 }}
className="rounded-3xl overflow-hidden w-full max-w-sm pointer-events-auto"
style={{
background: isDark ? "rgba(28,28,28,0.98)" : "#FFFFFF",
border: isDark ? "1px solid rgba(255,255,255,0.1)" : "1px solid rgba(0,0,0,0.06)",
boxShadow: isDark
? "0 32px 80px rgba(0,0,0,0.7), 0 0 40px rgba(255,107,0,0.15)"
: "0 24px 60px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08)",
}}
>
{/* Header strip */}
<div
className="flex items-center justify-between px-5 pt-5 pb-3"
style={{ borderBottom: `1px solid ${isDark ? "rgba(255,255,255,0.06)" : "rgba(0,0,0,0.06)"}` }}
>
<div>
<p className="text-xs font-semibold tracking-widest uppercase" style={{ color: "var(--orange-text)" }}>
Member Badge
</p>
<p className="text-base font-extrabold mt-0.5 uppercase" style={{ color: "var(--text-primary)" }}>
{member.name}
</p>
</div>
<motion.button
onClick={onClose}
whileTap={{ scale: 0.88 }}
className="w-8 h-8 rounded-xl flex items-center justify-center"
style={{
background: isDark ? "rgba(255,255,255,0.08)" : "rgba(0,0,0,0.06)",
}}
>
<X strokeWidth={2} className="w-4 h-4" style={{ stroke: "var(--text-secondary)" }} />
</motion.button>
</div>
{/* QR code */}
<div className="flex flex-col items-center py-8 px-5 gap-4">
{/* QR wrapper */}
<div
className="rounded-2xl p-4 flex items-center justify-center"
style={{
background: "#FFFFFF",
boxShadow: "0 0 0 1px rgba(255,107,0,0.15), 0 4px 20px rgba(0,0,0,0.1)",
}}
>
<MemberQR value={member.id} />
</div>
{/* Scan hint */}
<p className="text-xs tracking-wide" style={{ color: "var(--text-muted)" }}>
Scan to verify membership
</p>
{/* Member info */}
<div className="w-full text-center space-y-1.5">
<p className="text-xl font-extrabold tracking-tight uppercase" style={{ color: "var(--text-primary)" }}>
{member.name}
</p>
<p className="text-xs font-mono" style={{ color: "var(--text-muted)" }}>{member.id}</p>
{member.tier && (
<div className="flex items-center justify-center gap-1.5 mt-2">
<Star strokeWidth={2} className="w-3 h-3 stroke-tastefullyOrange fill-tastefullyOrange" />
<span className="text-xs font-bold tracking-widest uppercase" style={{ color: "var(--orange-text)" }}>
{member.tier}
</span>
</div>
)}
</div>
</div>
{/* Footer strip */}
<div
className="px-5 py-4 text-center"
style={{
borderTop: `1px solid ${isDark ? "rgba(255,255,255,0.06)" : "rgba(0,0,0,0.06)"}`,
background: isDark ? "rgba(255,255,255,0.03)" : "rgba(250,247,244,1)",
}}
>
<p className="text-xs font-semibold tracking-widest uppercase" style={{ color: "var(--text-muted)" }}>
© 2026 Tastefully
</p>
</div>
</motion.div>
</div>
</>
)}
</AnimatePresence>
);
}