File size: 4,769 Bytes
abaa704
 
 
 
 
 
 
 
 
 
951cee4
abaa704
 
951cee4
abaa704
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
951cee4
 
abaa704
951cee4
 
abaa704
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
'use client';

import { X, Crown, Calendar, User } from 'lucide-react';

interface UserInfoModalProps {
    isOpen: boolean;
    onClose: () => void;
    username: string;
    isVip: boolean;
    vipExpireAt: string | null;
    onRenewVip?: () => void;
}

export default function UserInfoModal({ isOpen, onClose, username, isVip, vipExpireAt, onRenewVip }: UserInfoModalProps) {
    if (!isOpen) return null;

    // 格式化到期日期
    const formatDate = (dateStr: string | null) => {
        if (!dateStr) return '永久有效';
        try {
            const date = new Date(dateStr);
            return date.toLocaleDateString('zh-CN', {
                year: 'numeric',
                month: 'long',
                day: 'numeric'
            });
        } catch (e) {
            return dateStr;
        }
    };

    return (
        <div className="fixed inset-0 z-[60] flex items-center justify-center bg-black/60 backdrop-blur-sm p-4">
            <div className="bg-[#1E2030] rounded-2xl w-full max-w-sm border border-gray-800 shadow-2xl relative animate-in fade-in zoom-in duration-200">
                {/* 关闭按钮 */}
                <button
                    onClick={onClose}
                    className="absolute top-4 right-4 text-gray-400 hover:text-white transition-colors"
                >
                    <X size={20} />
                </button>

                <div className="p-8">
                    {/* 用户头像/标识 */}
                    <div className="flex flex-col items-center mb-6">
                        <div className="w-20 h-20 bg-blue-600/20 rounded-full flex items-center justify-center mb-4 relative">
                            <User size={40} className="text-blue-400" />
                            {isVip && (
                                <div className="absolute -bottom-1 -right-1 bg-yellow-500 rounded-full p-1.5 shadow-lg border-2 border-[#1E2030]">
                                    <Crown size={14} className="text-black" />
                                </div>
                            )}
                        </div>
                        <h3 className="text-xl font-bold text-white">{username}</h3>
                        <p className="text-sm text-gray-400 mt-1">
                            {isVip ? '尊贵 VIP 会员' : '普通注册用户'}
                        </p>
                    </div>

                    {/* 信息详情 */}
                    <div className="space-y-4">
                        <div className="bg-[#2A2D3C] border border-gray-700/50 rounded-xl p-4">
                            <div className="flex items-center justify-between">
                                <div className="flex items-center gap-3 text-gray-400">
                                    <Crown size={18} className={isVip ? 'text-yellow-500' : 'text-gray-600'} />
                                    <span className="text-sm font-medium">账户等级</span>
                                </div>
                                <span className={`text-sm font-bold ${isVip ? 'text-yellow-500' : 'text-gray-400'}`}>
                                    {isVip ? 'VIP' : 'Free'}
                                </span>
                            </div>
                        </div>

                        {isVip && (
                            <div className="bg-[#2A2D3C] border border-gray-700/50 rounded-xl p-4">
                                <div className="flex items-center justify-between">
                                    <div className="flex items-center gap-3 text-gray-400">
                                        <Calendar size={18} className="text-blue-400" />
                                        <span className="text-sm font-medium">到期时间</span>
                                    </div>
                                    <span className="text-sm font-bold text-gray-200">
                                        {formatDate(vipExpireAt)}
                                    </span>
                                </div>
                            </div>
                        )}
                    </div>

                    {/* 按钮 */}
                    <button
                        onClick={onRenewVip || onClose}
                        className="w-full mt-8 bg-gradient-to-r from-yellow-500 to-orange-600 hover:from-yellow-400 hover:to-orange-500 text-white font-bold py-3.5 rounded-xl transition-all shadow-lg shadow-orange-900/20 active:scale-[0.98] flex items-center justify-center gap-2"
                    >
                        <Crown size={16} />
                        <span>会员续费</span>
                    </button>
                </div>
            </div>
        </div>
    );
}