Make empty state copy for TAC depend on the value of the setting (#12419)

* 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
This commit is contained in:
David Baker 2024-04-16 12:38:20 +01:00 committed by GitHub
parent 2760f9d46e
commit 06e0404639
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 5 deletions

View file

@ -36,6 +36,7 @@ import { getKeyBindingsManager } from "../../../../KeyBindingsManager";
import { KeyBindingAction } from "../../../../accessibility/KeyboardShortcuts"; import { KeyBindingAction } from "../../../../accessibility/KeyboardShortcuts";
import { ReleaseAnnouncement } from "../../../structures/ReleaseAnnouncement"; import { ReleaseAnnouncement } from "../../../structures/ReleaseAnnouncement";
import { useIsReleaseAnnouncementOpen } from "../../../../hooks/useIsReleaseAnnouncementOpen"; import { useIsReleaseAnnouncementOpen } from "../../../../hooks/useIsReleaseAnnouncementOpen";
import { useSettingValue } from "../../../../hooks/useSettings";
interface ThreadsActivityCentreProps { interface ThreadsActivityCentreProps {
/** /**
@ -52,6 +53,11 @@ export function ThreadsActivityCentre({ displayButtonLabel }: ThreadsActivityCen
const [open, setOpen] = useState(false); const [open, setOpen] = useState(false);
const roomsAndNotifications = useUnreadThreadRooms(open); const roomsAndNotifications = useUnreadThreadRooms(open);
const isReleaseAnnouncementOpen = useIsReleaseAnnouncementOpen("threadsActivityCentre"); const isReleaseAnnouncementOpen = useIsReleaseAnnouncementOpen("threadsActivityCentre");
const settingTACOnlyNotifs = useSettingValue<boolean>("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 ( return (
<div <div
@ -110,9 +116,7 @@ export function ThreadsActivityCentre({ displayButtonLabel }: ThreadsActivityCen
/> />
))} ))}
{roomsAndNotifications.rooms.length === 0 && ( {roomsAndNotifications.rooms.length === 0 && (
<div className="mx_ThreadsActivityCentre_emptyCaption"> <div className="mx_ThreadsActivityCentre_emptyCaption">{emptyCaption}</div>
{_t("threads_activity_centre|no_rooms_with_unreads_threads")}
</div>
)} )}
</div> </div>
</Menu> </Menu>

View file

@ -3167,7 +3167,8 @@
}, },
"threads_activity_centre": { "threads_activity_centre": {
"header": "Threads activity", "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_description": "Threads notifications have moved, find them here from now on.",
"release_announcement_header": "Threads Activity Centre" "release_announcement_header": "Threads Activity Centre"
}, },

View file

@ -153,7 +153,7 @@ exports[`ThreadsActivityCentre should match snapshot when empty 1`] = `
<div <div
class="mx_ThreadsActivityCentre_emptyCaption" class="mx_ThreadsActivityCentre_emptyCaption"
> >
You don't have rooms with unread threads yet. You don't have rooms with thread notifications yet.
</div> </div>
</div> </div>
</div> </div>