mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-05-08 09:53:25 +00:00
fix(frontend): remove density tooltip sparkline
This commit is contained in:
parent
f6846443f3
commit
dc888eb92a
6 changed files with 12 additions and 69 deletions
|
|
@ -1227,6 +1227,12 @@ should present alert-triggered and anomaly-triggered Patrol toggles as distinct
|
|||
controls, and `frontend-modern/src/components/patrol/PatrolStatusBar.tsx`
|
||||
should render compact activity breakdown and scoped-trigger-state copy from the
|
||||
shared transport rather than leaving busy Patrol periods as unexplained noise.
|
||||
On the main Patrol page, though, that same governed activity context belongs
|
||||
inside `frontend-modern/src/features/patrol/PatrolIntelligenceSummary.tsx`
|
||||
alongside the verification readout rather than as a second full-width band
|
||||
above the findings workspace. If `PatrolStatusBar.tsx` is reused elsewhere, it
|
||||
must stay a compact factual support surface and must not reintroduce a parallel
|
||||
page-level verdict strip once the summary shell already owns that explanation.
|
||||
|
||||
Shared primitive consumers that split status-dot tone and status-text tone
|
||||
must now keep both values routed through the same exported presentation helper.
|
||||
|
|
|
|||
|
|
@ -107,27 +107,6 @@ export const DensityMap: Component<DensityMapProps> = (props) => {
|
|||
)}
|
||||
</Show>
|
||||
</div>
|
||||
<Show when={hoveredFocusDetail()?.sparklinePath}>
|
||||
{(path) => (
|
||||
<div class="mt-1 flex justify-end">
|
||||
<svg
|
||||
viewBox="0 0 64 22"
|
||||
class="h-4 w-[72px] overflow-visible"
|
||||
aria-hidden="true"
|
||||
data-density-map-tooltip-sparkline="true"
|
||||
>
|
||||
<path
|
||||
d={path()}
|
||||
fill="none"
|
||||
stroke={hover().seriesColor}
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
stroke-width="1.75"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
)}
|
||||
</Show>
|
||||
</div>
|
||||
</TooltipPortal>
|
||||
)}
|
||||
|
|
|
|||
|
|
@ -651,13 +651,11 @@ describe('shared primitive guardrails', () => {
|
|||
expect(densityMapSource).not.toContain('Top activity overview');
|
||||
expect(densityMapSource).not.toContain('detail().currentValue');
|
||||
expect(densityMapSource).toContain('data-density-map-tooltip="true"');
|
||||
expect(densityMapSource).toContain('data-density-map-tooltip-sparkline="true"');
|
||||
expect(densityMapSource).not.toContain('data-density-map-tooltip-sparkline="true"');
|
||||
expect(densityMapSource).toContain('grid-cols-[auto_minmax(0,1fr)_auto]');
|
||||
expect(densityMapSource).not.toContain('max-w-[94px]');
|
||||
expect(densityMapSource).toContain('whitespace-nowrap text-[11px] font-semibold text-emerald-400');
|
||||
expect(densityMapSource).toContain('whitespace-nowrap text-[11px] font-semibold text-base-content');
|
||||
expect(densityMapSource).toContain('mt-1 flex justify-end');
|
||||
expect(densityMapSource).toContain('w-[72px] overflow-visible');
|
||||
expect(densityMapSource).not.toContain('timeRangeToMs');
|
||||
expect(densityMapSource).not.toContain('createSignal');
|
||||
expect(densityMapSource).not.toContain('ctx.fillRect');
|
||||
|
|
@ -673,6 +671,8 @@ describe('shared primitive guardrails', () => {
|
|||
expect(densityMapModelSource).toContain('formatDensityMapHoverTime');
|
||||
expect(densityMapModelSource).toContain('getDensityMapColumnIndexForTimestamp');
|
||||
expect(densityMapModelSource).toContain('getDensityMapCellOpacity');
|
||||
expect(densityMapModelSource).not.toContain('buildDensityMapFocusSparklinePath');
|
||||
expect(densityMapModelSource).not.toContain('sparklinePath: string | null;');
|
||||
expect(densityMapModelSource).not.toContain('currentValue:');
|
||||
expect(densityMapModelSource).not.toContain('hoveredValue:');
|
||||
});
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@ describe('DensityMap', () => {
|
|||
expect(screen.getByText('Current')).toBeInTheDocument();
|
||||
expect(screen.getByText('Peak')).toBeInTheDocument();
|
||||
expect(document.querySelector('[data-density-map-tooltip="true"]')).not.toBeNull();
|
||||
expect(document.querySelector('[data-density-map-tooltip-sparkline="true"]')).not.toBeNull();
|
||||
expect(document.querySelector('[data-density-map-tooltip-sparkline="true"]')).toBeNull();
|
||||
});
|
||||
|
||||
it('publishes synchronized hover identity and clears it on leave', () => {
|
||||
|
|
@ -214,7 +214,6 @@ describe('DensityMap', () => {
|
|||
seriesName: 'Alpha',
|
||||
peakValue: 32,
|
||||
});
|
||||
expect(detail?.sparklinePath).toContain('M');
|
||||
});
|
||||
|
||||
it('keeps the density-map card free of persistent focus chrome while preserving overview count', () => {
|
||||
|
|
|
|||
|
|
@ -33,7 +33,6 @@ export interface DensityMapFocusDetail {
|
|||
seriesColor: string;
|
||||
seriesId: string;
|
||||
seriesName: string;
|
||||
sparklinePath: string | null;
|
||||
}
|
||||
|
||||
export interface DensityMapChartData {
|
||||
|
|
@ -281,54 +280,14 @@ export function buildDensityMapFocusDetail(options: {
|
|||
peakValue = peakValue === null ? point.value : Math.max(peakValue, point.value);
|
||||
}
|
||||
|
||||
const sparklinePath = buildDensityMapFocusSparklinePath({
|
||||
points,
|
||||
rangeMs: options.data.rangeMs,
|
||||
windowStart: options.data.windowStart,
|
||||
});
|
||||
|
||||
return {
|
||||
peakValue,
|
||||
seriesColor: series.color,
|
||||
seriesId,
|
||||
seriesName: series.name || 'Unknown',
|
||||
sparklinePath,
|
||||
};
|
||||
}
|
||||
|
||||
export function hasDensityMapFocusActivity(detail: DensityMapFocusDetail): boolean {
|
||||
return detail.peakValue !== null;
|
||||
}
|
||||
|
||||
const buildDensityMapFocusSparklinePath = (options: {
|
||||
points: Array<{ timestamp: number; value: number }>;
|
||||
rangeMs: number;
|
||||
windowStart: number;
|
||||
}): string | null => {
|
||||
const { points, rangeMs, windowStart } = options;
|
||||
if (points.length < 2 || rangeMs <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const width = 64;
|
||||
const height = 22;
|
||||
let maxValue = 0;
|
||||
for (const point of points) {
|
||||
if (point.value > maxValue) {
|
||||
maxValue = point.value;
|
||||
}
|
||||
}
|
||||
if (maxValue <= 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const commands: string[] = [];
|
||||
for (let index = 0; index < points.length; index += 1) {
|
||||
const point = points[index];
|
||||
const x = clampDensityMapValue((point.timestamp - windowStart) / rangeMs, 0, 1) * width;
|
||||
const y = height - clampDensityMapValue(point.value / maxValue, 0, 1) * height;
|
||||
commands.push(`${index === 0 ? 'M' : 'L'}${x.toFixed(1)},${y.toFixed(1)}`);
|
||||
}
|
||||
|
||||
return commands.join(' ');
|
||||
};
|
||||
|
|
|
|||
|
|
@ -797,7 +797,7 @@ test.describe.serial("Summary hover selection", () => {
|
|||
.toEqual(resolvedBaselineCounts);
|
||||
});
|
||||
|
||||
test("keeps density-map detail inside the hover tooltip instead of card chrome", async ({
|
||||
test("keeps density-map detail inside the hover tooltip without extra chart chrome", async ({
|
||||
page,
|
||||
}, testInfo) => {
|
||||
test.skip(
|
||||
|
|
@ -826,6 +826,6 @@ test.describe.serial("Summary hover selection", () => {
|
|||
await expect(tooltip).toContainText("Peak");
|
||||
await expect(
|
||||
tooltip.locator('[data-density-map-tooltip-sparkline="true"]'),
|
||||
).toBeVisible();
|
||||
).toHaveCount(0);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue