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

Commit a38a516

Browse files
authored
Align RoomSummaryCard styles with Figma (#12793)
* Extract useIsVideoRoom hook Signed-off-by: Michael Telatynski <[email protected]> * Align RoomSummaryCard styles with Figma Signed-off-by: Michael Telatynski <[email protected]> * Update screenshots Signed-off-by: Michael Telatynski <[email protected]> * Update screenshot Signed-off-by: Michael Telatynski <[email protected]> --------- Signed-off-by: Michael Telatynski <[email protected]>
1 parent b6addb4 commit a38a516

File tree

13 files changed

+136
-105
lines changed

13 files changed

+136
-105
lines changed

playwright/e2e/polls/pollHistory.spec.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ test.describe("Poll history", () => {
6969
async function openPollHistory(app: ElementAppPage): Promise<void> {
7070
const { page } = app;
7171
await app.toggleRoomInfoPanel();
72-
await page.locator(".mx_RoomSummaryCard").getByRole("menuitem", { name: "Poll history" }).click();
72+
await page.locator(".mx_RoomSummaryCard").getByRole("menuitem", { name: "Polls" }).click();
7373
}
7474

7575
test.use({
Loading
Loading

res/css/views/right_panel/_RoomSummaryCard.pcss

+3
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ limitations under the License.
1515
*/
1616

1717
.mx_RoomSummaryCard {
18+
--cpd-separator-inset: var(--cpd-space-4x);
19+
--cpd-separator-spacing: var(--cpd-space-4x);
20+
1821
.mx_RoomSummaryCard_container {
1922
text-align: center;
2023
margin: $spacing-20 var(--cpd-space-4x) 0;

src/components/views/right_panel/RoomSummaryCard.tsx

+18-8
Original file line numberDiff line numberDiff line change
@@ -385,18 +385,11 @@ const RoomSummaryCard: React.FC<IProps> = ({
385385
disabled={!canInviteToState}
386386
onSelect={() => inviteToRoom(room)}
387387
/>
388-
<MenuItem Icon={LinkIcon} label={_t("action|copy_link")} onSelect={onShareRoomClick} />
389-
<MenuItem Icon={SettingsIcon} label={_t("common|settings")} onSelect={onRoomSettingsClick} />
390388

391389
<Separator />
390+
392391
{!isVideoRoom && (
393392
<>
394-
<MenuItem Icon={FilesIcon} label={_t("right_panel|files_button")} onSelect={onRoomFilesClick} />
395-
<MenuItem
396-
Icon={PollsIcon}
397-
label={_t("right_panel|polls_button")}
398-
onSelect={onRoomPollHistoryClick}
399-
/>
400393
{pinningEnabled && (
401394
<MenuItem
402395
Icon={PinIcon}
@@ -408,6 +401,21 @@ const RoomSummaryCard: React.FC<IProps> = ({
408401
</Text>
409402
</MenuItem>
410403
)}
404+
<MenuItem Icon={FilesIcon} label={_t("right_panel|files_button")} onSelect={onRoomFilesClick} />
405+
</>
406+
)}
407+
408+
<Separator />
409+
410+
<MenuItem Icon={LinkIcon} label={_t("action|copy_link")} onSelect={onShareRoomClick} />
411+
412+
{!isVideoRoom && (
413+
<>
414+
<MenuItem
415+
Icon={PollsIcon}
416+
label={_t("right_panel|polls_button")}
417+
onSelect={onRoomPollHistoryClick}
418+
/>
411419
<MenuItem
412420
Icon={ExportArchiveIcon}
413421
label={_t("export_chat|title")}
@@ -416,6 +424,8 @@ const RoomSummaryCard: React.FC<IProps> = ({
416424
</>
417425
)}
418426

427+
<MenuItem Icon={SettingsIcon} label={_t("common|settings")} onSelect={onRoomSettingsClick} />
428+
419429
<Separator />
420430

421431
<MenuItem

src/i18n/strings/en_EN.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1846,7 +1846,7 @@
18461846
},
18471847
"title": "Pinned messages"
18481848
},
1849-
"pinned_messages_button": "Pinned",
1849+
"pinned_messages_button": "Pinned messages",
18501850
"poll": {
18511851
"active_heading": "Active polls",
18521852
"empty_active": "There are no active polls in this room",
@@ -1871,7 +1871,7 @@
18711871
"view_in_timeline": "View poll in timeline",
18721872
"view_poll": "View poll"
18731873
},
1874-
"polls_button": "Poll history",
1874+
"polls_button": "Polls",
18751875
"room_summary_card": {
18761876
"title": "Room info"
18771877
},

test/components/views/dialogs/RoomSettingsDialog-test.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ describe("<RoomSettingsDialog />", () => {
183183
it("displays poll history when tab clicked", () => {
184184
const { container } = getComponent();
185185

186-
fireEvent.click(screen.getByText("Poll history"));
186+
fireEvent.click(screen.getByText("Polls"));
187187

188188
expect(container.querySelector(".mx_SettingsTab")).toMatchSnapshot();
189189
});

test/components/views/dialogs/__snapshots__/RoomSettingsDialog-test.tsx.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ NodeList [
8989
class="mx_TabbedView_tabLabel_text"
9090
id="mx_tabpanel_ROOM_POLL_HISTORY_TAB_label"
9191
>
92-
Poll history
92+
Polls
9393
</span>
9494
</li>,
9595
]
@@ -105,7 +105,7 @@ exports[`<RoomSettingsDialog /> poll history displays poll history when tab clic
105105
<h2
106106
class="mx_Heading_h2 mx_PollHistory_header"
107107
>
108-
Poll history
108+
Polls
109109
</h2>
110110
<div
111111
class="mx_PollHistoryList"

test/components/views/polls/pollHistory/PollHistory-test.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ describe("<PollHistory />", () => {
320320

321321
fireEvent.click(getByText("Question?"));
322322

323-
expect(queryByText("Poll history")).not.toBeInTheDocument();
323+
expect(queryByText("Polls")).not.toBeInTheDocument();
324324
// elements from MPollBody
325325
expect(getByText("Question?")).toMatchSnapshot();
326326
expect(getByText("Socks")).toBeInTheDocument();
@@ -396,13 +396,13 @@ describe("<PollHistory />", () => {
396396
expect(getByText("Question?")).toBeInTheDocument();
397397

398398
// header not shown
399-
expect(queryByText("Poll history")).not.toBeInTheDocument();
399+
expect(queryByText("Polls")).not.toBeInTheDocument();
400400

401401
expect(getByText("Active polls")).toMatchSnapshot();
402402
fireEvent.click(getByText("Active polls"));
403403

404404
// main list header displayed again
405-
expect(getByText("Poll history")).toBeInTheDocument();
405+
expect(getByText("Polls")).toBeInTheDocument();
406406
// active filter still active
407407
expect(getByTestId("filter-tab-PollHistory_filter-ACTIVE").firstElementChild).toBeChecked();
408408
// list displayed

test/components/views/polls/pollHistory/__snapshots__/PollHistory-test.tsx.snap

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ exports[`<PollHistory /> renders a list of active polls when there are polls in
3737
<h2
3838
class="mx_Heading_h2 mx_PollHistory_header"
3939
>
40-
Poll history
40+
Polls
4141
</h2>
4242
<div
4343
class="mx_PollHistoryList"

test/components/views/right_panel/RoomSummaryCard-test.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -271,22 +271,22 @@ describe("<RoomSummaryCard />", () => {
271271
mocked(settingsHooks.useFeatureEnabled).mockImplementation((feature) => feature === "feature_pinning");
272272
const { getByText } = getComponent();
273273

274-
expect(getByText("Pinned")).toBeInTheDocument();
274+
expect(getByText("Pinned messages")).toBeInTheDocument();
275275
});
276276
});
277277

278278
describe("poll history", () => {
279279
it("renders poll history option", () => {
280280
const { getByText } = getComponent();
281281

282-
expect(getByText("Poll history")).toBeInTheDocument();
282+
expect(getByText("Polls")).toBeInTheDocument();
283283
});
284284

285285
it("opens poll history dialog on button click", () => {
286286
const permalinkCreator = new RoomPermalinkCreator(room);
287287
const { getByText } = getComponent({ permalinkCreator });
288288

289-
fireEvent.click(getByText("Poll history"));
289+
fireEvent.click(getByText("Polls"));
290290

291291
expect(Modal.createDialog).toHaveBeenCalledWith(PollHistoryDialog, {
292292
room,

0 commit comments

Comments
 (0)