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

Commit

Permalink
Align RoomSummaryCard styles with Figma
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
  • Loading branch information
t3chguy committed Jul 30, 2024
1 parent bf9ab96 commit 2c1c3ce
Show file tree
Hide file tree
Showing 12 changed files with 136 additions and 105 deletions.
2 changes: 1 addition & 1 deletion playwright/e2e/polls/pollHistory.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ test.describe("Poll history", () => {
async function openPollHistory(app: ElementAppPage): Promise<void> {
const { page } = app;
await app.toggleRoomInfoPanel();
await page.locator(".mx_RoomSummaryCard").getByRole("menuitem", { name: "Poll history" }).click();
await page.locator(".mx_RoomSummaryCard").getByRole("menuitem", { name: "Polls" }).click();
}

test.use({
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions res/css/views/right_panel/_RoomSummaryCard.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ limitations under the License.
*/

.mx_RoomSummaryCard {
--cpd-separator-inset: var(--cpd-space-4x);
--cpd-separator-spacing: var(--cpd-space-4x);

.mx_RoomSummaryCard_container {
text-align: center;
margin: $spacing-20 var(--cpd-space-4x) 0;
Expand Down
26 changes: 18 additions & 8 deletions src/components/views/right_panel/RoomSummaryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -378,18 +378,11 @@ const RoomSummaryCard: React.FC<IProps> = ({
disabled={!canInviteToState}
onSelect={() => inviteToRoom(room)}
/>
<MenuItem Icon={LinkIcon} label={_t("action|copy_link")} onSelect={onShareRoomClick} />
<MenuItem Icon={SettingsIcon} label={_t("common|settings")} onSelect={onRoomSettingsClick} />

<Separator />

{!isVideoRoom && (
<>
<MenuItem Icon={FilesIcon} label={_t("right_panel|files_button")} onSelect={onRoomFilesClick} />
<MenuItem
Icon={PollsIcon}
label={_t("right_panel|polls_button")}
onSelect={onRoomPollHistoryClick}
/>
{pinningEnabled && (
<MenuItem
Icon={PinIcon}
Expand All @@ -401,6 +394,21 @@ const RoomSummaryCard: React.FC<IProps> = ({
</Text>
</MenuItem>
)}
<MenuItem Icon={FilesIcon} label={_t("right_panel|files_button")} onSelect={onRoomFilesClick} />
</>
)}

<Separator />

<MenuItem Icon={LinkIcon} label={_t("action|copy_link")} onSelect={onShareRoomClick} />

{!isVideoRoom && (
<>
<MenuItem
Icon={PollsIcon}
label={_t("right_panel|polls_button")}
onSelect={onRoomPollHistoryClick}
/>
<MenuItem
Icon={ExportArchiveIcon}
label={_t("export_chat|title")}
Expand All @@ -409,6 +417,8 @@ const RoomSummaryCard: React.FC<IProps> = ({
</>
)}

<MenuItem Icon={SettingsIcon} label={_t("common|settings")} onSelect={onRoomSettingsClick} />

<Separator />

<MenuItem
Expand Down
4 changes: 2 additions & 2 deletions src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1846,7 +1846,7 @@
},
"title": "Pinned messages"
},
"pinned_messages_button": "Pinned",
"pinned_messages_button": "Pinned messages",
"poll": {
"active_heading": "Active polls",
"empty_active": "There are no active polls in this room",
Expand All @@ -1871,7 +1871,7 @@
"view_in_timeline": "View poll in timeline",
"view_poll": "View poll"
},
"polls_button": "Poll history",
"polls_button": "Polls",
"room_summary_card": {
"title": "Room info"
},
Expand Down
2 changes: 1 addition & 1 deletion test/components/views/dialogs/RoomSettingsDialog-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ describe("<RoomSettingsDialog />", () => {
it("displays poll history when tab clicked", () => {
const { container } = getComponent();

fireEvent.click(screen.getByText("Poll history"));
fireEvent.click(screen.getByText("Polls"));

expect(container.querySelector(".mx_SettingsTab")).toMatchSnapshot();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ NodeList [
class="mx_TabbedView_tabLabel_text"
id="mx_tabpanel_ROOM_POLL_HISTORY_TAB_label"
>
Poll history
Polls
</span>
</li>,
]
Expand All @@ -105,7 +105,7 @@ exports[`<RoomSettingsDialog /> poll history displays poll history when tab clic
<h2
class="mx_Heading_h2 mx_PollHistory_header"
>
Poll history
Polls
</h2>
<div
class="mx_PollHistoryList"
Expand Down
6 changes: 3 additions & 3 deletions test/components/views/polls/pollHistory/PollHistory-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ describe("<PollHistory />", () => {

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

expect(queryByText("Poll history")).not.toBeInTheDocument();
expect(queryByText("Polls")).not.toBeInTheDocument();
// elements from MPollBody
expect(getByText("Question?")).toMatchSnapshot();
expect(getByText("Socks")).toBeInTheDocument();
Expand Down Expand Up @@ -396,13 +396,13 @@ describe("<PollHistory />", () => {
expect(getByText("Question?")).toBeInTheDocument();

// header not shown
expect(queryByText("Poll history")).not.toBeInTheDocument();
expect(queryByText("Polls")).not.toBeInTheDocument();

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

// main list header displayed again
expect(getByText("Poll history")).toBeInTheDocument();
expect(getByText("Polls")).toBeInTheDocument();
// active filter still active
expect(getByTestId("filter-tab-PollHistory_filter-ACTIVE").firstElementChild).toBeChecked();
// list displayed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ exports[`<PollHistory /> renders a list of active polls when there are polls in
<h2
class="mx_Heading_h2 mx_PollHistory_header"
>
Poll history
Polls
</h2>
<div
class="mx_PollHistoryList"
Expand Down
6 changes: 3 additions & 3 deletions test/components/views/right_panel/RoomSummaryCard-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,22 +272,22 @@ describe("<RoomSummaryCard />", () => {
mocked(settingsHooks.useFeatureEnabled).mockImplementation((feature) => feature === "feature_pinning");
const { getByText } = getComponent();

expect(getByText("Pinned")).toBeInTheDocument();
expect(getByText("Pinned messages")).toBeInTheDocument();
});
});

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

expect(getByText("Poll history")).toBeInTheDocument();
expect(getByText("Polls")).toBeInTheDocument();
});

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

fireEvent.click(getByText("Poll history"));
fireEvent.click(getByText("Polls"));

expect(Modal.createDialog).toHaveBeenCalledWith(PollHistoryDialog, {
room,
Expand Down
Loading

0 comments on commit 2c1c3ce

Please sign in to comment.