From 1fff7555865bcf357e9048f372005c62e1e915c5 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Thu, 2 Sep 2021 16:50:20 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=96=B5=E8=AF=AD?= =?UTF-8?q?=E5=8F=91=E9=80=81=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/SendMiaoModal.tsx | 47 +++++++++++++++++++ web/plugins/com.msgbyte.miaolang/src/index.ts | 15 +++++- .../components/ChatBox/ChatInputBox/Addon.tsx | 32 ++++++++----- .../ChatBox/ChatInputBox/context.ts | 12 +++++ .../components/ChatBox/ChatInputBox/index.tsx | 29 +++++++----- web/src/plugin/common/index.ts | 1 + web/src/plugin/common/reg.ts | 4 +- web/src/plugin/component/index.tsx | 4 ++ web/src/plugin/loader.ts | 1 + 9 files changed, 118 insertions(+), 27 deletions(-) create mode 100644 web/plugins/com.msgbyte.miaolang/src/SendMiaoModal.tsx create mode 100644 web/src/components/ChatBox/ChatInputBox/context.ts create mode 100644 web/src/plugin/component/index.tsx diff --git a/web/plugins/com.msgbyte.miaolang/src/SendMiaoModal.tsx b/web/plugins/com.msgbyte.miaolang/src/SendMiaoModal.tsx new file mode 100644 index 00000000..6b7a8b3f --- /dev/null +++ b/web/plugins/com.msgbyte.miaolang/src/SendMiaoModal.tsx @@ -0,0 +1,47 @@ +import React from 'react'; +import { useCallback } from 'react'; +import { useState } from 'react'; +import { + ModalWrapper, + useModalContext, + ChatInputActionContextProps, +} from '@capital/common'; +import { Button, TextArea } from '@capital/component'; +import { encode } from './trans'; + +interface SendMiaoModalProps { + actions: ChatInputActionContextProps; +} +export const SendMiaoModal: React.FC = React.memo( + (props) => { + const [text, setText] = useState(''); + const modalContext = useModalContext(); + + const handleSendMiao = useCallback(() => { + const miao = encode(text); + + props.actions.sendMsg(miao); + modalContext?.closeModal(); + }, [text, modalContext, props.actions]); + + return ( + +