diff --git a/src/components/user-profile/views/FriendsContainerView.tsx b/src/components/user-profile/FriendsContainerView.tsx similarity index 73% rename from src/components/user-profile/views/FriendsContainerView.tsx rename to src/components/user-profile/FriendsContainerView.tsx index fda867f5..b92b82d0 100644 --- a/src/components/user-profile/views/FriendsContainerView.tsx +++ b/src/components/user-profile/FriendsContainerView.tsx @@ -1,7 +1,6 @@ import { RelationshipStatusInfoMessageParser } from '@nitrots/nitro-renderer'; import { FC } from 'react'; -import { LocalizeText } from '../../../api'; -import { Text } from '../../../common'; +import { LocalizeText } from '../../api'; import { RelationshipsContainerView } from './RelationshipsContainerView'; interface FriendsContainerViewProps @@ -16,11 +15,11 @@ export const FriendsContainerView: FC = props => return (
- +

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

+

+
+

{ LocalizeText('extendedprofile.relstatus') }

diff --git a/src/components/user-profile/views/GroupsContainerView.tsx b/src/components/user-profile/GroupsContainerView.tsx similarity index 94% rename from src/components/user-profile/views/GroupsContainerView.tsx rename to src/components/user-profile/GroupsContainerView.tsx index 3fbd224f..3ffd7874 100644 --- a/src/components/user-profile/views/GroupsContainerView.tsx +++ b/src/components/user-profile/GroupsContainerView.tsx @@ -1,9 +1,9 @@ import { GroupInformationComposer, GroupInformationEvent, GroupInformationParser, HabboGroupEntryData } from '@nitrots/nitro-renderer'; import { FC, useEffect, useState } from 'react'; -import { SendMessageComposer, ToggleFavoriteGroup } from '../../../api'; -import { AutoGrid, Column, Grid, GridProps, LayoutBadgeImageView, LayoutGridItem } from '../../../common'; -import { useMessageEvent } from '../../../hooks'; -import { GroupInformationView } from '../../groups/views/GroupInformationView'; +import { SendMessageComposer, ToggleFavoriteGroup } from '../../api'; +import { AutoGrid, Column, Grid, GridProps, LayoutBadgeImageView, LayoutGridItem } from '../../common'; +import { useMessageEvent } from '../../hooks'; +import { GroupInformationView } from '../groups/views/GroupInformationView'; interface GroupsContainerViewProps extends GridProps { diff --git a/src/components/user-profile/views/RelationshipsContainerView.tsx b/src/components/user-profile/RelationshipsContainerView.tsx similarity index 79% rename from src/components/user-profile/views/RelationshipsContainerView.tsx rename to src/components/user-profile/RelationshipsContainerView.tsx index 956232a9..7bdca660 100644 --- a/src/components/user-profile/views/RelationshipsContainerView.tsx +++ b/src/components/user-profile/RelationshipsContainerView.tsx @@ -1,7 +1,7 @@ import { RelationshipStatusEnum, RelationshipStatusInfoMessageParser } from '@nitrots/nitro-renderer'; import { FC } from 'react'; -import { GetUserProfile, LocalizeText } from '../../../api'; -import { Flex, LayoutAvatarImageView, Text } from '../../../common'; +import { GetUserProfile, LocalizeText } from '../../api'; +import { Flex, LayoutAvatarImageView } from '../../common'; interface RelationshipsContainerViewProps { @@ -27,26 +27,26 @@ export const RelationshipsContainerView: FC = p -
- - (relationshipInfo && (relationshipInfo.randomFriendId >= 1) && GetUserProfile(relationshipInfo.randomFriendId)) }> +
+
+

(relationshipInfo && (relationshipInfo.randomFriendId >= 1) && GetUserProfile(relationshipInfo.randomFriendId)) }> { (!relationshipInfo || (relationshipInfo.friendCount === 0)) && LocalizeText('extendedprofile.add.friends') } { (relationshipInfo && (relationshipInfo.friendCount >= 1)) && relationshipInfo.randomFriendName } - +

{ (relationshipInfo && (relationshipInfo.friendCount >= 1)) &&
} - - +
+

{ (!relationshipInfo || (relationshipInfo.friendCount === 0)) && LocalizeText('extendedprofile.no.friends.in.this.category') } { (relationshipInfo && (relationshipInfo.friendCount > 1)) && LocalizeText(`extendedprofile.relstatus.others.${ relationshipName }`, [ 'count' ], [ (relationshipInfo.friendCount - 1).toString() ]) }   - +

); diff --git a/src/components/user-profile/views/UserContainerView.tsx b/src/components/user-profile/UserContainerView.tsx similarity index 75% rename from src/components/user-profile/views/UserContainerView.tsx rename to src/components/user-profile/UserContainerView.tsx index 2f52674e..20d0768c 100644 --- a/src/components/user-profile/views/UserContainerView.tsx +++ b/src/components/user-profile/UserContainerView.tsx @@ -1,14 +1,11 @@ import { GetSessionDataManager, RequestFriendComposer, UserProfileParser } from '@nitrots/nitro-renderer'; import { FC, useEffect, useState } from 'react'; -import { FriendlyTime, LocalizeText, SendMessageComposer } from '../../../api'; -import { LayoutAvatarImageView, Text } from '../../../common'; +import { FriendlyTime, LocalizeText, SendMessageComposer } from '../../api'; +import { LayoutAvatarImageView, Text } from '../../common'; -interface UserContainerViewProps -{ +export const UserContainerView: FC<{ userProfile: UserProfileParser; -} - -export const UserContainerView: FC = props => +}> = props => { const { userProfile = null } = props; const [ requestSent, setRequestSent ] = useState(userProfile.requestSent); @@ -34,21 +31,21 @@ export const UserContainerView: FC = props =>
- { userProfile.username } - { userProfile.motto }  +

{ userProfile.username }

+

{ userProfile.motto }

- +

{ LocalizeText('extendedprofile.created') } { userProfile.registration } - - +

+

{ LocalizeText('extendedprofile.last.login') } { FriendlyTime.format(userProfile.secondsSinceLastVisit, '.ago', 2) } - - +

+

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

-
+
{ userProfile.isOnline && } { !userProfile.isOnline && @@ -60,11 +57,11 @@ export const UserContainerView: FC = props => <> { isOwnProfile && - { LocalizeText('extendedprofile.me') } } +

{ LocalizeText('extendedprofile.me') }

} { userProfile.isMyFriend && - { LocalizeText('extendedprofile.friend') } } +

{ LocalizeText('extendedprofile.friend') }

} { (requestSent || userProfile.requestSent) && - { LocalizeText('extendedprofile.friendrequestsent') } } +

