feat: 参考原型图 ui优化提交 个人端-用户中心 相关的页面
This commit is contained in:
@@ -17,19 +17,20 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import { Menu, Button } from 'antd';
|
||||
import React, { useMemo, useContext } from 'react';
|
||||
import { Link, useLocation } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
BarChart2,
|
||||
FileText,
|
||||
CreditCard,
|
||||
LayoutGrid,
|
||||
ScrollText,
|
||||
Wallet,
|
||||
KeyRound,
|
||||
UserRound,
|
||||
Receipt,
|
||||
Gift,
|
||||
UserCog,
|
||||
ChevronLeft,
|
||||
ChevronRight,
|
||||
User,
|
||||
Activity,
|
||||
MonitorDown,
|
||||
} from 'lucide-react';
|
||||
@@ -101,13 +102,19 @@ const UserCenterSidebar = () => {
|
||||
itemKey: '/user-center/dashboard',
|
||||
configKey: 'dashboard',
|
||||
text: t('数据看板'),
|
||||
icon: BarChart2,
|
||||
icon: LayoutGrid,
|
||||
},
|
||||
{
|
||||
itemKey: '/user-center/usage-record',
|
||||
configKey: 'usageRecord',
|
||||
text: t('使用记录'),
|
||||
icon: FileText,
|
||||
icon: ScrollText,
|
||||
},
|
||||
{
|
||||
itemKey: '/user-center/key-management',
|
||||
configKey: 'keyManagement',
|
||||
text: t('密钥管理'),
|
||||
icon: KeyRound,
|
||||
},
|
||||
{
|
||||
itemKey: '/user-center/service-dashboard',
|
||||
@@ -119,7 +126,7 @@ const UserCenterSidebar = () => {
|
||||
itemKey: '/user-center/topup',
|
||||
configKey: 'topup',
|
||||
text: t('在线充值'),
|
||||
icon: CreditCard,
|
||||
icon: Wallet,
|
||||
},
|
||||
{
|
||||
itemKey: '/user-center/invoice',
|
||||
@@ -137,7 +144,7 @@ const UserCenterSidebar = () => {
|
||||
itemKey: '/user-center/settings',
|
||||
configKey: 'settings',
|
||||
text: t('个人设置'),
|
||||
icon: UserCog,
|
||||
icon: UserRound,
|
||||
},
|
||||
...(weyaiDownloadEnabled
|
||||
? [
|
||||
@@ -183,152 +190,29 @@ const UserCenterSidebar = () => {
|
||||
const selectedKey = getSelectedKey();
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`
|
||||
relative flex flex-col h-full transition-all duration-300 ease-out
|
||||
bg-white/60 dark:bg-neutral-900/60 backdrop-blur-2xl backdrop-saturate-[1.8]
|
||||
border-r border-white/40 dark:border-neutral-700/50
|
||||
shadow-[1px_0_24px_-4px_rgba(0,0,0,0.06)] dark:shadow-[1px_0_24px_-4px_rgba(0,0,0,0.3)]
|
||||
${collapsed ? 'w-[68px]' : 'w-[240px]'}
|
||||
`}
|
||||
>
|
||||
{/* 毛玻璃内层光泽 */}
|
||||
<div className='absolute inset-0 bg-gradient-to-b from-white/40 via-white/10 to-white/20 dark:from-white/[0.06] dark:via-transparent dark:to-white/[0.03] pointer-events-none' />
|
||||
{/* 顶部装饰渐变 —— 跟随品牌 */}
|
||||
<div className='absolute top-0 left-0 right-0 h-32 bg-gradient-to-b from-brand/10 to-transparent pointer-events-none' />
|
||||
|
||||
{/* Logo/标题区域 */}
|
||||
{!collapsed && (
|
||||
<div className='px-4 pt-5 pb-3'>
|
||||
<div className='flex items-center gap-2'>
|
||||
<div className='p-1.5 bg-gradient-to-br from-brand-from to-brand-to rounded-lg shadow-md shadow-brand/25'>
|
||||
<User size={16} className='text-white' />
|
||||
</div>
|
||||
<span className='font-bold text-gray-900 dark:text-white'>
|
||||
{t('用户中心')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 导航区域 */}
|
||||
<nav
|
||||
className={`relative flex-1 px-3 ${collapsed ? 'pt-4' : 'pt-2'} space-y-1.5 overflow-y-auto overflow-x-hidden`}
|
||||
<aside className='ui-user-sidebar' style={{ width: collapsed ? 64 : 216 }}>
|
||||
<Menu
|
||||
mode='inline'
|
||||
inlineCollapsed={collapsed}
|
||||
selectedKeys={[selectedKey]}
|
||||
items={items.map((item) => ({
|
||||
key: item.itemKey,
|
||||
icon: <item.icon size={16} strokeWidth={1.5} />,
|
||||
label: <Link to={item.itemKey}>{item.text}</Link>,
|
||||
}))}
|
||||
/>
|
||||
<Button
|
||||
type='text'
|
||||
className='ui-sidebar-collapse'
|
||||
onClick={toggleCollapsed}
|
||||
aria-label={collapsed ? t('展开导航') : t('收起导航')}
|
||||
icon={
|
||||
collapsed ? <ChevronRight size={16} /> : <ChevronLeft size={16} />
|
||||
}
|
||||
>
|
||||
{items.map((item) => {
|
||||
const isSelected = selectedKey === item.itemKey;
|
||||
const IconComponent = item.icon;
|
||||
|
||||
return (
|
||||
<Link
|
||||
key={item.itemKey}
|
||||
to={item.itemKey}
|
||||
className={`
|
||||
group relative flex items-center gap-3 rounded-xl transition-all duration-200
|
||||
${collapsed ? 'justify-center p-3' : 'px-3 py-2.5'}
|
||||
${
|
||||
isSelected
|
||||
? 'bg-brand/10 dark:bg-brand/15 shadow-sm shadow-brand/5'
|
||||
: 'hover:bg-brand/5 dark:hover:bg-brand/10'
|
||||
}
|
||||
`}
|
||||
>
|
||||
{/* 选中指示器 —— 统一品牌色 */}
|
||||
{isSelected && (
|
||||
<div className='absolute left-0 top-1/2 -translate-y-1/2 w-1 h-6 rounded-r-full bg-gradient-to-b from-brand-from to-brand-to' />
|
||||
)}
|
||||
|
||||
{/* 图标 —— 激活:品牌渐变实底白图标;非激活:中性底,hover 转品牌 */}
|
||||
<div
|
||||
className={`
|
||||
relative flex-shrink-0 p-1.5 rounded-lg transition-all duration-200
|
||||
${
|
||||
isSelected
|
||||
? 'bg-gradient-to-br from-brand-from to-brand-to shadow-lg shadow-brand/25'
|
||||
: 'bg-gray-100/80 dark:bg-neutral-800/80 group-hover:bg-brand/10 group-hover:scale-105'
|
||||
}
|
||||
`}
|
||||
>
|
||||
<IconComponent
|
||||
size={18}
|
||||
strokeWidth={2}
|
||||
className={
|
||||
isSelected
|
||||
? 'text-white'
|
||||
: 'text-gray-500 dark:text-gray-400 group-hover:text-brand-deep dark:group-hover:text-brand-from transition-colors'
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* 文字 —— 激活品牌色加粗,非激活中性、hover 转品牌 */}
|
||||
{!collapsed && (
|
||||
<span
|
||||
className={`
|
||||
text-sm transition-colors truncate
|
||||
${
|
||||
isSelected
|
||||
? 'text-brand-deep dark:text-brand-from font-semibold'
|
||||
: 'font-medium text-gray-600 dark:text-gray-300 group-hover:text-brand-deep dark:group-hover:text-brand-from'
|
||||
}
|
||||
`}
|
||||
>
|
||||
{item.text}
|
||||
</span>
|
||||
)}
|
||||
|
||||
{/* Tooltip for collapsed state */}
|
||||
{collapsed && (
|
||||
<div
|
||||
className='
|
||||
absolute left-full ml-2 px-2.5 py-1.5
|
||||
bg-gray-900 dark:bg-white text-white dark:text-gray-900
|
||||
text-xs font-medium rounded-lg shadow-lg
|
||||
opacity-0 invisible group-hover:opacity-100 group-hover:visible
|
||||
transition-all duration-200 whitespace-nowrap z-50
|
||||
'
|
||||
>
|
||||
{item.text}
|
||||
<div
|
||||
className='absolute left-0 top-1/2 -translate-x-1 -translate-y-1/2
|
||||
border-4 border-transparent border-r-gray-900 dark:border-r-white'
|
||||
/>
|
||||
</div>
|
||||
)}
|
||||
</Link>
|
||||
);
|
||||
})}
|
||||
</nav>
|
||||
|
||||
{/* 底部分隔线装饰 */}
|
||||
<div className='mx-4 h-px bg-gradient-to-r from-transparent via-gray-200/60 dark:via-neutral-700/60 to-transparent' />
|
||||
|
||||
{/* 底部折叠按钮 */}
|
||||
<div className='relative p-3'>
|
||||
<button
|
||||
onClick={toggleCollapsed}
|
||||
className={`
|
||||
flex items-center justify-center gap-2 w-full py-2 rounded-lg
|
||||
text-gray-500 dark:text-gray-400 text-sm font-medium
|
||||
bg-white/50 dark:bg-neutral-800/50
|
||||
border border-gray-200/40 dark:border-neutral-700/40
|
||||
hover:bg-brand/10 dark:hover:bg-brand/15
|
||||
hover:text-brand-deep dark:hover:text-brand-from
|
||||
hover:border-brand/30
|
||||
transition-all duration-200
|
||||
${collapsed ? 'px-2' : 'px-3'}
|
||||
`}
|
||||
>
|
||||
{collapsed ? (
|
||||
<ChevronRight size={16} strokeWidth={2.5} />
|
||||
) : (
|
||||
<>
|
||||
<ChevronLeft size={16} strokeWidth={2.5} />
|
||||
<span>{t('收起')}</span>
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
{!collapsed && t('收起导航')}
|
||||
</Button>
|
||||
</aside>
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user