notifications: refactor group notification to match spec
@@ -12,6 +12,7 @@ import {
import { Header } from './header';
import GlobalApi from '~/logic/api/global';
+import {useAssocForGroup} from '~/logic/state/metadata';
function describeNotification(description: string, plural: boolean) {
switch (description) {
@@ -52,23 +53,16 @@ export function GroupNotification(props: GroupNotificationProps): ReactElement {
const { group } = index;
const desc = describeNotification(index.description, contents.length !== 1);
- const onClick = useCallback(() => {
- if (props.archived) {
- return;
- }
- const func = read ? 'unread' : 'read';
- return api.hark[func](timebox, { group: index });
- }, [api, timebox, index, read]);
+ const association = useAssocForGroup(group)
+ const groupTitle = association?.metadata?.title ?? group;
return (
- <Col onClick={onClick} p="2">
+ <Col>
<Header
- archived={props.archived}
time={time}
- read={read}
- group={group}
authors={authors}
description={desc}
+ groupTitle={groupTitle}
/>
</Col>
);
