From 2d5afea71272afcb2675550d1e4370dc52466857 Mon Sep 17 00:00:00 2001 From: Bill Date: Wed, 16 Feb 2022 04:06:50 -0500 Subject: [PATCH] Update help component --- src/components/help/HelpView.tsx | 10 +- .../help/views/DescribeReportView.tsx | 41 +++---- src/components/help/views/HelpIndexView.tsx | 26 ++-- .../help/views/SanctionStatusView.tsx | 56 +++++---- .../help/views/SelectReportedChatsView.tsx | 114 +++++++++--------- .../help/views/SelectReportedUserView.tsx | 108 ++++++++--------- src/components/help/views/SelectTopicView.tsx | 91 +++++++------- 7 files changed, 217 insertions(+), 229 deletions(-) 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')}
-
- -
-