mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-13 08:38:43 +03:00
notifications: refactor group notification to match spec
This commit is contained in:
parent
992b607e3c
commit
711bb8d88c
@ -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>
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user