Skip to content

Commit 8464f58

Browse files
committed
feat(web): add search results to activity feed (task-6)
- Integrated useActivity hook into search page - Added activity tracking when search results return - Activity includes: query, result count, and description - Tracked in useEffect when searchResults load with duration - Completes Phase 2: Explore + Search (Tasks 1-6)
1 parent d2b2cb2 commit 8464f58

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

apps/web/src/routes/search.lazy.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import { createLazyFileRoute, useSearch } from "@tanstack/react-router";
3636
import { useCallback, useEffect, useMemo, useState } from "react";
3737

3838
import { BORDER_STYLE_GRAY_3, ICON_SIZE, SEARCH, TIME_MS } from '@/config/style-constants';
39+
import { useActivity } from '@/contexts/ActivityContext';
3940
import { useUserInteractions } from "@/hooks/use-user-interactions";
4041
import { useGraphList } from "@/hooks/useGraphList";
4142

@@ -200,6 +201,7 @@ const getEntityTypeColor = (entityType: AutocompleteResult["entity_type"]) => {
200201
const SearchPage = () => {
201202
const searchParams = useSearch({ from: "/search" });
202203
const queryClient = useQueryClient();
204+
const { addActivity } = useActivity();
203205

204206
// View mode state
205207
const [viewMode, setViewMode] = useState<ViewMode>("table");
@@ -433,8 +435,16 @@ const SearchPage = () => {
433435
}
434436
if (searchResults && searchStartTime > 0) {
435437
setSearchDuration(Date.now() - searchStartTime);
438+
439+
// T006: Add search activity to feed
440+
addActivity({
441+
category: 'search',
442+
description: `Searched for "${searchFilters.query}"`,
443+
query: searchFilters.query,
444+
resultCount: searchResults.length,
445+
});
436446
}
437-
}, [searchResults, retryCount, searchStartTime]);
447+
}, [searchResults, retryCount, searchStartTime, searchFilters.query, addActivity]);
438448

439449
const hasResults = searchResults && searchResults.length > 0;
440450
const hasQuery = Boolean(searchFilters.query.trim());

0 commit comments

Comments
 (0)