diff --git a/src/components/help/HelpView.tsx b/src/components/help/HelpView.tsx index 63d315af..e70c7049 100644 --- a/src/components/help/HelpView.tsx +++ b/src/components/help/HelpView.tsx @@ -1,6 +1,7 @@ import { ILinkEventTracker } from '@nitrots/nitro-renderer'; import { FC, useCallback, useEffect, useState } from 'react'; import { AddEventLinkTracker, LocalizeText, RemoveLinkEventTracker } from '../../api'; +import { Base, Column, Grid } from '../../common'; import { HelpReportUserEvent } from '../../events/help/HelpReportUserEvent'; import { useUiEvent } from '../../hooks'; import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../layout'; @@ -112,7 +113,14 @@ export const HelpView: FC<{}> = props => setIsVisible(false) } /> - + + + + + + + + } diff --git a/src/components/help/views/DescribeReportView.tsx b/src/components/help/views/DescribeReportView.tsx index d6f1ff7a..02c764d0 100644 --- a/src/components/help/views/DescribeReportView.tsx +++ b/src/components/help/views/DescribeReportView.tsx @@ -1,49 +1,44 @@ import { CallForHelpMessageComposer } from '@nitrots/nitro-renderer'; -import { FC, useCallback, useState } from 'react'; +import { FC, useState } from 'react'; import { CreateLinkEvent, LocalizeText } from '../../../api'; +import { Button, Column, Text } from '../../../common'; import { SendMessageHook } from '../../../hooks'; import { useHelpContext } from '../HelpContext'; export const DescribeReportView: FC<{}> = props => { + const [ message, setMessage ] = useState(''); const { helpReportState = null, setHelpReportState = null } = useHelpContext(); - const [message, setMessage] = useState(''); + const { reportedChats, cfhTopic, reportedUserId } = helpReportState; - const submitReport = useCallback(() => + const submitReport = () => { if(message.length < 15) return; - - const reportState = Object.assign({}, helpReportState); - reportState.message = message; + const roomId = reportedChats[0].roomId; + const chats: (string | number )[] = []; - setHelpReportState(reportState); - - const roomId = reportState.reportedChats[0].roomId; - const chats: (string | number )[] = []; - reportState.reportedChats.forEach(entry => + reportedChats.forEach(entry => { chats.push(entry.entityId); chats.push(entry.message); }); - SendMessageHook(new CallForHelpMessageComposer(message, reportState.cfhTopic, reportState.reportedUserId, roomId, chats)); + SendMessageHook(new CallForHelpMessageComposer(message, cfhTopic, reportedUserId, roomId, chats)); CreateLinkEvent('help/hide'); - }, [helpReportState, message, setHelpReportState]); + } return ( <> -
-

{LocalizeText('help.emergency.chat_report.subtitle')}

-
{LocalizeText('help.cfh.input.text')}
-
- -
-