From b9349504bd3daafd7332e5115ffd7465eed8b471 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 5 Feb 2024 14:50:42 +0000 Subject: [PATCH 1/3] Add caption for empty TAC --- res/css/structures/_ThreadsActivityCentre.pcss | 6 ++++++ .../threads-activity-centre/ThreadsActivityCentre.tsx | 5 +++++ src/i18n/strings/en_EN.json | 3 +++ 3 files changed, 14 insertions(+) diff --git a/res/css/structures/_ThreadsActivityCentre.pcss b/res/css/structures/_ThreadsActivityCentre.pcss index 49e6cc2cc9d..2c1370fd69e 100644 --- a/res/css/structures/_ThreadsActivityCentre.pcss +++ b/res/css/structures/_ThreadsActivityCentre.pcss @@ -66,3 +66,9 @@ } } } + +.mx_ThreadsActivityCentre_emptyCaption { + padding-left: 16px; + padding-right: 16px; + font-size: 13px; +} diff --git a/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentre.tsx b/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentre.tsx index 0b8247d271b..94345e1d73e 100644 --- a/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentre.tsx +++ b/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentre.tsx @@ -77,6 +77,11 @@ export function ThreadsActivityCentre({ displayButtonLabel }: ThreadsActivityCen onClick={() => setOpen(false)} /> ))} + {roomsAndNotifications.rooms.length === 0 && ( +
+ {_t("tac|no_rooms_with_unreads_threads")} +
+ )} ); diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 269b345be31..c26976d53a4 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -3120,6 +3120,9 @@ "empty": "You don't currently have any stickerpacks enabled", "empty_add_prompt": "Add some now" }, + "tac": { + "no_rooms_with_unreads_threads": "You don't have rooms with unread threads yet." + }, "terms": { "column_document": "Document", "column_service": "Service", From f144a8fc5014da7b4fc2b74ce34f320d89d8e184 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 5 Feb 2024 15:17:57 +0000 Subject: [PATCH 2/3] s/tac/threads_activity_centre/ --- .../spaces/threads-activity-centre/ThreadsActivityCentre.tsx | 2 +- src/i18n/strings/en_EN.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentre.tsx b/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentre.tsx index 94345e1d73e..f6374ef32a9 100644 --- a/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentre.tsx +++ b/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentre.tsx @@ -79,7 +79,7 @@ export function ThreadsActivityCentre({ displayButtonLabel }: ThreadsActivityCen ))} {roomsAndNotifications.rooms.length === 0 && (
- {_t("tac|no_rooms_with_unreads_threads")} + {_t("threads_activity_centre|no_rooms_with_unreads_threads")}
)} diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index c26976d53a4..b1407dc64da 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -3120,7 +3120,7 @@ "empty": "You don't currently have any stickerpacks enabled", "empty_add_prompt": "Add some now" }, - "tac": { + "threads_activity_centre": { "no_rooms_with_unreads_threads": "You don't have rooms with unread threads yet." }, "terms": { From 9c024c161f2c24d2fe5060080f7d14af893e6019 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 5 Feb 2024 16:33:41 +0000 Subject: [PATCH 3/3] Fix i18n & add tests --- src/i18n/strings/en_EN.json | 6 ++-- .../spaces/ThreadsActivityCentre-test.tsx | 18 ++++++++++ .../ThreadsActivityCentre-test.tsx.snap | 34 +++++++++++++++++++ 3 files changed, 54 insertions(+), 4 deletions(-) diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index b1407dc64da..326c41c53fd 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -3120,9 +3120,6 @@ "empty": "You don't currently have any stickerpacks enabled", "empty_add_prompt": "Add some now" }, - "threads_activity_centre": { - "no_rooms_with_unreads_threads": "You don't have rooms with unread threads yet." - }, "terms": { "column_document": "Document", "column_service": "Service", @@ -3165,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", diff --git a/test/components/views/spaces/ThreadsActivityCentre-test.tsx b/test/components/views/spaces/ThreadsActivityCentre-test.tsx index ce730550ea5..4ae890638f4 100644 --- a/test/components/views/spaces/ThreadsActivityCentre-test.tsx +++ b/test/components/views/spaces/ThreadsActivityCentre-test.tsx @@ -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(); + }); }); diff --git a/test/components/views/spaces/__snapshots__/ThreadsActivityCentre-test.tsx.snap b/test/components/views/spaces/__snapshots__/ThreadsActivityCentre-test.tsx.snap index 5214cf18a95..80a19900187 100644 --- a/test/components/views/spaces/__snapshots__/ThreadsActivityCentre-test.tsx.snap +++ b/test/components/views/spaces/__snapshots__/ThreadsActivityCentre-test.tsx.snap @@ -175,3 +175,37 @@ exports[`ThreadsActivityCentre renders notifications matching the snapshot 1`] = `; + +exports[`ThreadsActivityCentre should match snapshot when empty 1`] = ` + +`;