Skip to content

Commit

Permalink
Merge pull request #38 from superhero-com/features/start-chat-btn
Browse files Browse the repository at this point in the history
Features/start chat btn
  • Loading branch information
ifaouibadi authored Jan 19, 2024
2 parents 0f62bb1 + e394f62 commit 96223fb
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/components/views/rooms/NewRoomIntro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import DMRoomMap from "matrix-react-sdk/src/utils/DMRoomMap";
import { shouldEncryptRoomWithSingle3rdPartyInvite } from "matrix-react-sdk/src/utils/room/shouldEncryptRoomWithSingle3rdPartyInvite";
import { privateShouldBeEncrypted } from "matrix-react-sdk/src/utils/rooms";
import { showSpaceInvite } from "matrix-react-sdk/src/utils/space";
import { sendMessage } from "matrix-react-sdk/src/components/views/rooms/wysiwyg_composer/utils/message";
import React, { useContext } from "react";

import { getRoomName } from "../../../hooks/useRoomName";
Expand All @@ -60,7 +61,8 @@ const determineIntroMessage = (room: Room, encryptedSingle3rdPartyInvite: boolea

const NewRoomIntro: React.FC = () => {
const cli = useContext(MatrixClientContext);
const { room, roomId } = useContext(RoomContext);
const roomContext = useContext(RoomContext);
const { room, roomId } = roomContext;

if (!room || !roomId) {
throw new Error("Unable to create a NewRoomIntro without room and roomId");
Expand All @@ -71,9 +73,9 @@ const NewRoomIntro: React.FC = () => {

const onSendHelloClick = (): void => {
if (!dmPartner) return;
cli.sendEvent(roomId, EventType.RoomMessage, {
body: "👋",
msgtype: "m.text",
sendMessage("👋", false, {
mxClient: cli,
roomContext: roomContext,
});
};

Expand All @@ -84,6 +86,7 @@ const NewRoomIntro: React.FC = () => {
style={{ marginTop: "5px", fontSize: "30px" }}
>
👋
<span style={{ fontSize: "18px", paddingLeft: "15px" }}>Say Hello</span>
</AccessibleButton>
);

Expand Down

0 comments on commit 96223fb

Please sign in to comment.