From 06e0404639a465b02062aaed9d006ef62620c6a8 Mon Sep 17 00:00:00 2001 From: David Baker Date: Tue, 16 Apr 2024 12:38:20 +0100 Subject: [PATCH] Make empty state copy for TAC depend on the value of the setting (#12419) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Make empty state copy for TAC depend on the value of the setting * Update test snapshot * Fix snapshot Run the whole file or the radix IDs will br wrong 🤦 * Simplify to a ternary --- .../threads-activity-centre/ThreadsActivityCentre.tsx | 10 +++++++--- src/i18n/strings/en_EN.json | 3 ++- .../__snapshots__/ThreadsActivityCentre-test.tsx.snap | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentre.tsx b/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentre.tsx index 64888b3b28..8b0b470f12 100644 --- a/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentre.tsx +++ b/src/components/views/spaces/threads-activity-centre/ThreadsActivityCentre.tsx @@ -36,6 +36,7 @@ import { getKeyBindingsManager } from "../../../../KeyBindingsManager"; import { KeyBindingAction } from "../../../../accessibility/KeyboardShortcuts"; import { ReleaseAnnouncement } from "../../../structures/ReleaseAnnouncement"; import { useIsReleaseAnnouncementOpen } from "../../../../hooks/useIsReleaseAnnouncementOpen"; +import { useSettingValue } from "../../../../hooks/useSettings"; interface ThreadsActivityCentreProps { /** @@ -52,6 +53,11 @@ export function ThreadsActivityCentre({ displayButtonLabel }: ThreadsActivityCen const [open, setOpen] = useState(false); const roomsAndNotifications = useUnreadThreadRooms(open); const isReleaseAnnouncementOpen = useIsReleaseAnnouncementOpen("threadsActivityCentre"); + const settingTACOnlyNotifs = useSettingValue("Notifications.tac_only_notifications"); + + const emptyCaption = settingTACOnlyNotifs + ? _t("threads_activity_centre|no_rooms_with_threads_notifs") + : _t("threads_activity_centre|no_rooms_with_unread_threads"); return (
))} {roomsAndNotifications.rooms.length === 0 && ( -
- {_t("threads_activity_centre|no_rooms_with_unreads_threads")} -
+
{emptyCaption}
)}
diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 4f07aedd94..f0ee695d5e 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -3167,7 +3167,8 @@ }, "threads_activity_centre": { "header": "Threads activity", - "no_rooms_with_unreads_threads": "You don't have rooms with unread threads yet.", + "no_rooms_with_threads_notifs": "You don't have rooms with thread notifications yet.", + "no_rooms_with_unread_threads": "You don't have rooms with unread threads yet.", "release_announcement_description": "Threads notifications have moved, find them here from now on.", "release_announcement_header": "Threads Activity Centre" }, diff --git a/test/components/views/spaces/__snapshots__/ThreadsActivityCentre-test.tsx.snap b/test/components/views/spaces/__snapshots__/ThreadsActivityCentre-test.tsx.snap index 3146a3c80a..b9e6d5dc3f 100644 --- a/test/components/views/spaces/__snapshots__/ThreadsActivityCentre-test.tsx.snap +++ b/test/components/views/spaces/__snapshots__/ThreadsActivityCentre-test.tsx.snap @@ -153,7 +153,7 @@ exports[`ThreadsActivityCentre should match snapshot when empty 1`] = `
- You don't have rooms with unread threads yet. + You don't have rooms with thread notifications yet.