mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-01-19 05:46:27 +01:00
Fix profile links
This commit is contained in:
parent
d39b4e6e57
commit
9638dbdd1e
@ -8,6 +8,7 @@ import { dispatchUiEvent } from '../../../../hooks/events';
|
|||||||
import { SendMessageHook } from '../../../../hooks/messages';
|
import { SendMessageHook } from '../../../../hooks/messages';
|
||||||
import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../layout';
|
import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../../../layout';
|
||||||
import { BadgeImageView } from '../../../shared/badge-image/BadgeImageView';
|
import { BadgeImageView } from '../../../shared/badge-image/BadgeImageView';
|
||||||
|
import { UserProfileIconView } from '../../../shared/user-profile-icon/UserProfileIconView';
|
||||||
import { useNavigatorContext } from '../../context/NavigatorContext';
|
import { useNavigatorContext } from '../../context/NavigatorContext';
|
||||||
import { NavigatorActions } from '../../reducers/NavigatorReducer';
|
import { NavigatorActions } from '../../reducers/NavigatorReducer';
|
||||||
import { NavigatorRoomInfoViewProps } from './NavigatorRoomInfoView.types';
|
import { NavigatorRoomInfoViewProps } from './NavigatorRoomInfoView.types';
|
||||||
@ -110,7 +111,7 @@ export const NavigatorRoomInfoView: FC<NavigatorRoomInfoViewProps> = props =>
|
|||||||
{ roomInfoData.enteredGuestRoom.showOwner && <>
|
{ roomInfoData.enteredGuestRoom.showOwner && <>
|
||||||
<div className="fw-bold text-muted me-1">{ LocalizeText('navigator.roomownercaption') }</div>
|
<div className="fw-bold text-muted me-1">{ LocalizeText('navigator.roomownercaption') }</div>
|
||||||
<div className="d-flex align-items-center cursor-pointer">
|
<div className="d-flex align-items-center cursor-pointer">
|
||||||
<i className="icon icon-user-profile me-1" />
|
<UserProfileIconView userId={ roomInfoData.enteredGuestRoom.ownerId } />
|
||||||
<div>{ roomInfoData.enteredGuestRoom.ownerName }</div>
|
<div>{ roomInfoData.enteredGuestRoom.ownerName }</div>
|
||||||
</div>
|
</div>
|
||||||
</> }
|
</> }
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { RoomControllerLevel, RoomObjectCategory, RoomObjectVariable } from '@nitrots/nitro-renderer';
|
import { RoomControllerLevel, RoomObjectCategory, RoomObjectVariable, UserProfileComposer } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback, useEffect, useMemo, useState } from 'react';
|
import { FC, useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { GetOwnRoomObject, LocalizeText, RoomWidgetMessage, RoomWidgetUserActionMessage } from '../../../../../../api';
|
import { GetOwnRoomObject, LocalizeText, RoomWidgetMessage, RoomWidgetUserActionMessage } from '../../../../../../api';
|
||||||
|
import { SendMessageHook } from '../../../../../../hooks';
|
||||||
import { useRoomContext } from '../../../../context/RoomContext';
|
import { useRoomContext } from '../../../../context/RoomContext';
|
||||||
import { ContextMenuView } from '../../../context-menu/ContextMenuView';
|
import { ContextMenuView } from '../../../context-menu/ContextMenuView';
|
||||||
import { ContextMenuHeaderView } from '../../../context-menu/views/header/ContextMenuHeaderView';
|
import { ContextMenuHeaderView } from '../../../context-menu/views/header/ContextMenuHeaderView';
|
||||||
@ -191,9 +192,14 @@ export const AvatarInfoWidgetAvatarView: FC<AvatarInfoWidgetAvatarViewProps> = p
|
|||||||
return flag;
|
return flag;
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
const openProfile = useCallback(() =>
|
||||||
|
{
|
||||||
|
SendMessageHook(new UserProfileComposer(userData.webID));
|
||||||
|
}, [ userData ]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ContextMenuView objectId={ userData.roomIndex } category={ RoomObjectCategory.UNIT } userType={ userData.userType } close={ close }>
|
<ContextMenuView objectId={ userData.roomIndex } category={ RoomObjectCategory.UNIT } userType={ userData.userType } close={ close }>
|
||||||
<ContextMenuHeaderView>
|
<ContextMenuHeaderView className="cursor-pointer" onClick={ () => openProfile() }>
|
||||||
{ userData.name }
|
{ userData.name }
|
||||||
</ContextMenuHeaderView>
|
</ContextMenuHeaderView>
|
||||||
{ (mode === MODE_NORMAL) &&
|
{ (mode === MODE_NORMAL) &&
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import { AvatarAction, AvatarExpressionEnum, RoomObjectCategory } from '@nitrots/nitro-renderer';
|
import { AvatarAction, AvatarExpressionEnum, RoomObjectCategory, UserProfileComposer } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback, useState } from 'react';
|
import { FC, useCallback, useState } from 'react';
|
||||||
import { GetCanStandUp, GetCanUseExpression, GetOwnPosture, HasHabboClub, HasHabboVip, IsRidingHorse, LocalizeText, RoomWidgetAvatarExpressionMessage, RoomWidgetChangePostureMessage, RoomWidgetDanceMessage, RoomWidgetMessage, RoomWidgetUserActionMessage } from '../../../../../../api';
|
import { GetCanStandUp, GetCanUseExpression, GetOwnPosture, HasHabboClub, HasHabboVip, IsRidingHorse, LocalizeText, RoomWidgetAvatarExpressionMessage, RoomWidgetChangePostureMessage, RoomWidgetDanceMessage, RoomWidgetMessage, RoomWidgetUserActionMessage } from '../../../../../../api';
|
||||||
import { AvatarEditorEvent } from '../../../../../../events';
|
import { AvatarEditorEvent } from '../../../../../../events';
|
||||||
import { dispatchUiEvent } from '../../../../../../hooks';
|
import { dispatchUiEvent, SendMessageHook } from '../../../../../../hooks';
|
||||||
import { CurrencyIcon } from '../../../../../shared/currency-icon/CurrencyIcon';
|
import { CurrencyIcon } from '../../../../../shared/currency-icon/CurrencyIcon';
|
||||||
import { useRoomContext } from '../../../../context/RoomContext';
|
import { useRoomContext } from '../../../../context/RoomContext';
|
||||||
import { ContextMenuView } from '../../../context-menu/ContextMenuView';
|
import { ContextMenuView } from '../../../context-menu/ContextMenuView';
|
||||||
@ -103,11 +103,16 @@ export const AvatarInfoWidgetOwnAvatarView: FC<AvatarInfoWidgetOwnAvatarViewProp
|
|||||||
if(hideMenu) close();
|
if(hideMenu) close();
|
||||||
}, [ roomSession, widgetHandler, userData, setIsDecorating, close ]);
|
}, [ roomSession, widgetHandler, userData, setIsDecorating, close ]);
|
||||||
|
|
||||||
|
const openProfile = useCallback(() =>
|
||||||
|
{
|
||||||
|
SendMessageHook(new UserProfileComposer(userData.webID));
|
||||||
|
}, [ userData ]);
|
||||||
|
|
||||||
const isRidingHorse = IsRidingHorse();
|
const isRidingHorse = IsRidingHorse();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ContextMenuView objectId={ userData.roomIndex } category={ RoomObjectCategory.UNIT } userType={ userData.userType } close={ close }>
|
<ContextMenuView objectId={ userData.roomIndex } category={ RoomObjectCategory.UNIT } userType={ userData.userType } close={ close }>
|
||||||
<ContextMenuHeaderView>
|
<ContextMenuHeaderView className="cursor-pointer" onClick={ () => openProfile() }>
|
||||||
{ userData.name }
|
{ userData.name }
|
||||||
</ContextMenuHeaderView>
|
</ContextMenuHeaderView>
|
||||||
{ (mode === MODE_NORMAL) &&
|
{ (mode === MODE_NORMAL) &&
|
||||||
|
@ -3,10 +3,10 @@ import { ContextMenuHeaderViewProps } from './ContextMenuHeaderView.types';
|
|||||||
|
|
||||||
export const ContextMenuHeaderView: FC<ContextMenuHeaderViewProps> = props =>
|
export const ContextMenuHeaderView: FC<ContextMenuHeaderViewProps> = props =>
|
||||||
{
|
{
|
||||||
const { children = null } = props;
|
const { className = null, onClick = null, children = null } = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="d-flex justify-content-center align-items-center menu-header p-1">
|
<div className={ 'd-flex justify-content-center align-items-center menu-header p-1' + (className ? ' ' + className : '') } onClick={ onClick }>
|
||||||
{ children }
|
{ children }
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
export interface ContextMenuHeaderViewProps
|
export interface ContextMenuHeaderViewProps
|
||||||
{
|
{
|
||||||
|
className?: string;
|
||||||
|
onClick?: (e) => void;
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
import { CrackableDataType, RoomControllerLevel, RoomObjectCategory, RoomObjectVariable, RoomWidgetEnumItemExtradataParameter, RoomWidgetFurniInfoUsagePolicyEnum, SetObjectDataMessageComposer, StringDataType } from '@nitrots/nitro-renderer';
|
import { CrackableDataType, RoomControllerLevel, RoomObjectCategory, RoomObjectVariable, RoomWidgetEnumItemExtradataParameter, RoomWidgetFurniInfoUsagePolicyEnum, SetObjectDataMessageComposer, StringDataType, UserProfileComposer } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback, useEffect, useState } from 'react';
|
import { FC, useCallback, useEffect, useState } from 'react';
|
||||||
import { CreateLinkEvent, GetRoomEngine, LocalizeText, RoomWidgetFurniActionMessage } from '../../../../../../api';
|
import { CreateLinkEvent, GetRoomEngine, LocalizeText, RoomWidgetFurniActionMessage } from '../../../../../../api';
|
||||||
import { SendMessageHook } from '../../../../../../hooks';
|
import { SendMessageHook } from '../../../../../../hooks';
|
||||||
import { BadgeImageView } from '../../../../../shared/badge-image/BadgeImageView';
|
import { BadgeImageView } from '../../../../../shared/badge-image/BadgeImageView';
|
||||||
import { LimitedEditionCompactPlateView } from '../../../../../shared/limited-edition/compact-plate/LimitedEditionCompactPlateView';
|
import { LimitedEditionCompactPlateView } from '../../../../../shared/limited-edition/compact-plate/LimitedEditionCompactPlateView';
|
||||||
import { RarityLevelView } from '../../../../../shared/rarity-level/RarityLevelView';
|
import { RarityLevelView } from '../../../../../shared/rarity-level/RarityLevelView';
|
||||||
|
import { UserProfileIconView } from '../../../../../shared/user-profile-icon/UserProfileIconView';
|
||||||
import { useRoomContext } from '../../../../context/RoomContext';
|
import { useRoomContext } from '../../../../context/RoomContext';
|
||||||
import { InfoStandBaseView } from '../base/InfoStandBaseView';
|
import { InfoStandBaseView } from '../base/InfoStandBaseView';
|
||||||
import { InfoStandWidgetFurniViewProps } from './InfoStandWidgetFurniView.types';
|
import { InfoStandWidgetFurniViewProps } from './InfoStandWidgetFurniView.types';
|
||||||
@ -222,6 +223,11 @@ export const InfoStandWidgetFurniView: FC<InfoStandWidgetFurniViewProps> = props
|
|||||||
widgetHandler.processWidgetMessage(new RoomWidgetFurniActionMessage(messageType, furniData.id, furniData.category, furniData.purchaseOfferId, objectData));
|
widgetHandler.processWidgetMessage(new RoomWidgetFurniActionMessage(messageType, furniData.id, furniData.category, furniData.purchaseOfferId, objectData));
|
||||||
}, [ widgetHandler, furniData, pickupMode, customKeys, customValues, getFurniSettingsAsString ]);
|
}, [ widgetHandler, furniData, pickupMode, customKeys, customValues, getFurniSettingsAsString ]);
|
||||||
|
|
||||||
|
const openProfile = useCallback(() =>
|
||||||
|
{
|
||||||
|
SendMessageHook(new UserProfileComposer(furniData.ownerId));
|
||||||
|
}, [ furniData ]);
|
||||||
|
|
||||||
if(!furniData) return null;
|
if(!furniData) return null;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@ -243,7 +249,7 @@ export const InfoStandWidgetFurniView: FC<InfoStandWidgetFurniViewProps> = props
|
|||||||
<div className="small text-wrap">{ furniData.description }</div>
|
<div className="small text-wrap">{ furniData.description }</div>
|
||||||
<hr className="m-0 my-1" />
|
<hr className="m-0 my-1" />
|
||||||
<div className="d-flex align-items-center">
|
<div className="d-flex align-items-center">
|
||||||
<i className="icon icon-user-profile me-1 cursor-pointer" />
|
<UserProfileIconView userId={ furniData.ownerId } />
|
||||||
<div className="small text-wrap">{ LocalizeText('furni.owner', [ 'name' ], [ furniData.ownerName ]) }</div>
|
<div className="small text-wrap">{ LocalizeText('furni.owner', [ 'name' ], [ furniData.ownerName ]) }</div>
|
||||||
</div>
|
</div>
|
||||||
{ (furniData.purchaseOfferId > 0) && <button type="button" className="btn btn-primary btn-sm mt-1" onClick={ event => processButtonAction('buy_one') }>{ LocalizeText('infostand.button.buy') }</button> }
|
{ (furniData.purchaseOfferId > 0) && <button type="button" className="btn btn-primary btn-sm mt-1" onClick={ event => processButtonAction('buy_one') }>{ LocalizeText('infostand.button.buy') }</button> }
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { FC } from 'react';
|
import { FC } from 'react';
|
||||||
import { LocalizeText } from '../../../../../../api';
|
import { LocalizeText } from '../../../../../../api';
|
||||||
import { PetImageView } from '../../../../../shared/pet-image/PetImageView';
|
import { PetImageView } from '../../../../../shared/pet-image/PetImageView';
|
||||||
|
import { UserProfileIconView } from '../../../../../shared/user-profile-icon/UserProfileIconView';
|
||||||
import { InfoStandBaseView } from '../base/InfoStandBaseView';
|
import { InfoStandBaseView } from '../base/InfoStandBaseView';
|
||||||
import { InfoStandWidgetPetViewProps } from './InfoStandWidgetPetView.types';
|
import { InfoStandWidgetPetViewProps } from './InfoStandWidgetPetView.types';
|
||||||
|
|
||||||
@ -46,7 +47,7 @@ export const InfoStandWidgetPetView: FC<InfoStandWidgetPetViewProps> = props =>
|
|||||||
<div className="small text-wrap">{ LocalizeText('pet.age', ['age'], [petData.age.toString()]) }</div>
|
<div className="small text-wrap">{ LocalizeText('pet.age', ['age'], [petData.age.toString()]) }</div>
|
||||||
<hr className="m-0 my-1" />
|
<hr className="m-0 my-1" />
|
||||||
<div className="d-flex align-items-center">
|
<div className="d-flex align-items-center">
|
||||||
<i className="icon icon-user-profile me-1 cursor-pointer" />
|
<UserProfileIconView userId={ petData.ownerId } />
|
||||||
<div className="small text-wrap">{ LocalizeText('infostand.text.petowner', ['name'], [petData.ownerName]) }</div>
|
<div className="small text-wrap">{ LocalizeText('infostand.text.petowner', ['name'], [petData.ownerName]) }</div>
|
||||||
</div>
|
</div>
|
||||||
</InfoStandBaseView>
|
</InfoStandBaseView>
|
||||||
|
@ -4,6 +4,7 @@ import { LocalizeText } from '../../../../../../api';
|
|||||||
import { SendMessageHook } from '../../../../../../hooks/messages';
|
import { SendMessageHook } from '../../../../../../hooks/messages';
|
||||||
import { AvatarImageView } from '../../../../../shared/avatar-image/AvatarImageView';
|
import { AvatarImageView } from '../../../../../shared/avatar-image/AvatarImageView';
|
||||||
import { BadgeImageView } from '../../../../../shared/badge-image/BadgeImageView';
|
import { BadgeImageView } from '../../../../../shared/badge-image/BadgeImageView';
|
||||||
|
import { UserProfileIconView } from '../../../../../shared/user-profile-icon/UserProfileIconView';
|
||||||
import { BotSkillsEnum } from '../../../avatar-info/common/BotSkillsEnum';
|
import { BotSkillsEnum } from '../../../avatar-info/common/BotSkillsEnum';
|
||||||
import { InfoStandBaseView } from '../base/InfoStandBaseView';
|
import { InfoStandBaseView } from '../base/InfoStandBaseView';
|
||||||
import { InfoStandWidgetRentableBotViewProps } from './InfoStandWidgetRentableBotView.types';
|
import { InfoStandWidgetRentableBotViewProps } from './InfoStandWidgetRentableBotView.types';
|
||||||
@ -46,7 +47,7 @@ export const InfoStandWidgetRentableBotView: FC<InfoStandWidgetRentableBotViewPr
|
|||||||
<div className="motto-content small">{ rentableBotData.motto }</div>
|
<div className="motto-content small">{ rentableBotData.motto }</div>
|
||||||
<hr className="m-0 my-1" />
|
<hr className="m-0 my-1" />
|
||||||
<div className="d-flex align-items-center">
|
<div className="d-flex align-items-center">
|
||||||
<i className="icon icon-user-profile me-1 cursor-pointer" />
|
<UserProfileIconView userId={ rentableBotData.ownerId } />
|
||||||
<div className="small text-wrap">{ LocalizeText('infostand.text.botowner', [ 'name' ], [ rentableBotData.ownerName ]) }</div>
|
<div className="small text-wrap">{ LocalizeText('infostand.text.botowner', [ 'name' ], [ rentableBotData.ownerName ]) }</div>
|
||||||
</div>
|
</div>
|
||||||
{ (rentableBotData.carryItem > 0) &&
|
{ (rentableBotData.carryItem > 0) &&
|
||||||
|
@ -5,6 +5,7 @@ import { CreateMessageHook, SendMessageHook } from '../../../../../../hooks';
|
|||||||
import { CreateEventDispatcherHook } from '../../../../../../hooks/events';
|
import { CreateEventDispatcherHook } from '../../../../../../hooks/events';
|
||||||
import { AvatarImageView } from '../../../../../shared/avatar-image/AvatarImageView';
|
import { AvatarImageView } from '../../../../../shared/avatar-image/AvatarImageView';
|
||||||
import { BadgeImageView } from '../../../../../shared/badge-image/BadgeImageView';
|
import { BadgeImageView } from '../../../../../shared/badge-image/BadgeImageView';
|
||||||
|
import { UserProfileIconView } from '../../../../../shared/user-profile-icon/UserProfileIconView';
|
||||||
import { RelationshipsContainerView } from '../../../../../user-profile/views/relationships-container/RelationshipsContainerView';
|
import { RelationshipsContainerView } from '../../../../../user-profile/views/relationships-container/RelationshipsContainerView';
|
||||||
import { useRoomContext } from '../../../../context/RoomContext';
|
import { useRoomContext } from '../../../../context/RoomContext';
|
||||||
import { InfoStandWidgetUserViewProps } from './InfoStandWidgetUserView.types';
|
import { InfoStandWidgetUserViewProps } from './InfoStandWidgetUserView.types';
|
||||||
@ -81,7 +82,10 @@ export const InfoStandWidgetUserView: FC<InfoStandWidgetUserViewProps> = props =
|
|||||||
<div className="d-flex flex-column nitro-card nitro-infostand rounded">
|
<div className="d-flex flex-column nitro-card nitro-infostand rounded">
|
||||||
<div className="container-fluid content-area">
|
<div className="container-fluid content-area">
|
||||||
<div className="d-flex justify-content-between align-items-center">
|
<div className="d-flex justify-content-between align-items-center">
|
||||||
<div className="small text-wrap">{ userData.name }</div>
|
<div className="small text-wrap">
|
||||||
|
<UserProfileIconView userId={ userData.webID } />
|
||||||
|
{ userData.name }
|
||||||
|
</div>
|
||||||
<i className="fas fa-times cursor-pointer" onClick={ close }></i>
|
<i className="fas fa-times cursor-pointer" onClick={ close }></i>
|
||||||
</div>
|
</div>
|
||||||
<hr className="m-0 my-1" />
|
<hr className="m-0 my-1" />
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
|
import { UserProfileComposer } from '@nitrots/nitro-renderer';
|
||||||
import { FC, useCallback } from 'react';
|
import { FC, useCallback } from 'react';
|
||||||
|
import { SendMessageHook } from '../../../hooks';
|
||||||
import { UserProfileIconViewProps } from './UserProfileIconView.types';
|
import { UserProfileIconViewProps } from './UserProfileIconView.types';
|
||||||
|
|
||||||
export const UserProfileIconView: FC<UserProfileIconViewProps> = props =>
|
export const UserProfileIconView: FC<UserProfileIconViewProps> = props =>
|
||||||
{
|
{
|
||||||
const { userId = -1, userName = null } = props;
|
const { userId = 0, userName = null } = props;
|
||||||
|
|
||||||
const visitProfile = useCallback(() =>
|
const visitProfile = useCallback(() =>
|
||||||
{
|
{
|
||||||
|
if(userId) SendMessageHook(new UserProfileComposer(userId));
|
||||||
|
}, [ userId ]);
|
||||||
|
|
||||||
}, [ userId, userName ]);
|
return (<>
|
||||||
|
|
||||||
return (
|
|
||||||
<i className="icon icon-user-profile me-1 cursor-pointer" onClick={ visitProfile } />
|
<i className="icon icon-user-profile me-1 cursor-pointer" onClick={ visitProfile } />
|
||||||
);
|
</>);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user