feat: add send msg to search user

This commit is contained in:
Tristan Yang
2023-06-26 23:01:37 +08:00
parent a362fbf45d
commit 8bb6bfaaab
+9 -4
View File
@@ -58,7 +58,10 @@ const SearchUser: FC<Props> = ({ closeModal }) => {
keyword: currInput keyword: currInput
}); });
}; };
const handleSendMsg = () => {
if (!data) return;
navigateTo(`/chat/dm/${data.uid}`);
};
const handleChangeKeyword = (type: Type) => { const handleChangeKeyword = (type: Type) => {
setType(type); setType(type);
}; };
@@ -132,9 +135,11 @@ const SearchUser: FC<Props> = ({ closeModal }) => {
/> />
<span className="my-2 dark:text-gray-100 text-gray-950">{data.name}</span> <span className="my-2 dark:text-gray-100 text-gray-950">{data.name}</span>
<div className="flex gap-2 my-2"> <div className="flex gap-2 my-2">
<StyledButton className="mini ghost" onClick={resetInput}> {!inContact && (
{t("action.cancel")} <StyledButton className="mini ghost" onClick={handleSendMsg}>
</StyledButton> {t("send_msg", { ns: "member" })}
</StyledButton>
)}
<StyledButton <StyledButton
disabled={adding} disabled={adding}
onClick={handleChat.bind(null, inContact)} onClick={handleChat.bind(null, inContact)}