diff --git a/src/components/user-profile/UserContainerView.tsx b/src/components/user-profile/UserContainerView.tsx index a6b3a00..88d3150 100644 --- a/src/components/user-profile/UserContainerView.tsx +++ b/src/components/user-profile/UserContainerView.tsx @@ -8,8 +8,11 @@ export const UserContainerView: FC<{ }> = props => { const { userProfile = null } = props; + const [ requestSent, setRequestSent ] = useState(userProfile.requestSent); + const isOwnProfile = (userProfile.id === GetSessionDataManager().userId); + const canSendFriendRequest = !requestSent && (!isOwnProfile && !userProfile.isMyFriend && !userProfile.requestSent); const infostandBackgroundClass = `background-${userProfile.backgroundId ?? 'default'}`; @@ -35,36 +38,75 @@ export const UserContainerView: FC<{
+

{ userProfile.username }

{ userProfile.motto }

+
-

-

-

- { LocalizeText('extendedprofile.friends.count') } { userProfile.friendsCount } -

+

+ +

+ +

+

{ LocalizeText('extendedprofile.achievementscore') } { userProfile.achievementPoints }

+
{ userProfile.isOnline && } + { !userProfile.isOnline && } +
{ canSendFriendRequest && - { LocalizeText('extendedprofile.addasafriend') } } + + { LocalizeText('extendedprofile.addasafriend') } + } + { !canSendFriendRequest && <> + { isOwnProfile &&

{ LocalizeText('extendedprofile.me') }

} + { userProfile.isMyFriend &&

{ LocalizeText('extendedprofile.friend') }

} + { (requestSent || userProfile.requestSent) &&

{ LocalizeText('extendedprofile.friendrequestsent') }

} } @@ -73,4 +115,4 @@ export const UserContainerView: FC<{
); -}; +}; \ No newline at end of file diff --git a/src/components/user-profile/UserProfileView.tsx b/src/components/user-profile/UserProfileView.tsx index b294346..67bb6b4 100644 --- a/src/components/user-profile/UserProfileView.tsx +++ b/src/components/user-profile/UserProfileView.tsx @@ -9,7 +9,7 @@ import { FriendsContainerView } from './FriendsContainerView'; import { GroupsContainerView } from './GroupsContainerView'; import { UserContainerView } from './UserContainerView'; -type ProfileTab = 'badge' | 'amici' | 'stanze' | 'gruppi'; +type ProfileTab = 'badge' | 'friends' | 'rooms' | 'groups'; export const UserProfileView: FC<{}> = props => { @@ -39,7 +39,7 @@ export const UserProfileView: FC<{}> = props => { setActiveTab(tab); - if(tab === 'stanze' && !userRooms && userProfile) + if(tab === 'rooms' && !userRooms && userProfile) { SendMessageComposer(new NavigatorSearchComposer('hotel_view', `owner:${ userProfile.username }`)); } @@ -99,7 +99,7 @@ export const UserProfileView: FC<{}> = props => useMessageEvent(NavigatorSearchEvent, event => { - if(!userProfile || activeTab !== 'stanze') return; + if(!userProfile || activeTab !== 'rooms') return; const parser = event.getParser(); const result = parser.result; @@ -145,16 +145,16 @@ export const UserProfileView: FC<{}> = props =>
onTabClick('badge') }> - { LocalizeText('extendedprofile.tab.badge') } + { LocalizeText('levelinfo.category.badge') } - onTabClick('amici') }> - { LocalizeText('extendedprofile.tab.friends') } + onTabClick('friends') }> + { LocalizeText('navigator.tab.3') } - onTabClick('stanze') }> - { LocalizeText('extendedprofile.tab.rooms') } + onTabClick('rooms') }> + { LocalizeText('navigator.tab.2') } - onTabClick('gruppi') }> - { LocalizeText('extendedprofile.tab.groups') } + onTabClick('groups') }> + { LocalizeText('navigator.searchcode.title.groups') }
@@ -172,7 +172,7 @@ export const UserProfileView: FC<{}> = props => }
) } - { activeTab === 'amici' && ( + { activeTab === 'friends' && (
{ userRelationships ? ( @@ -183,7 +183,7 @@ export const UserProfileView: FC<{}> = props => ) }
) } - { activeTab === 'stanze' && ( + { activeTab === 'rooms' && (
{ !userRooms && ( @@ -206,7 +206,7 @@ export const UserProfileView: FC<{}> = props => )) }
) } - { activeTab === 'gruppi' && ( + { activeTab === 'groups' && (