Skip to content

Commit 7cd0e1c

Browse files
committed
Mark command center tasks as viewed to clear sidebar indicators
1 parent c22a7ee commit 7cd0e1c

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

apps/code/src/renderer/features/command-center/components/CommandCenterView.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
import { useTaskViewed } from "@features/sidebar/hooks/useTaskViewed";
12
import { useSetHeaderContent } from "@hooks/useSetHeaderContent";
23
import { SquaresFour } from "@phosphor-icons/react";
34
import { Box, Flex, Text } from "@radix-ui/themes";
4-
import { useMemo } from "react";
5+
import { useEffect, useMemo } from "react";
56
import { useCommandCenterData } from "../hooks/useCommandCenterData";
67
import { useCommandCenterStore } from "../stores/commandCenterStore";
78
import { CommandCenterGrid } from "./CommandCenterGrid";
@@ -10,6 +11,18 @@ import { CommandCenterToolbar } from "./CommandCenterToolbar";
1011
export function CommandCenterView() {
1112
const layout = useCommandCenterStore((s) => s.layout);
1213
const { cells, summary } = useCommandCenterData();
14+
const { markAsViewed } = useTaskViewed();
15+
16+
const visibleTaskIds = useMemo(
17+
() => cells.map((c) => c.taskId).filter((id): id is string => id != null),
18+
[cells],
19+
);
20+
21+
useEffect(() => {
22+
for (const taskId of visibleTaskIds) {
23+
markAsViewed(taskId);
24+
}
25+
}, [visibleTaskIds, markAsViewed]);
1326

1427
const headerContent = useMemo(
1528
() => (

0 commit comments

Comments
 (0)