- {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(
+
,
+ );
+ }
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;
})}