mirror of
https://github.com/billsonnn/nitro-react.git
synced 2024-11-23 06:40:50 +01:00
Merge branch 'dev' of https://git.krews.org/nitro/nitro-react into dev
This commit is contained in:
commit
f86b8ea287
@ -131,8 +131,11 @@ export const CatalogPurchaseWidgetView: FC<CatalogPurchaseWidgetViewProps> = pro
|
||||
{
|
||||
if(!currentOffer) return;
|
||||
|
||||
setPurchaseState(CatalogPurchaseState.NONE);
|
||||
setPurchaseOptions({ quantity: 1, extraData: '', extraParamRequired: false, previewStuffData: null });
|
||||
return () =>
|
||||
{
|
||||
setPurchaseState(CatalogPurchaseState.NONE);
|
||||
setPurchaseOptions({ quantity: 1, extraData: '', extraParamRequired: false, previewStuffData: null });
|
||||
}
|
||||
}, [ currentOffer, setPurchaseOptions ]);
|
||||
|
||||
useEffect(() =>
|
||||
|
@ -235,8 +235,6 @@ export const NavigatorView: FC<{}> = props =>
|
||||
{
|
||||
if(!isVisible || !LAST_SEARCH || !LAST_SEARCH.length) return;
|
||||
|
||||
console.log(LAST_SEARCH)
|
||||
|
||||
CreateLinkEvent(`navigator/search/${ LAST_SEARCH }`);
|
||||
}, [ isVisible ]);
|
||||
|
||||
|
@ -47,6 +47,8 @@ export const NavigatorSearchView: FC<NavigatorSearchViewProps> = props =>
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
if(!searchResult || !searchResult.data) return;
|
||||
|
||||
const searchResultDataParts = searchResult.data.split(':');
|
||||
|
||||
LAST_SEARCH = `${ topLevelContext.code }/${ searchResult.data }`;
|
||||
|
@ -71,6 +71,27 @@ export const NitropediaView: FC<{}> = props =>
|
||||
return () => element.removeEventListener(MouseEventType.MOUSE_CLICK, onClick);
|
||||
}, [ onClick, content ]);
|
||||
|
||||
useEffect(() =>
|
||||
{
|
||||
const handle = (event: MouseEvent) =>
|
||||
{
|
||||
if(!(event.target instanceof HTMLAnchorElement)) return;
|
||||
|
||||
const link = event.target.href;
|
||||
|
||||
if(!link || !link.length) return;
|
||||
|
||||
NotificationUtilities.openUrl(link);
|
||||
}
|
||||
|
||||
document.addEventListener('click', handle);
|
||||
|
||||
return () =>
|
||||
{
|
||||
document.removeEventListener('click', handle);
|
||||
}
|
||||
}, []);
|
||||
|
||||
if(!content) return null;
|
||||
|
||||
return (
|
||||
|
@ -1,5 +1,4 @@
|
||||
import { FC, MouseEvent, useEffect, useRef, useState } from 'react';
|
||||
import { RoomChatFormatter } from '../../../../api';
|
||||
import { ChatBubbleMessage } from './common/ChatBubbleMessage';
|
||||
|
||||
interface ChatWidgetMessageViewProps
|
||||
@ -14,7 +13,6 @@ export const ChatWidgetMessageView: FC<ChatWidgetMessageViewProps> = props =>
|
||||
const { chat = null, makeRoom = null, onChatClicked = null } = props;
|
||||
const [ isVisible, setIsVisible ] = useState(false);
|
||||
const elementRef = useRef<HTMLDivElement>();
|
||||
const [formatted, setFormatted] = useState(null);
|
||||
|
||||
const onMouseDown = (event: MouseEvent<HTMLDivElement>) => onChatClicked(chat);
|
||||
|
||||
@ -50,13 +48,11 @@ export const ChatWidgetMessageView: FC<ChatWidgetMessageViewProps> = props =>
|
||||
chat.visible = true;
|
||||
}
|
||||
|
||||
if(!formatted) setFormatted(RoomChatFormatter(chat.text));
|
||||
|
||||
return () =>
|
||||
{
|
||||
chat.elementRef = null;
|
||||
}
|
||||
}, [ elementRef, chat, makeRoom,formatted ]);
|
||||
}, [ elementRef, chat, makeRoom ]);
|
||||
|
||||
useEffect(() => setIsVisible(chat.visible), [ chat.visible ]);
|
||||
|
||||
@ -68,8 +64,8 @@ export const ChatWidgetMessageView: FC<ChatWidgetMessageViewProps> = props =>
|
||||
{ (chat.imageUrl && (chat.imageUrl !== '')) && <div className="user-image" style={ { backgroundImage: 'url(' + chat.imageUrl + ')' } } /> }
|
||||
</div>
|
||||
<div className="chat-content">
|
||||
<b className="username mr-1" dangerouslySetInnerHTML={ { __html: `${ chat.username }: ` } } />
|
||||
<span className="message" dangerouslySetInnerHTML={{ __html: formatted }} />
|
||||
<b className="username mr-1" dangerouslySetInnerHTML={ { __html: chat.username } } />
|
||||
<span className="message" dangerouslySetInnerHTML={{ __html: chat.formattedText }} />
|
||||
</div>
|
||||
<div className="pointer"></div>
|
||||
</div>
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { NitroPoint, RoomDragEvent } from '@nitrots/nitro-renderer';
|
||||
import { FC, useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { RoomWidgetChatSelectAvatarMessage, RoomWidgetRoomObjectMessage, RoomWidgetUpdateChatEvent } from '../../../../api';
|
||||
import { RoomChatFormatter, RoomWidgetChatSelectAvatarMessage, RoomWidgetRoomObjectMessage, RoomWidgetUpdateChatEvent } from '../../../../api';
|
||||
import { UseEventDispatcherHook, UseRoomEngineEvent } from '../../../../hooks';
|
||||
import { useRoomContext } from '../../RoomContext';
|
||||
import { ChatWidgetMessageView } from './ChatWidgetMessageView';
|
||||
@ -63,6 +63,7 @@ export const ChatWidgetView: FC<{}> = props =>
|
||||
event.userCategory,
|
||||
event.roomId,
|
||||
event.text,
|
||||
RoomChatFormatter(event.text),
|
||||
event.userName,
|
||||
new NitroPoint(event.userX, event.userY),
|
||||
event.chatType,
|
||||
|
@ -18,6 +18,7 @@ export class ChatBubbleMessage
|
||||
public senderCategory: number = -1,
|
||||
public roomId: number = -1,
|
||||
public text: string = '',
|
||||
public formattedText: string = '',
|
||||
public username: string = '',
|
||||
public location: INitroPoint = null,
|
||||
public type: number = 0,
|
||||
|
Loading…
Reference in New Issue
Block a user