🎨 feat(ui): enhance pricing components with improved icons and responsive design

- Replace copy button icon from semi-ui IconCopy to lucide-react Copy in PricingCardView
- Add conditional tooltip functionality to SelectableButtonGroup that only shows when text overflows
- Implement responsive table column behavior in PricingTableColumns with mobile-aware fixed positioning
- Use DOM-based overflow detection (scrollWidth vs clientWidth) for better performance
- Apply useIsMobile hook to conditionally set fixed: 'right' only on desktop devices

These changes improve user experience across different screen sizes and provide more consistent iconography throughout the pricing interface.
This commit is contained in:
t0ng7u
2025-08-29 22:36:05 +08:00
parent 64058614cb
commit 7826099221
15 changed files with 207 additions and 62 deletions

View File

@@ -92,7 +92,7 @@ const PricingCardSkeleton = ({
size="small"
style={{
width: 64,
height: 20,
height: 18,
borderRadius: 10
}}
/>

View File

@@ -19,7 +19,8 @@ For commercial licensing, please contact support@quantumnous.com
import React from 'react';
import { Card, Tag, Tooltip, Checkbox, Empty, Pagination, Button, Avatar } from '@douyinfe/semi-ui';
import { IconHelpCircle, IconCopy } from '@douyinfe/semi-icons';
import { IconHelpCircle } from '@douyinfe/semi-icons';
import { Copy } from 'lucide-react';
import { IllustrationNoResult, IllustrationNoResultDark } from '@douyinfe/semi-illustrations';
import { stringToColor, calculateModelPrice, formatPriceInfo, getLobeHubIcon } from '../../../../../helpers';
import PricingCardSkeleton from './PricingCardSkeleton';
@@ -245,7 +246,7 @@ const PricingCardView = ({
size="small"
theme="outline"
type="tertiary"
icon={<IconCopy />}
icon={<Copy size={12} />}
onClick={(e) => {
e.stopPropagation();
copyText(model.model_name);

View File

@@ -38,7 +38,6 @@ const PricingTable = ({
setIsModalOpenurl,
currency,
tokenUnit,
setTokenUnit,
displayPrice,
searchValue,
showRatio,
@@ -99,7 +98,6 @@ const PricingTable = ({
dataSource={filteredModels}
loading={loading}
rowSelection={rowSelection}
className="custom-table"
scroll={compactMode ? undefined : { x: 'max-content' }}
onRow={(record) => ({
onClick: () => openModelDetail && openModelDetail(record),
@@ -114,7 +112,7 @@ const PricingTable = ({
/>
}
pagination={{
defaultPageSize: 100,
defaultPageSize: 20,
pageSize: pageSize,
showSizeChanger: true,
pageSizeOptions: [10, 20, 50, 100],

View File

@@ -22,6 +22,7 @@ import { Tag, Space, Tooltip } from '@douyinfe/semi-ui';
import { IconHelpCircle } from '@douyinfe/semi-icons';
import { renderModelTag, stringToColor, calculateModelPrice, getLobeHubIcon } from '../../../../../helpers';
import { renderLimitedItems, renderDescription } from '../../../../common/ui/RenderUtils';
import { useIsMobile } from '../../../../../hooks/common/useIsMobile';
function renderQuotaType(type, t) {
switch (type) {
@@ -98,7 +99,7 @@ export const getPricingTableColumns = ({
displayPrice,
showRatio,
}) => {
const isMobile = useIsMobile();
const priceDataCache = new WeakMap();
const getPriceData = (record) => {
@@ -207,7 +208,7 @@ export const getPricingTableColumns = ({
const priceColumn = {
title: t('模型价格'),
dataIndex: 'model_price',
fixed: 'right',
...(isMobile ? {} : { fixed: 'right' }),
render: (text, record, index) => {
const priceData = getPriceData(record);
@@ -215,10 +216,10 @@ export const getPricingTableColumns = ({
return (
<div className="space-y-1">
<div className="text-gray-700">
{t('提示')} {priceData.inputPrice} / 1{priceData.unitLabel} tokens
{t('输入')} {priceData.inputPrice} / 1{priceData.unitLabel} tokens
</div>
<div className="text-gray-700">
{t('补全')} {priceData.completionPrice} / 1{priceData.unitLabel} tokens
{t('输出')} {priceData.completionPrice} / 1{priceData.unitLabel} tokens
</div>
</div>
);