Fix Profile Groups

This commit is contained in:
MyNameIsBatman 2021-09-06 05:10:19 -03:00
parent 3ae99e254c
commit 6f8aabbcea
3 changed files with 4 additions and 3 deletions

View File

@ -86,7 +86,7 @@ export const UserProfileView: FC = props =>
<i className="icon icon-rooms" /><span className="rooms-button">{LocalizeText('extendedprofile.rooms')}</span> <i className="icon icon-rooms" /><span className="rooms-button">{LocalizeText('extendedprofile.rooms')}</span>
</div> </div>
</div> </div>
<GroupsContainerView groups={ userProfile.groups } onLeaveGroup={ onLeaveGroup } /> <GroupsContainerView itsMe={ userProfile.id === GetSessionDataManager().userId } groups={ userProfile.groups } onLeaveGroup={ onLeaveGroup } />
</NitroCardContentView> </NitroCardContentView>
</NitroCardView> </NitroCardView>
) )

View File

@ -8,7 +8,7 @@ import { GroupsContainerViewProps } from './GroupsContainerView.types';
export const GroupsContainerView: FC<GroupsContainerViewProps> = props => export const GroupsContainerView: FC<GroupsContainerViewProps> = props =>
{ {
const { groups = null, onLeaveGroup = null } = props; const { itsMe = null, groups = null, onLeaveGroup = null } = props;
const [ selectedGroupId, setSelectedGroupId ] = useState<number>(null); const [ selectedGroupId, setSelectedGroupId ] = useState<number>(null);
const [ groupInformation, setGroupInformation ] = useState<GroupInformationParser>(null); const [ groupInformation, setGroupInformation ] = useState<GroupInformationParser>(null);
@ -50,7 +50,7 @@ export const GroupsContainerView: FC<GroupsContainerViewProps> = props =>
{ groups.map((group, index) => { groups.map((group, index) =>
{ {
return <div key={ index } onClick={ () => setSelectedGroupId(group.id) } className={ 'profile-groups-item position-relative flex-shrink-0 d-flex align-items-center justify-content-center cursor-pointer' + classNames({ ' active': selectedGroupId === group.id }) }> return <div key={ index } onClick={ () => setSelectedGroupId(group.id) } className={ 'profile-groups-item position-relative flex-shrink-0 d-flex align-items-center justify-content-center cursor-pointer' + classNames({ ' active': selectedGroupId === group.id }) }>
<i className={ 'position-absolute icon icon-group-' + (group.ownerOrFavorite ? 'favorite' : 'not-favorite') } onClick={ () => favoriteGroup(group.id) } /> { itsMe && <i className={ 'position-absolute icon icon-group-' + (group.ownerOrFavorite ? 'favorite' : 'not-favorite') } onClick={ () => favoriteGroup(group.id) } /> }
<BadgeImageView badgeCode={ group.badge } isGroup={ true } /> <BadgeImageView badgeCode={ group.badge } isGroup={ true } />
</div> </div>
}) } }) }

View File

@ -2,6 +2,7 @@ import { GroupDataParser } from '@nitrots/nitro-renderer';
export interface GroupsContainerViewProps export interface GroupsContainerViewProps
{ {
itsMe: boolean;
groups: GroupDataParser[]; groups: GroupDataParser[];
onLeaveGroup: () => void; onLeaveGroup: () => void;
} }