refactor(Routes): enhance page transition animations and improve Navbar styling; conditionally render user name in MainSidebar

This commit is contained in:
kangfenmao 2025-06-12 10:08:46 +08:00
parent 922e85754a
commit 8be98ccbb3
4 changed files with 11 additions and 8 deletions

View File

@ -89,18 +89,20 @@ const PageContainer = styled(motion.div)`
width: 100%; width: 100%;
height: 100%; height: 100%;
z-index: 10; z-index: 10;
will-change: transform;
backface-visibility: hidden;
` `
const pageTransition = { const pageTransition = {
type: 'tween', type: 'tween',
duration: 0.15, duration: 0.2,
ease: 'easeInOut' ease: [0.4, 0.0, 0.2, 1]
} }
const pageVariants = { const pageVariants = {
initial: { y: '100%' }, initial: { translateY: '100%' },
animate: { y: 0 }, animate: { translateY: '0%' },
exit: { y: '100%' } exit: { translateY: '100%' }
} }
export default RouteContainer export default RouteContainer

View File

@ -60,7 +60,7 @@ const CloseIcon = () => {
type="text" type="text"
onClick={() => navigate('/')} onClick={() => navigate('/')}
className="nodrag" className="nodrag"
style={{ marginRight: 2 }} style={{ marginRight: 2, marginLeft: 5 }}
icon={<CircleArrowLeft size={20} color="var(--color-icon)" style={{ marginTop: 2 }} />} icon={<CircleArrowLeft size={20} color="var(--color-icon)" style={{ marginTop: 2 }} />}
/> />
) )

View File

@ -210,7 +210,7 @@ const MainSidebar: FC = () => {
) : ( ) : (
<AvatarImg src={avatar || UserAvatar} draggable={false} className="nodrag" /> <AvatarImg src={avatar || UserAvatar} draggable={false} className="nodrag" />
)} )}
<UserMenuText>{userName}</UserMenuText> {userName && <UserMenuText>{userName}</UserMenuText>}
</UserMenuLeft> </UserMenuLeft>
<Tooltip title={t('settings.title')} mouseEnterDelay={0.8} placement="right"> <Tooltip title={t('settings.title')} mouseEnterDelay={0.8} placement="right">
<Icon theme={theme} onClick={() => navigate('/settings/provider')} className="settings-icon"> <Icon theme={theme} onClick={() => navigate('/settings/provider')} className="settings-icon">
@ -289,6 +289,7 @@ const AvatarImg = styled(Avatar)`
const UserMenuText = styled.div` const UserMenuText = styled.div`
font-size: 14px; font-size: 14px;
font-weight: 500; font-weight: 500;
margin-right: 3px;
` `
const Icon = styled.div<{ theme: string }>` const Icon = styled.div<{ theme: string }>`

View File

@ -243,7 +243,7 @@ const ProvidersList: FC = () => {
}) })
useEffect(() => { useEffect(() => {
setTimeout(() => setReady(true), 250) setTimeout(() => setReady(true), 200)
}, []) }, [])
if (!ready) { if (!ready) {