diff --git a/ui/src/pages/Inbox.tsx b/ui/src/pages/Inbox.tsx index 194e13ef..f3cefdd0 100644 --- a/ui/src/pages/Inbox.tsx +++ b/ui/src/pages/Inbox.tsx @@ -498,6 +498,31 @@ export function Inbox() { }, }); + const [fadingOutIssues, setFadingOutIssues] = useState>(new Set()); + + const markReadMutation = useMutation({ + mutationFn: (id: string) => issuesApi.markRead(id), + onMutate: (id) => { + setFadingOutIssues((prev) => new Set(prev).add(id)); + }, + onSuccess: () => { + if (selectedCompanyId) { + queryClient.invalidateQueries({ queryKey: queryKeys.issues.listTouchedByMe(selectedCompanyId) }); + queryClient.invalidateQueries({ queryKey: queryKeys.issues.listUnreadTouchedByMe(selectedCompanyId) }); + queryClient.invalidateQueries({ queryKey: queryKeys.sidebarBadges(selectedCompanyId) }); + } + }, + onSettled: (_data, _error, id) => { + setTimeout(() => { + setFadingOutIssues((prev) => { + const next = new Set(prev); + next.delete(id); + return next; + }); + }, 300); + }, + }); + if (!selectedCompanyId) { return ; } @@ -867,35 +892,53 @@ export function Inbox() { My Recent Issues
- {touchedIssues.map((issue) => ( - - - - - - - - {issue.identifier ?? issue.id.slice(0, 8)} - - {issue.title} - - {issue.lastExternalCommentAt - ? `commented ${timeAgo(issue.lastExternalCommentAt)}` - : `updated ${timeAgo(issue.updatedAt)}`} - - - ))} + {touchedIssues.map((issue) => { + const isUnread = issue.isUnreadForMe && !fadingOutIssues.has(issue.id); + const isFading = fadingOutIssues.has(issue.id); + return ( +
+ + {(isUnread || isFading) && ( + + )} + + + + + + {issue.identifier ?? issue.id.slice(0, 8)} + + {issue.title} + + {issue.lastExternalCommentAt + ? `commented ${timeAgo(issue.lastExternalCommentAt)}` + : `updated ${timeAgo(issue.updatedAt)}`} + + +
+ ); + })}