1- import { Box , Scroll , toRem , Text , color , config } from 'folds' ;
1+ import { Box , Scroll , toRem , Text , color , config , Menu , Icon , Icons , Line , MenuItem } from 'folds' ;
22import { SquaresFour , sizedIcon } from '$components/icons/phosphor' ;
3- import {
4- Page ,
5- PageContent ,
6- PageContentCenter ,
7- PageHeroSection ,
8- PageNav ,
9- PageNavHeader ,
10- } from '$components/page' ;
3+ import { Page , PageHeroSection , PageNav , PageNavHeader } from '$components/page' ;
114import { useEffect , useState } from 'react' ;
125import { ScreenSize , useScreenSizeContext } from '$hooks/useScreenSize' ;
136import { useSetting } from '$state/hooks/settings' ;
@@ -16,13 +9,33 @@ import { SidebarResizer } from '../sidebar/SidebarResizer';
169import { useSetAtom } from 'jotai' ;
1710import { isResizingSidebarAtom } from '$state/isResizingSidebar' ;
1811import { AccountMenuOption , PresenceMenuOption } from '../sidebar/UserMenuTab' ;
19- import { UserRoomProfile } from '$components/user-profile' ;
2012import { useMatrixClient } from '$hooks/useMatrixClient' ;
21- import { UserRoomProfileRenderer } from '$components/UserRoomProfileRenderer' ;
13+ import { GlobalUserHeroName , UserHero } from '$components/user-profile/UserHero' ;
14+ import { getMxIdLocalPart , mxcUrlToHttp } from '$utils/matrix' ;
15+ import { useMediaAuthentication } from '$hooks/useMediaAuthentication' ;
16+ import { useUserPresence } from '$hooks/useUserPresence' ;
17+ import { useUserProfile } from '$hooks/useUserProfile' ;
18+ import { useOpenSettings } from '$features/settings' ;
2219
2320export function ProfileMobile ( ) {
2421 const mx = useMatrixClient ( ) ;
22+ const useAuthentication = useMediaAuthentication ( ) ;
23+ const openSettings = useOpenSettings ( ) ;
24+
2525 const userId = mx . getUserId ( ) ?? '' ;
26+ const profile = useUserProfile ( userId ) ;
27+ const presence = useUserPresence ( userId ) ;
28+
29+ const displayName = profile . displayName ?? getMxIdLocalPart ( userId ) ?? userId ;
30+ const heroAvatarUrl = profile . avatarUrl
31+ ? ( mxcUrlToHttp ( mx , profile . avatarUrl , useAuthentication , 160 , 160 , 'crop' ) ?? undefined )
32+ : undefined ;
33+
34+ const parsedBanner =
35+ typeof profile . bannerUrl === 'string' ? profile . bannerUrl . replace ( / ^ " | " $ / g, '' ) : undefined ;
36+ const heroBannerUrl = parsedBanner
37+ ? ( mxcUrlToHttp ( mx , parsedBanner , useAuthentication , 640 , 192 , 'scale' ) ?? undefined )
38+ : undefined ;
2639
2740 const setIsResizingSidebar = useSetAtom ( isResizingSidebarAtom ) ;
2841 const [ roomSidebarWidth , setRoomSidebarWidth ] = useSetting ( settingsAtom , 'roomSidebarWidth' ) ;
@@ -54,7 +67,7 @@ export function ProfileMobile() {
5467 { ! hideText ? (
5568 < Box grow = "Yes" >
5669 < Text size = "H4" truncate align = "Center" >
57- Navigate
70+ Profile
5871 </ Text >
5972 </ Box >
6073 ) : (
@@ -76,18 +89,42 @@ export function ProfileMobile() {
7689 </ Box >
7790 ) }
7891 < Page >
79- < Box grow = "Yes" >
80- < Scroll hideTrack visibility = "Hover" >
81- < PageContent style = { { height : '100%' , paddingBottom : '0' } } >
82- < PageContentCenter style = { { height : '100%' } } >
83- < PageHeroSection style = { { height : '100%' , paddingBottom : '0' } } >
84- < Box direction = "Column" gap = "700" alignItems = "Center" style = { { height : '100%' } } >
85- < PresenceMenuOption />
86- < AccountMenuOption />
92+ < Box grow = "Yes" style = { { width : '100%' , padding : '0' } } >
93+ < Scroll hideTrack visibility = "Hover" style = { { width : '100%' , padding : '0' } } >
94+ < PageHeroSection style = { { width : '100%' , padding : '0' } } >
95+ < Box direction = "Column" gap = "0" alignItems = "Center" style = { { width : '100%' } } >
96+ < Menu style = { { minWidth : '100%' } } >
97+ < UserHero
98+ userId = { userId }
99+ avatarUrl = { heroAvatarUrl }
100+ bannerUrl = { heroBannerUrl }
101+ presence = { presence }
102+ showColor = { false }
103+ allowEditing = { true }
104+ />
105+
106+ < Box style = { { padding : `0 ${ config . space . S200 } ${ config . space . S200 } ` } } >
107+ < GlobalUserHeroName displayName = { displayName } userId = { userId } />
87108 </ Box >
88- </ PageHeroSection >
89- </ PageContentCenter >
90- </ PageContent >
109+ < Line variant = "Surface" size = "300" />
110+ < PresenceMenuOption initialOpen />
111+ < AccountMenuOption />
112+
113+ < Line variant = "Surface" size = "300" />
114+
115+ < MenuItem
116+ size = "300"
117+ radii = "300"
118+ before = { < Icon size = "100" src = { Icons . Setting } /> }
119+ onClick = { ( ) => openSettings ( ) }
120+ >
121+ < Text style = { { flexGrow : 1 } } size = "T300" >
122+ Settings
123+ </ Text >
124+ </ MenuItem >
125+ </ Menu >
126+ </ Box >
127+ </ PageHeroSection >
91128 </ Scroll >
92129 </ Box >
93130 </ Page >
0 commit comments