{ LocalizeText('extendedprofile.friendrequestsent') }

} }
diff --git a/src/components/user-profile/UserProfileView.tsx b/src/components/user-profile/UserProfileView.tsx index aa21cda1..f57612be 100644 --- a/src/components/user-profile/UserProfileView.tsx +++ b/src/components/user-profile/UserProfileView.tsx @@ -1,12 +1,12 @@ import { CreateLinkEvent, ExtendedProfileChangedMessageEvent, GetSessionDataManager, RelationshipStatusInfoEvent, RelationshipStatusInfoMessageParser, RoomEngineObjectEvent, RoomObjectCategory, RoomObjectType, UserCurrentBadgesComposer, UserCurrentBadgesEvent, UserProfileEvent, UserProfileParser, UserRelationshipsComposer } from '@nitrots/nitro-renderer'; import { FC, useState } from 'react'; import { GetRoomSession, GetUserProfile, LocalizeText, SendMessageComposer } from '../../api'; -import { Column, Flex, Grid, NitroCardContentView, NitroCardHeaderView, NitroCardView, Text } from '../../common'; +import { Flex, Grid, LayoutBadgeImageView, Text } from '../../common'; import { useMessageEvent, useNitroEvent } from '../../hooks'; -import { BadgesContainerView } from './views/BadgesContainerView'; -import { FriendsContainerView } from './views/FriendsContainerView'; -import { GroupsContainerView } from './views/GroupsContainerView'; -import { UserContainerView } from './views/UserContainerView'; +import { NitroCard } from '../../layout'; +import { FriendsContainerView } from './FriendsContainerView'; +import { GroupsContainerView } from './GroupsContainerView'; +import { UserContainerView } from './UserContainerView'; export const UserProfileView: FC<{}> = props => { @@ -94,29 +94,32 @@ export const UserProfileView: FC<{}> = props => if(!userProfile) return null; return ( - - - + + + - +
- - - - - +
+ { userBadges && (userBadges.length > 0) && userBadges.map((badge, index) => ) } +
+
+
{ userRelationships && } - +
- + CreateLinkEvent(`navigator/search/hotel_view/owner:${ userProfile.username }`) }> { LocalizeText('extendedprofile.rooms') } -
-
+ + ); }; diff --git a/src/components/user-profile/views/BadgesContainerView.tsx b/src/components/user-profile/views/BadgesContainerView.tsx deleted file mode 100644 index 6c415903..00000000 --- a/src/components/user-profile/views/BadgesContainerView.tsx +++ /dev/null @@ -1,25 +0,0 @@ -import { FC } from 'react'; -import { Column, FlexProps, LayoutBadgeImageView } from '../../../common'; - -interface BadgesContainerViewProps extends FlexProps -{ - badges: string[]; -} - -export const BadgesContainerView: FC = props => -{ - const { badges = null, gap = 1, justifyContent = 'between', ...rest } = props; - - return ( - <> - { badges && (badges.length > 0) && badges.map((badge, index) => - { - return ( - - - - ); - }) } - - ); -};