File tree Expand file tree Collapse file tree
apps/code/src/renderer/features/command-center/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ import { useTaskViewed } from "@features/sidebar/hooks/useTaskViewed" ;
12import { useSetHeaderContent } from "@hooks/useSetHeaderContent" ;
23import { SquaresFour } from "@phosphor-icons/react" ;
34import { Box , Flex , Text } from "@radix-ui/themes" ;
4- import { useMemo } from "react" ;
5+ import { useEffect , useMemo } from "react" ;
56import { useCommandCenterData } from "../hooks/useCommandCenterData" ;
67import { useCommandCenterStore } from "../stores/commandCenterStore" ;
78import { CommandCenterGrid } from "./CommandCenterGrid" ;
@@ -10,6 +11,18 @@ import { CommandCenterToolbar } from "./CommandCenterToolbar";
1011export 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 ( ) => (
You can’t perform that action at this time.
0 commit comments