diff --git a/ui/src/pages/Inbox.tsx b/ui/src/pages/Inbox.tsx index 149bd292..9e6fa39e 100644 --- a/ui/src/pages/Inbox.tsx +++ b/ui/src/pages/Inbox.tsx @@ -1,4 +1,4 @@ -import { useEffect, useMemo, useState } from "react"; +import { type ReactNode, useEffect, useMemo, useState } from "react"; import { Link, useLocation, useNavigate } from "@/lib/router"; import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query"; import { approvalsApi } from "../api/approvals"; @@ -1051,7 +1051,24 @@ export function Inbox() { {showSeparatorBefore("work_items") && }
- {workItemsToRender.map((item) => { + {workItemsToRender.flatMap((item, index) => { + const todayCutoff = Date.now() - 24 * 60 * 60 * 1000; + const showTodayDivider = + index > 0 && + item.timestamp > 0 && + item.timestamp < todayCutoff && + workItemsToRender[index - 1].timestamp >= todayCutoff; + const elements: ReactNode[] = []; + if (showTodayDivider) { + elements.push( +
+
+ + Today + +
, + ); + } const isMineTab = tab === "mine"; if (item.kind === "approval") { @@ -1076,7 +1093,7 @@ export function Inbox() { } /> ); - return isMineTab ? ( + elements.push(isMineTab ? ( {row} - ) : row; + ) : row); + return elements; } if (item.kind === "failed_run") { @@ -1111,7 +1129,7 @@ export function Inbox() { } /> ); - return isMineTab ? ( + elements.push(isMineTab ? ( {row} - ) : row; + ) : row); + return elements; } if (item.kind === "join_request") { @@ -1143,7 +1162,7 @@ export function Inbox() { } /> ); - return isMineTab ? ( + elements.push(isMineTab ? ( {row} - ) : row; + ) : row); + return elements; } const issue = item.issue; @@ -1212,7 +1232,7 @@ export function Inbox() { /> ); - return isMineTab ? ( + elements.push(isMineTab ? ( {row} - ) : row; + ) : row); + return elements; })}