Skip to content

Commit 696ad93

Browse files
committed
feat: add StartChat to wrap vm and view
1 parent 14adbab commit 696ad93

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/*
2+
* Copyright 2026 Element Creations Ltd.
3+
*
4+
* SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
5+
* Please see LICENSE files in the repository root for full details.
6+
*/
7+
8+
import { StartChatView, useCreateAutoDisposedViewModel } from "@element-hq/web-shared-components";
9+
import React, { type JSX } from "react";
10+
11+
import { StartChatViewModel } from "../../../viewmodels/room/StartChatViewModel";
12+
import { useMatrixClientContext } from "../../../contexts/MatrixClientContext";
13+
import { useScopedRoomContext } from "../../../contexts/ScopedRoomContext";
14+
15+
/**
16+
* Wrapper around StartChatView that creates the StartChatViewModel and passes it to the view.
17+
*/
18+
export function StartChat(): JSX.Element {
19+
const matrixClient = useMatrixClientContext();
20+
const { room } = useScopedRoomContext("room", "roomId");
21+
const vm = useCreateAutoDisposedViewModel(() => new StartChatViewModel({ room: room!, matrixClient }));
22+
23+
return <StartChatView vm={vm} />;
24+
}

0 commit comments

Comments
 (0)