({
notification,
onMarkNotificationAsRead,
})
| 14 | }; |
| 15 | |
| 16 | export const InboxItem: FC<InboxItemProps> = ({ |
| 17 | notification, |
| 18 | onMarkNotificationAsRead, |
| 19 | }) => { |
| 20 | return ( |
| 21 | <div |
| 22 | className="flex items-stretch gap-3 p-3 group" |
| 23 | role="menuitem" |
| 24 | tabIndex={-1} |
| 25 | > |
| 26 | <div className="flex-shrink-0"> |
| 27 | <InboxAvatar icon={notification.icon} /> |
| 28 | </div> |
| 29 | |
| 30 | <div className="flex flex-col gap-3 flex-1"> |
| 31 | <Markdown |
| 32 | className="text-content-secondary prose-sm font-medium [overflow-wrap:anywhere]" |
| 33 | components={{ |
| 34 | a: ({ node, ...props }) => { |
| 35 | return <Link {...props} />; |
| 36 | }, |
| 37 | }} |
| 38 | > |
| 39 | {notification.content} |
| 40 | </Markdown> |
| 41 | <div className="flex items-center gap-1"> |
| 42 | {notification.actions.map((action) => { |
| 43 | return ( |
| 44 | <Button variant="outline" size="sm" key={action.label} asChild> |
| 45 | <RouterLink |
| 46 | to={action.url} |
| 47 | onClick={() => { |
| 48 | onMarkNotificationAsRead(notification.id); |
| 49 | }} |
| 50 | > |
| 51 | {action.label} |
| 52 | </RouterLink> |
| 53 | </Button> |
| 54 | ); |
| 55 | })} |
| 56 | </div> |
| 57 | </div> |
| 58 | |
| 59 | <div className="w-12 flex flex-col items-end flex-shrink-0"> |
| 60 | {notification.read_at === null && ( |
| 61 | <> |
| 62 | <div className="group-focus:hidden group-hover:hidden size-2.5 rounded-full bg-highlight-sky"> |
| 63 | <span className="sr-only">Unread</span> |
| 64 | </div> |
| 65 | |
| 66 | <Button |
| 67 | onClick={() => onMarkNotificationAsRead(notification.id)} |
| 68 | className="hidden group-focus:flex group-hover:flex bg-surface-primary" |
| 69 | variant="outline" |
| 70 | size="sm" |
| 71 | > |
| 72 | <SquareCheckBigIcon /> |
| 73 | mark as read |
nothing calls this directly
no test coverage detected