feat: 参考原型图 ui优化提交 个人端-用户中心 相关的页面
This commit is contained in:
@@ -18,17 +18,19 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import { Modal, Typography, Button, Spin } from '@douyinfe/semi-ui';
|
||||
import { X, Bot } from 'lucide-react';
|
||||
import { Button, Drawer, Spin } from 'antd';
|
||||
|
||||
import { useIsMobile } from '../../../../hooks/common/useIsMobile';
|
||||
import { useMarketThemeStyle } from '../market/marketTheme';
|
||||
import ModelHeader from './components/ModelHeader';
|
||||
import ModelBasicInfo from './components/ModelBasicInfo';
|
||||
import ModelEndpoints from './components/ModelEndpoints';
|
||||
import ModelPricingTable from './components/ModelPricingTable';
|
||||
|
||||
const { Text } = Typography;
|
||||
|
||||
/**
|
||||
* 模型详情:原型为右侧 820px Drawer(窄屏铺满)。
|
||||
* 打开条件、关闭回调(遮罩 / Esc / 关闭按钮均走 onClose)与内容数据源保持原实现。
|
||||
*/
|
||||
const ModelDetailSideSheet = ({
|
||||
visible,
|
||||
onClose,
|
||||
@@ -47,134 +49,55 @@ const ModelDetailSideSheet = ({
|
||||
t,
|
||||
}) => {
|
||||
const isMobile = useIsMobile();
|
||||
const themeStyle = useMarketThemeStyle();
|
||||
|
||||
return (
|
||||
<Modal
|
||||
title={null}
|
||||
header={null}
|
||||
footer={null}
|
||||
bodyStyle={{
|
||||
padding: '0',
|
||||
borderRadius: '20px',
|
||||
overflow: 'hidden',
|
||||
}}
|
||||
className='model-detail-modal'
|
||||
visible={visible}
|
||||
width={isMobile ? '95%' : 560}
|
||||
centered
|
||||
closeIcon={null}
|
||||
onCancel={onClose}
|
||||
maskClosable={true}
|
||||
maskStyle={{
|
||||
backgroundColor: 'rgba(0, 0, 0, 0.4)',
|
||||
backdropFilter: 'blur(8px)',
|
||||
}}
|
||||
<Drawer
|
||||
title={t('模型详情')}
|
||||
open={visible}
|
||||
onClose={onClose}
|
||||
width={isMobile ? '100%' : 820}
|
||||
rootClassName='mm-detail-drawer mm-theme'
|
||||
rootStyle={themeStyle}
|
||||
footer={
|
||||
<div className='mm-detail-footer'>
|
||||
<Button type='primary' onClick={onClose}>
|
||||
{t('关闭')}
|
||||
</Button>
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{/* 自定义头部 */}
|
||||
<div className='px-4 pt-4 pb-3'>
|
||||
<div className='flex items-center justify-between'>
|
||||
<div className='flex items-center gap-2'>
|
||||
<div className='p-1.5 bg-gradient-to-br from-brand-from to-brand-to rounded-lg'>
|
||||
<Bot size={16} className='text-white' />
|
||||
</div>
|
||||
<div>
|
||||
<h2 className='text-sm font-semibold text-gray-800 dark:text-gray-100'>
|
||||
{t('模型详情')}
|
||||
</h2>
|
||||
<p className='text-[11px] text-gray-500 dark:text-gray-400'>
|
||||
{t('查看模型定价与配置信息')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 关闭按钮 */}
|
||||
<button
|
||||
onClick={onClose}
|
||||
className='p-1.5 rounded-lg bg-gray-100 hover:bg-gray-200 dark:bg-neutral-800 dark:hover:bg-neutral-700 transition-colors'
|
||||
>
|
||||
<X size={16} className='text-gray-500 dark:text-gray-400' />
|
||||
</button>
|
||||
{!modelData ? (
|
||||
<div className='mm-detail-loading'>
|
||||
<Spin size='large' />
|
||||
<span>{t('加载中...')}</span>
|
||||
</div>
|
||||
|
||||
{/* 模型标题 */}
|
||||
{modelData && (
|
||||
<div className='mt-2'>
|
||||
<ModelHeader modelData={modelData} vendorsMap={vendorsMap} t={t} />
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* 内容区域 */}
|
||||
<div
|
||||
className='overflow-y-auto'
|
||||
style={{
|
||||
maxHeight: isMobile ? 'calc(85vh - 180px)' : 'calc(75vh - 160px)',
|
||||
}}
|
||||
>
|
||||
<div className='px-4 pb-3'>
|
||||
{!modelData ? (
|
||||
<div className='flex flex-col justify-center items-center py-12'>
|
||||
<Spin size='large' />
|
||||
<Text type='secondary' className='mt-3'>
|
||||
{t('加载中...')}
|
||||
</Text>
|
||||
</div>
|
||||
) : (
|
||||
/* 分区平铺 + 发丝分隔线:原先每区一层白卡边框,与弹窗自身、
|
||||
* 区内表格边框叠出三层线框(用户反馈嵌套过多),改为零嵌套 */
|
||||
<div className='divide-y divide-gray-100 dark:divide-neutral-800'>
|
||||
{/* 基本信息 */}
|
||||
<div className='py-3 first:pt-1'>
|
||||
<ModelBasicInfo
|
||||
modelData={modelData}
|
||||
vendorsMap={vendorsMap}
|
||||
t={t}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* 端点信息 */}
|
||||
<div className='py-3'>
|
||||
<ModelEndpoints
|
||||
modelData={modelData}
|
||||
endpointMap={endpointMap}
|
||||
t={t}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* 定价表格 */}
|
||||
{!hidePrice && (
|
||||
<div className='py-3'>
|
||||
<ModelPricingTable
|
||||
modelData={modelData}
|
||||
groupRatio={groupRatio}
|
||||
groupModelDiscount={groupModelDiscount}
|
||||
currency={currency}
|
||||
tokenUnit={tokenUnit}
|
||||
displayPrice={displayPrice}
|
||||
showRatio={showRatio}
|
||||
usableGroup={usableGroup}
|
||||
autoGroups={autoGroups}
|
||||
t={t}
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
<ModelHeader modelData={modelData} vendorsMap={vendorsMap} t={t} />
|
||||
<ModelBasicInfo modelData={modelData} vendorsMap={vendorsMap} t={t} />
|
||||
<ModelEndpoints
|
||||
modelData={modelData}
|
||||
endpointMap={endpointMap}
|
||||
t={t}
|
||||
/>
|
||||
{!hidePrice && (
|
||||
<ModelPricingTable
|
||||
modelData={modelData}
|
||||
groupRatio={groupRatio}
|
||||
groupModelDiscount={groupModelDiscount}
|
||||
currency={currency}
|
||||
tokenUnit={tokenUnit}
|
||||
displayPrice={displayPrice}
|
||||
showRatio={showRatio}
|
||||
usableGroup={usableGroup}
|
||||
autoGroups={autoGroups}
|
||||
t={t}
|
||||
/>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* 底部按钮 */}
|
||||
<div className='px-4 pb-4 pt-2'>
|
||||
<Button
|
||||
block
|
||||
theme='solid'
|
||||
onClick={onClose}
|
||||
className='!bg-gradient-to-r !from-brand-from !to-brand-to hover:!from-brand-from hover:!to-brand-to !rounded-xl !h-10 !font-medium !shadow-md !shadow-brand/20 transition-all'
|
||||
>
|
||||
{t('关闭')}
|
||||
</Button>
|
||||
</div>
|
||||
</Modal>
|
||||
</>
|
||||
)}
|
||||
</Drawer>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user