mirror of
https://github.com/billsonnn/nitro-react.git
synced 2025-01-18 13:26:27 +01:00
Cleaned up unnecessary lines
This commit is contained in:
parent
e5c782a149
commit
2f69e5f2ae
@ -1,8 +1,8 @@
|
||||
import { GuideSessionGetRequesterRoomMessageComposer, GuideSessionInviteRequesterMessageComposer, GuideSessionMessageMessageComposer, GuideSessionMessageMessageEvent, GuideSessionRequesterRoomMessageEvent, GuideSessionResolvedMessageComposer } from '@nitrots/nitro-renderer';
|
||||
import { GuideSessionGetRequesterRoomMessageComposer, GuideSessionInviteRequesterMessageComposer, GuideSessionMessageMessageComposer, GuideSessionRequesterRoomMessageEvent, GuideSessionResolvedMessageComposer } from '@nitrots/nitro-renderer';
|
||||
import { FC, KeyboardEvent, useCallback, useEffect, useRef, useState } from 'react';
|
||||
import { ChatEntryType, ChatHistoryCurrentDate, GetSessionDataManager, GuideToolMessageGroup, LocalizeText, ReportType, SendMessageComposer, TryVisitRoom } from '../../../api';
|
||||
import { GetSessionDataManager, GuideToolMessageGroup, LocalizeText, ReportType, SendMessageComposer, TryVisitRoom } from '../../../api';
|
||||
import { Base, Button, ButtonGroup, Column, Flex, LayoutAvatarImageView, Text } from '../../../common';
|
||||
import { useChatHistory, useHelp, useMessageEvent, useRoom } from '../../../hooks';
|
||||
import { useHelp, useMessageEvent } from '../../../hooks';
|
||||
|
||||
interface GuideToolOngoingViewProps
|
||||
{
|
||||
@ -21,8 +21,6 @@ export const GuideToolOngoingView: FC<GuideToolOngoingViewProps> = props =>
|
||||
const { isGuide = false, userId = 0, userName = null, userFigure = null, isTyping = false, messageGroups = [] } = props;
|
||||
|
||||
const [ messageText, setMessageText ] = useState<string>('');
|
||||
const { addMessengerEntry } = useChatHistory();
|
||||
const { roomSession = null } = useRoom();
|
||||
const { report = null } = useHelp();
|
||||
|
||||
useEffect(() =>
|
||||
@ -53,13 +51,6 @@ export const GuideToolOngoingView: FC<GuideToolOngoingViewProps> = props =>
|
||||
TryVisitRoom(parser.requesterRoomId);
|
||||
});
|
||||
|
||||
useMessageEvent<GuideSessionMessageMessageEvent>(GuideSessionMessageMessageEvent, event =>
|
||||
{
|
||||
const parser = event.getParser();
|
||||
|
||||
addMessengerEntry({ id: -1, webId: parser.senderId, entityId: -1, name: userName, timestamp: ChatHistoryCurrentDate(), type: ChatEntryType.TYPE_IM, roomId: !roomSession ? 0 : roomSession.roomId, message: parser.chatMessage });
|
||||
});
|
||||
|
||||
const sendMessage = useCallback(() =>
|
||||
{
|
||||
if(!messageText || !messageText.length) return;
|
||||
|
@ -14,7 +14,6 @@ export const ReportSummaryView: FC<{}> = props =>
|
||||
|
||||
switch(activeReport.reportType)
|
||||
{
|
||||
|
||||
case ReportType.BULLY:
|
||||
case ReportType.EMERGENCY:
|
||||
case ReportType.ROOM: {
|
||||
@ -40,9 +39,7 @@ export const ReportSummaryView: FC<{}> = props =>
|
||||
SendMessageComposer(new CallForHelpFromPhotoMessageComposer(activeReport.extraData, activeReport.cfhTopic, activeReport.roomId, GetSessionDataManager().userId, activeReport.roomObjectId));
|
||||
break;
|
||||
case ReportType.GUIDE:
|
||||
activeReport.reportedChats.forEach(entry => chats.push(entry.webId, entry.message));
|
||||
|
||||
SendMessageComposer(new GuideSessionReportMessageComposer(activeReport.message));
|
||||
SendMessageComposer(new GuideSessionReportMessageComposer(''));
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,6 @@ export const SelectReportedChatsView: FC<{}> = props =>
|
||||
case ReportType.EMERGENCY:
|
||||
return chatHistory.filter(chat => (chat.type === ChatEntryType.TYPE_CHAT) && (chat.webId === activeReport.reportedUserId) && (chat.entityType === RoomObjectType.USER));
|
||||
case ReportType.IM:
|
||||
case ReportType.GUIDE:
|
||||
return messengerHistory.filter(chat => (chat.webId === activeReport.reportedUserId) && (chat.type === ChatEntryType.TYPE_IM));
|
||||
}
|
||||
|
||||
|
@ -98,7 +98,7 @@ const useChatHistoryState = () =>
|
||||
addMessengerEntry({ id: -1, webId: parser.senderId, entityId: -1, name: '', message: parser.messageText, roomId: -1, timestamp: MessengerHistoryCurrentDate(), type: ChatEntryType.TYPE_IM });
|
||||
});
|
||||
|
||||
return { addChatEntry, chatHistory, roomHistory, messengerHistory, addMessengerEntry };
|
||||
return { addChatEntry, chatHistory, roomHistory, messengerHistory };
|
||||
}
|
||||
|
||||
export const useChatHistory = () => useBetween(useChatHistoryState);
|
||||
|
Loading…
Reference in New Issue
Block a user