调整修改密码入口位置
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import { Mail, Monitor, X } from 'lucide-react';
|
import { KeyRound, Mail, Monitor, X } from 'lucide-react';
|
||||||
import { createPortal } from 'react-dom';
|
import { createPortal } from 'react-dom';
|
||||||
|
|
||||||
interface PersonalCenterPanelProps {
|
interface PersonalCenterPanelProps {
|
||||||
@@ -13,8 +13,10 @@ interface PersonalCenterPanelProps {
|
|||||||
avatarText: string;
|
avatarText: string;
|
||||||
roleBadgeClassName: string;
|
roleBadgeClassName: string;
|
||||||
showDeviceManagement: boolean;
|
showDeviceManagement: boolean;
|
||||||
|
showChangePassword: boolean;
|
||||||
onOpenEmailSettings: () => void;
|
onOpenEmailSettings: () => void;
|
||||||
onOpenDeviceManagement: () => void;
|
onOpenDeviceManagement: () => void;
|
||||||
|
onOpenChangePassword: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function PersonalCenterPanel({
|
export function PersonalCenterPanel({
|
||||||
@@ -27,8 +29,10 @@ export function PersonalCenterPanel({
|
|||||||
avatarText,
|
avatarText,
|
||||||
roleBadgeClassName,
|
roleBadgeClassName,
|
||||||
showDeviceManagement,
|
showDeviceManagement,
|
||||||
|
showChangePassword,
|
||||||
onOpenEmailSettings,
|
onOpenEmailSettings,
|
||||||
onOpenDeviceManagement,
|
onOpenDeviceManagement,
|
||||||
|
onOpenChangePassword,
|
||||||
}: PersonalCenterPanelProps) {
|
}: PersonalCenterPanelProps) {
|
||||||
if (!isOpen || !mounted) return null;
|
if (!isOpen || !mounted) return null;
|
||||||
|
|
||||||
@@ -114,6 +118,25 @@ export function PersonalCenterPanel({
|
|||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
{showChangePassword && (
|
||||||
|
<button
|
||||||
|
onClick={onOpenChangePassword}
|
||||||
|
className='flex w-full items-center gap-3 rounded-2xl border border-gray-200 bg-gray-50 px-4 py-4 text-left transition-colors hover:bg-gray-100 dark:border-gray-700 dark:bg-gray-800 dark:hover:bg-gray-750'
|
||||||
|
>
|
||||||
|
<div className='flex h-12 w-12 items-center justify-center rounded-xl bg-amber-100 text-amber-600 dark:bg-amber-900/30 dark:text-amber-300'>
|
||||||
|
<KeyRound className='w-6 h-6' />
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div className='text-base font-semibold text-gray-900 dark:text-gray-100'>
|
||||||
|
修改密码
|
||||||
|
</div>
|
||||||
|
<div className='mt-1 text-sm text-gray-500 dark:text-gray-400'>
|
||||||
|
修改当前账号密码
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import {
|
|||||||
Gauge,
|
Gauge,
|
||||||
Globe,
|
Globe,
|
||||||
Home,
|
Home,
|
||||||
KeyRound,
|
|
||||||
LogOut,
|
LogOut,
|
||||||
MessageSquare,
|
MessageSquare,
|
||||||
Monitor,
|
Monitor,
|
||||||
@@ -1615,17 +1614,6 @@ export const UserMenu: React.FC = () => {
|
|||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{/* 修改密码按钮 */}
|
|
||||||
{showChangePassword && (
|
|
||||||
<button
|
|
||||||
onClick={handleChangePassword}
|
|
||||||
className='w-full px-3 py-2 text-left flex items-center gap-2.5 text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors text-sm'
|
|
||||||
>
|
|
||||||
<KeyRound className='w-4 h-4 text-gray-500 dark:text-gray-400' />
|
|
||||||
<span className='font-medium'>修改密码</span>
|
|
||||||
</button>
|
|
||||||
)}
|
|
||||||
|
|
||||||
{/* 订阅按钮 */}
|
{/* 订阅按钮 */}
|
||||||
{subscribeEnabled && (
|
{subscribeEnabled && (
|
||||||
<button
|
<button
|
||||||
@@ -3749,6 +3737,7 @@ export const UserMenu: React.FC = () => {
|
|||||||
avatarText={avatarText}
|
avatarText={avatarText}
|
||||||
roleBadgeClassName={roleBadgeClassName}
|
roleBadgeClassName={roleBadgeClassName}
|
||||||
showDeviceManagement={storageType !== 'localstorage'}
|
showDeviceManagement={storageType !== 'localstorage'}
|
||||||
|
showChangePassword={showChangePassword}
|
||||||
onOpenEmailSettings={() => {
|
onOpenEmailSettings={() => {
|
||||||
setIsProfileCenterOpen(false);
|
setIsProfileCenterOpen(false);
|
||||||
setIsEmailSettingsOpen(true);
|
setIsEmailSettingsOpen(true);
|
||||||
@@ -3759,6 +3748,10 @@ export const UserMenu: React.FC = () => {
|
|||||||
setIsDeviceManagementOpen(true);
|
setIsDeviceManagementOpen(true);
|
||||||
loadDevices();
|
loadDevices();
|
||||||
}}
|
}}
|
||||||
|
onOpenChangePassword={() => {
|
||||||
|
setIsProfileCenterOpen(false);
|
||||||
|
handleChangePassword();
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* 使用 Portal 将设置面板渲染到 document.body */}
|
{/* 使用 Portal 将设置面板渲染到 document.body */}
|
||||||
|
|||||||
Reference in New Issue
Block a user