181 lines
7.3 KiB
React
181 lines
7.3 KiB
React
/*
|
|
Copyright (C) 2025 QuantumNous
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU Affero General Public License as
|
|
published by the Free Software Foundation, either version 3 of the
|
|
License, or (at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU Affero General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Affero General Public License
|
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
For commercial licensing, please contact support@quantumnous.com
|
|
*/
|
|
import {
|
|
X as ActionX,
|
|
ArrowRight as ActionArrowRight,
|
|
} from '@/components/common/icons/ActionIcons';
|
|
import React from 'react';
|
|
import { Modal, Button, Typography } from '@/components/ui';
|
|
import { useTranslation } from 'react-i18next';
|
|
import { Gift, Sparkles, Wallet, KeyRound, Star } from 'lucide-react';
|
|
import { renderQuota } from '../../../helpers';
|
|
|
|
const { Text } = Typography;
|
|
|
|
const FEATURES = [
|
|
{
|
|
icon: Sparkles,
|
|
title: '顶尖模型随心调',
|
|
desc: '可调用 claude、codex 等全球顶尖大模型',
|
|
},
|
|
{
|
|
icon: KeyRound,
|
|
title: '一个 Key 接入一切',
|
|
desc: '生成 API Key,直接对接 openclaw、opencode 等工具',
|
|
},
|
|
];
|
|
|
|
const NewUserGiftModal = ({ visible, onClose, quota }) => {
|
|
const { t } = useTranslation();
|
|
const quotaDisplay = renderQuota(quota || 0);
|
|
|
|
return (
|
|
<Modal
|
|
visible={visible}
|
|
closable={false}
|
|
maskClosable={true}
|
|
onCancel={onClose}
|
|
footer={null}
|
|
width={440}
|
|
className='new-user-gift-modal'
|
|
bodyStyle={{ padding: 0 }}
|
|
centered
|
|
>
|
|
<div className='relative overflow-hidden bg-white dark:bg-gray-900'>
|
|
{/* 关闭按钮 */}
|
|
<button
|
|
onClick={onClose}
|
|
className='app-action-button absolute top-3.5 right-3.5 z-20 w-7 h-7 rounded-full bg-white/20 hover:bg-white/35 flex items-center justify-center transition-colors duration-150'
|
|
aria-label={t('关闭')}
|
|
>
|
|
<ActionX size={14} className='text-white' />
|
|
</button>
|
|
|
|
{/* 头部 */}
|
|
<div className='relative bg-gradient-to-br from-amber-400 via-orange-400 to-yellow-500 px-8 pt-8 pb-12 text-center overflow-hidden'>
|
|
{/* 装饰圆 */}
|
|
<div className='absolute -top-12 -right-12 w-48 h-48 bg-white/10 rounded-full' />
|
|
<div className='absolute -bottom-8 -left-8 w-32 h-32 bg-white/10 rounded-full' />
|
|
<div className='absolute top-6 left-8 w-1.5 h-1.5 bg-white/60 rounded-full' />
|
|
<div className='absolute top-10 right-16 w-2 h-2 bg-white/40 rounded-full' />
|
|
<div className='absolute bottom-10 right-10 w-1.5 h-1.5 bg-white/55 rounded-full' />
|
|
<div className='absolute top-16 left-20 w-1 h-1 bg-white/45 rounded-full' />
|
|
|
|
{/* 星形装饰 */}
|
|
<div className='absolute top-5 right-8 opacity-30'>
|
|
<Star size={10} className='text-white fill-white' />
|
|
</div>
|
|
<div className='absolute bottom-14 left-12 opacity-25'>
|
|
<Star size={8} className='text-white fill-white' />
|
|
</div>
|
|
|
|
{/* 礼物图标 */}
|
|
<div className='relative mx-auto mb-4 w-16 h-16 bg-white/25 backdrop-blur-sm rounded-2xl flex items-center justify-center shadow-2xl ring-2 ring-white/30 rotate-3'>
|
|
<Gift size={30} className='text-white -rotate-3' />
|
|
<div className='absolute -top-2 -right-2 w-6 h-6 bg-white rounded-full flex items-center justify-center shadow-lg'>
|
|
<Sparkles size={12} className='text-amber-500' />
|
|
</div>
|
|
</div>
|
|
|
|
<h2 className='text-white text-lg font-bold mb-1 leading-snug drop-shadow-sm'>
|
|
{t('恭喜!新人礼包已到账')}
|
|
</h2>
|
|
<p className='text-amber-100 text-xs'>
|
|
{t('专属体验额度已自动充入您的账户')}
|
|
</p>
|
|
</div>
|
|
|
|
{/* 额度卡片 — 叠加在头部下边缘 */}
|
|
<div className='relative -mt-7 mx-5 z-10'>
|
|
<div className='bg-white dark:bg-gray-800 rounded-2xl shadow-xl shadow-amber-400/20 border border-amber-100 dark:border-amber-900/40 px-5 py-4 text-center'>
|
|
<div className='flex items-center justify-center gap-1.5 mb-1.5'>
|
|
<Wallet
|
|
size={13}
|
|
className='text-amber-500 dark:text-amber-400'
|
|
/>
|
|
<Text className='!text-amber-600 dark:!text-amber-400 text-xs font-medium'>
|
|
{t('免费体验额度')}
|
|
</Text>
|
|
</div>
|
|
<div className='text-4xl font-extrabold bg-gradient-to-r from-amber-500 to-orange-500 bg-clip-text text-transparent leading-tight tracking-tight'>
|
|
{quotaDisplay}
|
|
</div>
|
|
<Text className='!text-gray-400 dark:!text-gray-400 text-xs mt-1.5 block'>
|
|
{t('已存入账户 · 无需任何操作 · 用完可随时充值')}
|
|
</Text>
|
|
</div>
|
|
</div>
|
|
|
|
{/* 权益列表 */}
|
|
<div className='px-5 pt-3.5 pb-3 space-y-2'>
|
|
{FEATURES.map(({ icon: Icon, title, desc }) => (
|
|
<div
|
|
key={title}
|
|
className='flex items-start gap-3 p-3 rounded-xl bg-amber-50/60 dark:bg-gray-800/50 hover:bg-amber-50 dark:hover:bg-amber-900/20 border border-amber-100/80 dark:border-amber-900/30 transition-colors duration-150'
|
|
>
|
|
<div className='w-8 h-8 bg-gradient-to-br from-amber-400 to-orange-400 rounded-lg flex items-center justify-center flex-shrink-0 shadow-sm shadow-amber-300/40'>
|
|
<Icon size={14} className='text-white' />
|
|
</div>
|
|
<div className='min-w-0'>
|
|
<p className='text-gray-800 dark:text-gray-200 text-sm font-semibold leading-snug'>
|
|
{t(title)}
|
|
</p>
|
|
<p className='text-gray-500 dark:text-gray-400 text-xs mt-0.5 leading-relaxed'>
|
|
{t(desc)}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
))}
|
|
</div>
|
|
|
|
{/* 底部按钮 */}
|
|
<div className='px-5 pb-5 pt-1.5'>
|
|
<Button
|
|
theme='solid'
|
|
size='large'
|
|
onClick={onClose}
|
|
className='w-full !bg-gradient-to-r !from-amber-400 !to-orange-500 hover:!from-amber-500 hover:!to-orange-600 !border-0 !rounded-xl !h-11 !font-semibold !shadow-lg !shadow-amber-400/30 transition-all duration-200 hover:!shadow-xl hover:!shadow-amber-400/40 active:!scale-[0.98]'
|
|
>
|
|
<span className='flex items-center justify-center gap-2 text-white'>
|
|
{t('马上试一试')}
|
|
<ActionArrowRight size={16} />
|
|
</span>
|
|
</Button>
|
|
<p className='text-gray-400 dark:text-gray-500 text-xs text-center mt-2.5 leading-relaxed'>
|
|
{t('在「用户中心」可随时查看余额和使用记录')}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
<style jsx='true'>{`
|
|
.new-user-gift-modal .ant-modal-content {
|
|
border-radius: 20px;
|
|
overflow: hidden;
|
|
padding: 0;
|
|
}
|
|
.new-user-gift-modal .ant-modal-body {
|
|
padding: 0;
|
|
}
|
|
`}</style>
|
|
</Modal>
|
|
);
|
|
};
|
|
|
|
export default NewUserGiftModal;
|