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