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

Add caption for empty TAC #12226

Merged
merged 3 commits into from
Feb 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions res/css/structures/_ThreadsActivityCentre.pcss
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,9 @@
}
}
}

.mx_ThreadsActivityCentre_emptyCaption {
padding-left: 16px;
padding-right: 16px;
font-size: 13px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ export function ThreadsActivityCentre({ displayButtonLabel }: ThreadsActivityCen
onClick={() => setOpen(false)}
/>
))}
{roomsAndNotifications.rooms.length === 0 && (
<div className="mx_ThreadsActivityCentre_emptyCaption">
{_t("threads_activity_centre|no_rooms_with_unreads_threads")}
</div>
)}
</div>
</Menu>
);
Expand Down
3 changes: 2 additions & 1 deletion src/i18n/strings/en_EN.json
Original file line number Diff line number Diff line change
Expand Up @@ -3162,7 +3162,8 @@
"unable_to_decrypt": "Unable to decrypt message"
},
"threads_activity_centre": {
"header": "Threads activity"
"header": "Threads activity",
"no_rooms_with_unreads_threads": "You don't have rooms with unread threads yet."
},
"time": {
"about_day_ago": "about a day ago",
Expand Down
18 changes: 18 additions & 0 deletions test/components/views/spaces/ThreadsActivityCentre-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,22 @@ describe("ThreadsActivityCentre", () => {

expect(screen.getByRole("menu")).toMatchSnapshot();
});

it("should display a caption when no threads are unread", async () => {
cli.getVisibleRooms = jest.fn().mockReturnValue([]);
renderTAC();
await userEvent.click(getTACButton());

expect(screen.getByRole("menu").getElementsByClassName("mx_ThreadsActivityCentre_emptyCaption").length).toEqual(
1,
);
});

it("should match snapshot when empty", async () => {
cli.getVisibleRooms = jest.fn().mockReturnValue([]);
renderTAC();
await userEvent.click(getTACButton());

expect(screen.getByRole("menu")).toMatchSnapshot();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,37 @@ exports[`ThreadsActivityCentre renders notifications matching the snapshot 1`] =
</div>
</div>
`;

exports[`ThreadsActivityCentre should match snapshot when empty 1`] = `
<div
aria-labelledby="radix-20"
aria-orientation="vertical"
class="_menu_1x5h1_17"
data-align="end"
data-orientation="vertical"
data-radix-menu-content=""
data-side="right"
data-state="open"
dir="ltr"
id="radix-21"
role="menu"
style="outline: none; --radix-dropdown-menu-content-transform-origin: var(--radix-popper-transform-origin); --radix-dropdown-menu-content-available-width: var(--radix-popper-available-width); --radix-dropdown-menu-content-available-height: var(--radix-popper-available-height); --radix-dropdown-menu-trigger-width: var(--radix-popper-anchor-width); --radix-dropdown-menu-trigger-height: var(--radix-popper-anchor-height); pointer-events: auto;"
tabindex="-1"
>
<h3
class="_typography_yh5dq_162 _font-body-sm-semibold_yh5dq_45 _title_1x5h1_83"
id=":r7:"
>
Threads activity
</h3>
<div
class="mx_ThreadsActivity_rows"
>
<div
class="mx_ThreadsActivityCentre_emptyCaption"
>
You don't have rooms with unread threads yet.
</div>
</div>
</div>
`;
Loading