mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-01-18 21:36:27 +01:00
Fix Profile Groups
This commit is contained in:
parent
3ae99e254c
commit
6f8aabbcea
@ -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>
|
||||||
)
|
)
|
||||||
|
@ -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>
|
||||||
}) }
|
}) }
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user