Open-source agentic AI Search Execution Platform. Track AI visibility, find opportunities, and let agents turn signals into prioritized actions and drafted fixes across ChatGPT, Claude, Gemini, Google AI Overviews, Google AI Mode, Perplexity, Grok, and Microsoft Copilot.
TypeScript aeoai-agentai-searchanswer-engine-optimizationbrand-monitoringchatgptclaudecopilotdockergeminigeogoogle-ai-overviewsgrokmcpnextjsopen-sourceperplexityseosupabasetypescript
feat(prompts): show a day block's positions in a styled tooltip on the positions panel (#1090)
Cihanc9fdcf65c40b
diff --git a/web/src/components/prompts/prompt-positions-sheet.test.tsx b/web/src/components/prompts/prompt-positions-sheet.test.tsxindex b38b4d245..5652be80a 100644--- a/web/src/components/prompts/prompt-positions-sheet.test.tsx+++ b/web/src/components/prompts/prompt-positions-sheet.test.tsx@@ -8,7 +8,8 @@ import type { PromptPositionsData } from '@/lib/actions/prompt-positions';/*** The positions panel over a week: its cards carry the table's answer,- * mention and citation counts beside the days.+ * mention and citation counts beside the days, and a day block shows its+ * positions in a tooltip when hovered.*/const { getPromptPositions } = vi.hoisted(() => ({ getPromptPositions: vi.fn() }));@@ -143,4 +144,21 @@ describe('PromptPositionsSheet', () => {'Answer counts cover the platforms your plan includes.',);});++ it("shows a day's positions in a tooltip when its block is hovered", async () => {+ await open();+ const block = document.querySelector<HTMLElement>('[data-day="2026-10-08"]')!;+ // The browser's own tooltip is gone: it lagged and couldn't be styled.+ expect(block.hasAttribute('title')).toBe(false);++ await act(async () => {+ block.dispatchEvent(new MouseEvent('mouseenter', { bubbles: true }));+ block.dispatchEvent(new MouseEvent('mousemove', { bubbles: true }));+ await new Promise((r) => setTimeout(r, 50));+ });+ const tooltip = document.querySelector('[data-slot="tooltip-content"]');+ expect(tooltip?.textContent).toContain('Oct 8, 2026 · 1 run');+ expect(tooltip?.textContent).toContain('Mentioned · Mid · #2 of 3');+ expect(tooltip?.textContent).toContain('Cited · Early · #1 of 4');+ });});diff --git a/web/src/components/prompts/prompt-positions-sheet.tsx b/web/src/components/prompts/prompt-positions-sheet.tsxindex 71f1145de..6f209cc26 100644--- a/web/src/components/prompts/prompt-positions-sheet.tsx+++ b/web/src/components/prompts/prompt-positions-sheet.tsx@@ -36,6 +36,12 @@ import { Button } from '@/components/ui/button';import { buttonVariants } from '@/components/ui/button-variants';import { Skeleton } from '@/components/ui/skeleton';import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs';+import {+ Tooltip,+ TooltipContent,+ TooltipTrigger,+ createTooltipHandle,+} from '@/components/ui/tooltip';import { AIProviderAvatar, resolveAIProvider } from '@/components/ai-provider-avatar';import { PositionLabel } from '@/components/position-label';import { cn } from '@/lib/utils';@@ -831,6 +837,11 @@ function dayTooltip(day: string, entry: PlatformDay | undefined): string {function Heatmap({ platform, days }: { platform: PlatformPositions; days: string[] }) {const byDay = useMemo(() => new Map(platform.days.map((d) => [d.day, d])), [platform.days]);+ // One tooltip for the row, showing whichever block is hovered: up to 90+ // blocks a row would otherwise mean as many tooltips. It opens at once and+ // follows the pointer from block to block. The blocks stay out of the tab+ // order (a row of 90 stops); the platform's day list says the same.+ const tooltip = useMemo(() => createTooltipHandle<string>(), []);return (<divrole="img"@@ -840,13 +851,26 @@ function Heatmap({ platform, days }: { platform: PlatformPositions; days: string{days.map((day) => {const entry = byDay.get(day);return (- <span+ <TooltipTriggerkey={day}- title={dayTooltip(day, entry)}- className={cn('h-3 w-3 rounded-[3px]', CELL_CLASS[cellTone(entry)])}+ handle={tooltip}+ payload={dayTooltip(day, entry)}+ delay={0}+ closeDelay={0}+ render={+ <span+ data-day={day}+ className={cn('h-3 w-3 rounded-[3px]', CELL_CLASS[cellTone(entry)])}+ />+ }/>);})}+ <Tooltip handle={tooltip}>+ {({ payload }) => (+ <TooltipContent className="whitespace-pre-line">{payload}</TooltipContent>+ )}+ </Tooltip></div>);}diff --git a/web/src/components/ui/tooltip.tsx b/web/src/components/ui/tooltip.tsxnew file mode 100644index 000000000..428cdb5fb--- /dev/null+++ b/web/src/components/ui/tooltip.tsx@@ -0,0 +1,41 @@+'use client';++import * as React from 'react';+import { Tooltip as TooltipPrimitive } from '@base-ui/react/tooltip';++import { cn } from '@/lib/utils';++// Thin styled wrapper around `@base-ui/react/tooltip`, in the popover look of+// `select.tsx` and `combobox.tsx`. Many triggers can share one tooltip through+// a handle (`createTooltipHandle`), each passing what it shows as `payload`.++const Tooltip = TooltipPrimitive.Root;+const TooltipTrigger = TooltipPrimitive.Trigger;+const createTooltipHandle = TooltipPrimitive.createHandle;++function TooltipContent({+ className,+ children,+ side = 'top',+ sideOffset = 6,+ ...props+}: TooltipPrimitive.Popup.Props & Pick<TooltipPrimitive.Positioner.Props, 'side' | 'sideOffset'>) {+ return (+ <TooltipPrimitive.Portal>+ <TooltipPrimitive.Positioner side={side} sideOffset={sideOffset} className="isolate z-50">+ <TooltipPrimitive.Popup+ data-slot="tooltip-content"+ className={cn(+ 'z-50 max-w-64 origin-(--transform-origin) rounded-md bg-popover px-2.5 py-1.5 text-xs text-popover-foreground shadow-md ring-1 ring-foreground/10 duration-100 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95',+ className,+ )}+ {...props}+ >+ {children}+ </TooltipPrimitive.Popup>+ </TooltipPrimitive.Positioner>+ </TooltipPrimitive.Portal>+ );+}++export { Tooltip, TooltipContent, TooltipTrigger, createTooltipHandle };