Skip to content

Commit 475504d

Browse files
authored
New room list: change icon and label of menu item for to start a DM (#30470)
* feat: change `New message` to `Start chat` and change icon * feat: update the room list empty states * test: update existing tests * test(e2e): update playwright tests
1 parent 7faee3d commit 475504d

File tree

11 files changed

+16
-21
lines changed

11 files changed

+16
-21
lines changed

playwright/e2e/left-panel/room-list-panel/room-list-header.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ test.describe("Header section of the room list", () => {
3535

3636
await expect(page.getByRole("menu")).toMatchScreenshot("room-list-header-compose-menu.png");
3737

38-
// New message should open the direct messages dialog
39-
await page.getByRole("menuitem", { name: "New message" }).click();
38+
// Start chat should open the direct messages dialog
39+
await page.getByRole("menuitem", { name: "Start chat" }).click();
4040
await expect(page.getByRole("heading", { name: "Direct Messages" })).toBeVisible();
4141
await app.closeDialog();
4242

-724 Bytes
Loading
-968 Bytes
Loading
-197 Bytes
Loading

src/components/views/rooms/RoomListPanel/EmptyRoomList.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
import React, { type JSX, type PropsWithChildren } from "react";
99
import { Button } from "@vector-im/compound-web";
10-
import UserAddIcon from "@vector-im/compound-design-tokens/assets/web/icons/user-add";
10+
import ChatIcon from "@vector-im/compound-design-tokens/assets/web/icons/chat";
1111
import RoomIcon from "@vector-im/compound-design-tokens/assets/web/icons/room";
1212

1313
import type { RoomListViewState } from "../../../viewmodels/roomlist/RoomListViewModel";
@@ -148,8 +148,8 @@ function DefaultPlaceholder({ vm }: DefaultPlaceholderProps): JSX.Element {
148148
direction="column"
149149
gap="var(--cpd-space-4x)"
150150
>
151-
<Button size="sm" kind="secondary" Icon={UserAddIcon} onClick={vm.createChatRoom}>
152-
{_t("action|new_message")}
151+
<Button size="sm" kind="secondary" Icon={ChatIcon} onClick={vm.createChatRoom}>
152+
{_t("action|start_chat")}
153153
</Button>
154154
{vm.canCreateRoom && (
155155
<Button size="sm" kind="secondary" Icon={RoomIcon} onClick={vm.createRoom}>

src/components/views/rooms/RoomListPanel/RoomListHeaderView.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import HomeIcon from "@vector-im/compound-design-tokens/assets/web/icons/home";
1414
import PreferencesIcon from "@vector-im/compound-design-tokens/assets/web/icons/preferences";
1515
import SettingsIcon from "@vector-im/compound-design-tokens/assets/web/icons/settings";
1616
import VideoCallIcon from "@vector-im/compound-design-tokens/assets/web/icons/video-call";
17+
import ChatIcon from "@vector-im/compound-design-tokens/assets/web/icons/chat";
1718

1819
import { _t } from "../../../../languageHandler";
1920
import { Flex } from "../../../../shared-components/utils/Flex";
@@ -49,7 +50,7 @@ export function RoomListHeaderView(): JSX.Element {
4950
{vm.displayComposeMenu ? (
5051
<ComposeMenu vm={vm} />
5152
) : (
52-
<IconButton aria-label={_t("action|new_message")} onClick={(e) => vm.createChatRoom(e.nativeEvent)}>
53+
<IconButton aria-label={_t("action|start_chat")} onClick={(e) => vm.createChatRoom(e.nativeEvent)}>
5354
<ComposeIcon color="var(--cpd-color-icon-secondary)" />
5455
</IconButton>
5556
)}
@@ -143,12 +144,7 @@ function ComposeMenu({ vm }: ComposeMenuProps): JSX.Element {
143144
</IconButton>
144145
}
145146
>
146-
<MenuItem
147-
Icon={UserAddIcon}
148-
label={_t("action|new_message")}
149-
onSelect={vm.createChatRoom}
150-
hideChevron={true}
151-
/>
147+
<MenuItem Icon={ChatIcon} label={_t("action|start_chat")} onSelect={vm.createChatRoom} hideChevron={true} />
152148
{vm.canCreateRoom && (
153149
<MenuItem Icon={RoomIcon} label={_t("action|new_room")} onSelect={vm.createRoom} hideChevron={true} />
154150
)}

src/i18n/strings/en_EN.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@
9393
"maximise": "Maximise",
9494
"mention": "Mention",
9595
"minimise": "Minimise",
96-
"new_message": "New message",
9796
"new_room": "New room",
9897
"new_video_room": "New video room",
9998
"next": "Next",

test/unit-tests/components/views/rooms/RoomListPanel/EmptyRoomList-test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe("<EmptyRoomList />", () => {
3535
expect(screen.getByText("No chats yet")).toBeInTheDocument();
3636
expect(asFragment()).toMatchSnapshot();
3737

38-
await user.click(screen.getByRole("button", { name: "New message" }));
38+
await user.click(screen.getByRole("button", { name: "Start chat" }));
3939
expect(vm.createChatRoom).toHaveBeenCalled();
4040

4141
await user.click(screen.getByRole("button", { name: "New room" }));

test/unit-tests/components/views/rooms/RoomListPanel/RoomListHeaderView-test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ describe("<RoomListHeaderView />", () => {
6969
expect(screen.queryByRole("button", { name: "Add" })).toBeNull();
7070
expect(asFragment()).toMatchSnapshot();
7171

72-
await user.click(screen.getByRole("button", { name: "New message" }));
72+
await user.click(screen.getByRole("button", { name: "Start chat" }));
7373
expect(defaultValue.createChatRoom).toHaveBeenCalled();
7474
});
7575

@@ -80,7 +80,7 @@ describe("<RoomListHeaderView />", () => {
8080
const openMenu = screen.getByRole("button", { name: "Add" });
8181
await user.click(openMenu);
8282

83-
await user.click(screen.getByRole("menuitem", { name: "New message" }));
83+
await user.click(screen.getByRole("menuitem", { name: "Start chat" }));
8484
expect(defaultValue.createChatRoom).toHaveBeenCalled();
8585

8686
await user.click(openMenu);

test/unit-tests/components/views/rooms/RoomListPanel/__snapshots__/EmptyRoomList-test.tsx.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,10 +200,10 @@ exports[`<EmptyRoomList /> should not render the new room button if the user doe
200200
xmlns="http://www.w3.org/2000/svg"
201201
>
202202
<path
203-
d="M10 12q-1.65 0-2.825-1.175T6 8t1.175-2.825T10 4t2.825 1.175T14 8t-1.175 2.825T10 12m-8 6v-.8q0-.85.438-1.562.437-.713 1.162-1.088a14.8 14.8 0 0 1 3.15-1.163A13.8 13.8 0 0 1 10 13q1.65 0 3.25.387 1.6.388 3.15 1.163.724.375 1.163 1.087Q18 16.35 18 17.2v.8q0 .824-.587 1.413A1.93 1.93 0 0 1 16 20H4q-.824 0-1.412-.587A1.93 1.93 0 0 1 2 18m2 0h12v-.8a.97.97 0 0 0-.5-.85q-1.35-.675-2.725-1.012a11.6 11.6 0 0 0-5.55 0Q5.85 15.675 4.5 16.35a.97.97 0 0 0-.5.85zm6-8q.825 0 1.412-.588Q12 8.826 12 8q0-.824-.588-1.412A1.93 1.93 0 0 0 10 6q-.825 0-1.412.588A1.93 1.93 0 0 0 8 8q0 .825.588 1.412Q9.175 10 10 10m7 1h2v2q0 .424.288.713.287.287.712.287.424 0 .712-.287A.97.97 0 0 0 21 13v-2h2q.424 0 .712-.287A.97.97 0 0 0 24 10a.97.97 0 0 0-.288-.713A.97.97 0 0 0 23 9h-2V7a.97.97 0 0 0-.288-.713A.97.97 0 0 0 20 6a.97.97 0 0 0-.712.287A.97.97 0 0 0 19 7v2h-2a.97.97 0 0 0-.712.287A.97.97 0 0 0 16 10q0 .424.288.713.287.287.712.287"
203+
d="m1.5 21.25 1.45-4.95a10.2 10.2 0 0 1-.712-2.1A10.2 10.2 0 0 1 2 12q0-2.075.788-3.9a10.1 10.1 0 0 1 2.137-3.175q1.35-1.35 3.175-2.137A9.7 9.7 0 0 1 12 2q2.075 0 3.9.788a10.1 10.1 0 0 1 3.175 2.137q1.35 1.35 2.137 3.175A9.7 9.7 0 0 1 22 12a9.7 9.7 0 0 1-.788 3.9 10.1 10.1 0 0 1-2.137 3.175q-1.35 1.35-3.175 2.137A9.7 9.7 0 0 1 12 22q-1.125 0-2.2-.238a10.2 10.2 0 0 1-2.1-.712L2.75 22.5a.94.94 0 0 1-1-.25.94.94 0 0 1-.25-1m2.45-1.2 3.2-.95a1 1 0 0 1 .275-.062q.15-.013.275-.013.225 0 .438.038.212.036.412.137a7.4 7.4 0 0 0 1.675.6Q11.1 20 12 20q3.35 0 5.675-2.325T20 12t-2.325-5.675T12 4 6.325 6.325 4 12q0 .9.2 1.775t.6 1.675q.176.325.188.688t-.088.712z"
204204
/>
205205
</svg>
206-
New message
206+
Start chat
207207
</button>
208208
</div>
209209
</div>
@@ -247,10 +247,10 @@ exports[`<EmptyRoomList /> should render the default placeholder when there is n
247247
xmlns="http://www.w3.org/2000/svg"
248248
>
249249
<path
250-
d="M10 12q-1.65 0-2.825-1.175T6 8t1.175-2.825T10 4t2.825 1.175T14 8t-1.175 2.825T10 12m-8 6v-.8q0-.85.438-1.562.437-.713 1.162-1.088a14.8 14.8 0 0 1 3.15-1.163A13.8 13.8 0 0 1 10 13q1.65 0 3.25.387 1.6.388 3.15 1.163.724.375 1.163 1.087Q18 16.35 18 17.2v.8q0 .824-.587 1.413A1.93 1.93 0 0 1 16 20H4q-.824 0-1.412-.587A1.93 1.93 0 0 1 2 18m2 0h12v-.8a.97.97 0 0 0-.5-.85q-1.35-.675-2.725-1.012a11.6 11.6 0 0 0-5.55 0Q5.85 15.675 4.5 16.35a.97.97 0 0 0-.5.85zm6-8q.825 0 1.412-.588Q12 8.826 12 8q0-.824-.588-1.412A1.93 1.93 0 0 0 10 6q-.825 0-1.412.588A1.93 1.93 0 0 0 8 8q0 .825.588 1.412Q9.175 10 10 10m7 1h2v2q0 .424.288.713.287.287.712.287.424 0 .712-.287A.97.97 0 0 0 21 13v-2h2q.424 0 .712-.287A.97.97 0 0 0 24 10a.97.97 0 0 0-.288-.713A.97.97 0 0 0 23 9h-2V7a.97.97 0 0 0-.288-.713A.97.97 0 0 0 20 6a.97.97 0 0 0-.712.287A.97.97 0 0 0 19 7v2h-2a.97.97 0 0 0-.712.287A.97.97 0 0 0 16 10q0 .424.288.713.287.287.712.287"
250+
d="m1.5 21.25 1.45-4.95a10.2 10.2 0 0 1-.712-2.1A10.2 10.2 0 0 1 2 12q0-2.075.788-3.9a10.1 10.1 0 0 1 2.137-3.175q1.35-1.35 3.175-2.137A9.7 9.7 0 0 1 12 2q2.075 0 3.9.788a10.1 10.1 0 0 1 3.175 2.137q1.35 1.35 2.137 3.175A9.7 9.7 0 0 1 22 12a9.7 9.7 0 0 1-.788 3.9 10.1 10.1 0 0 1-2.137 3.175q-1.35 1.35-3.175 2.137A9.7 9.7 0 0 1 12 22q-1.125 0-2.2-.238a10.2 10.2 0 0 1-2.1-.712L2.75 22.5a.94.94 0 0 1-1-.25.94.94 0 0 1-.25-1m2.45-1.2 3.2-.95a1 1 0 0 1 .275-.062q.15-.013.275-.013.225 0 .438.038.212.036.412.137a7.4 7.4 0 0 0 1.675.6Q11.1 20 12 20q3.35 0 5.675-2.325T20 12t-2.325-5.675T12 4 6.325 6.325 4 12q0 .9.2 1.775t.6 1.675q.176.325.188.688t-.088.712z"
251251
/>
252252
</svg>
253-
New message
253+
Start chat
254254
</button>
255255
<button
256256
class="_button_vczzf_8 _has-icon_vczzf_57"

0 commit comments

Comments
 (0)