/* 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 . For commercial licensing, please contact support@quantumnous.com */ import React from 'react'; import { Modal, Badge } from '@douyinfe/semi-ui'; import { renderQuota, renderNumber } from '../../../../helpers'; const UserInfoModal = ({ showUserInfo, setShowUserInfoModal, userInfoData, t, }) => { const infoItemStyle = { marginBottom: '16px', }; const labelStyle = { display: 'flex', alignItems: 'center', marginBottom: '2px', fontSize: '12px', color: 'var(--semi-color-text-2)', gap: '6px', }; const renderLabel = (text, type = 'tertiary') => (
{text}
); const valueStyle = { fontSize: '14px', fontWeight: '600', color: 'var(--semi-color-text-0)', }; const rowStyle = { display: 'flex', justifyContent: 'space-between', marginBottom: '16px', gap: '20px', }; const colStyle = { flex: 1, minWidth: 0, }; return ( setShowUserInfoModal(false)} footer={null} centered closable maskClosable width={600} > {userInfoData && (
{/* 基本信息 */}
{renderLabel(t('用户名'), 'primary')}
{userInfoData.username}
{userInfoData.display_name && (
{renderLabel(t('显示名称'), 'primary')}
{userInfoData.display_name}
)}
{/* 余额信息 */}
{renderLabel(t('余额'), 'success')}
{renderQuota(userInfoData.quota)}
{renderLabel(t('已用额度'), 'warning')}
{renderQuota(userInfoData.used_quota)}
{/* 统计信息 */}
{renderLabel(t('请求次数'), 'warning')}
{renderNumber(userInfoData.request_count)}
{userInfoData.group && (
{renderLabel(t('用户组'), 'tertiary')}
{userInfoData.group}
)}
{/* 邀请信息 */} {(userInfoData.aff_code || userInfoData.aff_count !== undefined) && (
{userInfoData.aff_code && (
{renderLabel(t('邀请码'), 'tertiary')}
{userInfoData.aff_code}
)} {userInfoData.aff_count !== undefined && (
{renderLabel(t('邀请人数'), 'tertiary')}
{renderNumber(userInfoData.aff_count)}
)}
)} {/* 邀请获得额度 */} {userInfoData.aff_quota !== undefined && userInfoData.aff_quota > 0 && (
{renderLabel(t('邀请获得额度'), 'success')}
{renderQuota(userInfoData.aff_quota)}
)} {/* 备注 */} {userInfoData.remark && (
{renderLabel(t('备注'), 'tertiary')}
{userInfoData.remark}
)}
)}
); }; export default UserInfoModal;