Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit cf8b87f

Browse files
Add tabs to the right panel (#12672)
* Create new method for header button behaviour With the introduction of tabs, the behaviour of the header buttons is changed as follows: - Close any right panel if open - Open the correct right panel if no panel was open before The old method (and behaviour) is retained as showOrHidePhase. * Implement tabs in the right panel There are three tabs: Info, People and Threads * Remove unwanted code from RoomSummaryCard - Remove the menu item for opening the memberlist since that is now taken of by the tabs. - Remove the close button * Remove code for focusing close button from tac item See #12410 There's no longer a close button to focus so we instead focus the thread tab. This is done in RightPaneltabs.tsx so we just need to remove this code. * Introduce a room info icon to the header This was previously present in the legacy room header but not in the new header. * BaseCard changes - Adds id, ariaLabelledBy and role props to implement tab accessibility. - Adds hideHeaderButtons prop to hide header buttons (think back and close buttons). - Change confusing header rendering code: header is not rendered ONLY when no header is passed AND hideHeaderButtons is true. * Refactor repeated code into function Created a new function createSpaceScopeHeader which returns the component if the room is a space room. Previously this code was duplicated in every component that uses SpaceScopeHeader component. * Pass BaseCard attributes and use helper function Actually using the code from the last two commits * Add, update and remove tests/screenshots/snapshots * Fix distance between search bar and tabs * Update compound * Update screenshots/snapshots
1 parent cd39d91 commit cf8b87f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+501
-294
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
"@sentry/browser": "^8.0.0",
7979
"@testing-library/react-hooks": "^8.0.1",
8080
"@vector-im/compound-design-tokens": "^1.2.0",
81-
"@vector-im/compound-web": "^5.1.2",
81+
"@vector-im/compound-web": "^5.2.3",
8282
"@zxcvbn-ts/core": "^3.0.4",
8383
"@zxcvbn-ts/language-common": "^3.0.4",
8484
"@zxcvbn-ts/language-en": "^3.0.2",

playwright/e2e/crypto/crypto.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ const verify = async (page: Page, bob: Bot) => {
103103
const bobsVerificationRequestPromise = waitForVerificationRequest(bob);
104104

105105
const roomInfo = await openRoomInfo(page);
106-
await roomInfo.getByRole("menuitem", { name: "People" }).click();
106+
await page.locator(".mx_RightPanelTabs").getByText("People").click();
107107
await roomInfo.getByText("Bob").click();
108108
await roomInfo.getByRole("button", { name: "Verify" }).click();
109109
await roomInfo.getByRole("button", { name: "Start Verification" }).click();
@@ -279,7 +279,7 @@ test.describe("Cryptography", function () {
279279

280280
// Assert that verified icon is rendered
281281
await page.getByRole("button", { name: "Room members" }).click();
282-
await page.getByRole("button", { name: "Room information" }).click();
282+
await page.locator(".mx_RightPanelTabs").getByText("Info").click();
283283
await expect(page.locator('.mx_RoomSummaryCard_badges [data-kind="success"]')).toContainText("Encrypted");
284284

285285
// Take a snapshot of RoomSummaryCard with a verified E2EE icon

playwright/e2e/crypto/dehydration.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ test.describe("Dehydration", () => {
102102

103103
await viewRoomSummaryByName(page, app, ROOM_NAME);
104104

105-
await page.getByRole("menuitem", { name: "People" }).click();
105+
await page.locator(".mx_RightPanelTabs").getByText("People").click();
106106
await expect(page.locator(".mx_MemberList")).toBeVisible();
107107

108108
await getMemberTileByName(page, NAME).click();

playwright/e2e/lazy-loading/lazy-loading.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ test.describe("Lazy Loading", () => {
8080

8181
async function openMemberlist(page: Page): Promise<void> {
8282
await page.locator(".mx_LegacyRoomHeader").getByRole("button", { name: "Room info" }).click();
83-
await page.locator(".mx_RoomSummaryCard").getByRole("menuitem", { name: "People" }).click(); // \d represents the number of the room members
83+
await page.locator(".mx_RightPanelTabs").getByText("People").click();
8484
}
8585

8686
function getMemberInMemberlist(page: Page, name: string): Locator {

playwright/e2e/read-receipts/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,19 +399,18 @@ class Helpers {
399399
}
400400

401401
/**
402-
* Close the threads panel. (Actually, close any right panel, but for these
403-
* tests we only open the threads panel.)
402+
* Close the threads panel.
404403
*/
405404
async closeThreadsPanel() {
406-
await this.page.locator(".mx_RightPanel").getByLabel("Close").click();
405+
await this.page.locator(".mx_LegacyRoomHeader").getByLabel("Threads").click();
407406
await expect(this.page.locator(".mx_RightPanel")).not.toBeVisible();
408407
}
409408

410409
/**
411410
* Return to the list of threads, given we are viewing a single thread.
412411
*/
413412
async backToThreadsList() {
414-
await this.page.locator(".mx_RightPanel").getByLabel("Threads").click();
413+
await this.page.locator(".mx_LegacyRoomHeader").getByLabel("Threads").click();
415414
}
416415

417416
/**

playwright/e2e/right-panel/right-panel.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ test.describe("RightPanel", () => {
113113
test("should handle viewing room member", async ({ page, app }) => {
114114
await viewRoomSummaryByName(page, app, ROOM_NAME);
115115

116-
await page.getByRole("menuitem", { name: "People" }).click();
116+
await page.locator(".mx_RightPanelTabs").getByText("People").click();
117117
await expect(page.locator(".mx_MemberList")).toBeVisible();
118118

119119
await getMemberTileByName(page, NAME).click();
@@ -123,7 +123,7 @@ test.describe("RightPanel", () => {
123123
await page.getByRole("button", { name: "Room members" }).click();
124124
await expect(page.locator(".mx_MemberList")).toBeVisible();
125125

126-
await page.getByRole("button", { name: "Room information" }).click();
126+
await page.locator(".mx_RightPanelTabs").getByText("Info").click();
127127
await checkRoomSummaryCard(page, ROOM_NAME);
128128
});
129129
});

playwright/e2e/spaces/threads-activity-centre/index.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -337,12 +337,10 @@ export class Helpers {
337337
}
338338

339339
/**
340-
* Assert that the thread panel is focused (actually the 'close' button, specifically)
340+
* Assert that the thread tab is focused
341341
*/
342-
assertThreadPanelFocused() {
343-
return expect(
344-
this.page.locator(".mx_ThreadPanel").locator(".mx_BaseCard_header").getByLabel("Close"),
345-
).toBeFocused();
342+
assertThreadTabFocused() {
343+
return expect(this.page.locator("#thread-panel-tab")).toBeFocused();
346344
}
347345

348346
/**

playwright/e2e/spaces/threads-activity-centre/threadsActivityCentre.spec.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,12 @@ test.describe("Threads Activity Centre", () => {
161161
await util.assertNoTacIndicator();
162162
});
163163

164-
test("should focus the thread panel close button when clicking an item in the TAC", async ({
165-
room1,
166-
room2,
167-
util,
168-
msg,
169-
}) => {
164+
test("should focus the thread tab when clicking an item in the TAC", async ({ room1, room2, util, msg }) => {
170165
await util.receiveMessages(room1, ["Msg1", msg.threadedOff("Msg1", "Resp1")]);
171166

172167
await util.openTac();
173168
await util.clickRoomInTac(room1.name);
174169

175-
await util.assertThreadPanelFocused();
170+
await util.assertThreadTabFocused();
176171
});
177172
});
-963 Bytes
Loading
-78 Bytes
Loading

0 commit comments

Comments
 (0)