From fd80bdb0d40c7d7192847b23736c700c4176e624 Mon Sep 17 00:00:00 2001 From: Ethan Dickson Date: Thu, 18 Dec 2025 15:32:30 +1100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20fix:=20make=20context=20usage=20?= =?UTF-8?q?tooltip=20slider=20interactive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Both hover (tooltip) and click (popover) now show the same interactive auto-compaction threshold slider with identical styling. - Tooltip passes full autoCompaction config instead of read-only threshold - Popover styled to match tooltip (bg, border, shadow, text size) - Removed dead code: HorizontalThresholdIndicator and autoCompactionThreshold prop --- .../ContextUsageIndicatorButton.tsx | 8 ++- .../RightSidebar/ContextUsageBar.tsx | 16 +----- .../RightSidebar/ThresholdSlider.tsx | 53 ------------------- 3 files changed, 7 insertions(+), 70 deletions(-) diff --git a/src/browser/components/ContextUsageIndicatorButton.tsx b/src/browser/components/ContextUsageIndicatorButton.tsx index 4c2187eee1..cb8b40b058 100644 --- a/src/browser/components/ContextUsageIndicatorButton.tsx +++ b/src/browser/components/ContextUsageIndicatorButton.tsx @@ -64,11 +64,15 @@ export const ContextUsageIndicatorButton: React.FC - + - + diff --git a/src/browser/components/RightSidebar/ContextUsageBar.tsx b/src/browser/components/RightSidebar/ContextUsageBar.tsx index dbc68e4acb..63c987dbf0 100644 --- a/src/browser/components/RightSidebar/ContextUsageBar.tsx +++ b/src/browser/components/RightSidebar/ContextUsageBar.tsx @@ -1,18 +1,12 @@ import React from "react"; import { TokenMeter } from "./TokenMeter"; -import { - HorizontalThresholdSlider, - HorizontalThresholdIndicator, - type AutoCompactionConfig, -} from "./ThresholdSlider"; +import { HorizontalThresholdSlider, type AutoCompactionConfig } from "./ThresholdSlider"; import { formatTokens, type TokenMeterData } from "@/common/utils/tokens/tokenMeterUtils"; interface ContextUsageBarProps { data: TokenMeterData; /** Auto-compaction settings for threshold slider */ autoCompaction?: AutoCompactionConfig; - /** Show text-only indicator for auto-compaction threshold (for tooltips) */ - autoCompactionThreshold?: number; showTitle?: boolean; testId?: string; } @@ -20,7 +14,6 @@ interface ContextUsageBarProps { const ContextUsageBarComponent: React.FC = ({ data, autoCompaction, - autoCompactionThreshold, showTitle = true, testId, }) => { @@ -32,10 +25,6 @@ const ContextUsageBarComponent: React.FC = ({ const showWarning = !data.maxTokens; - // Show read-only indicator when threshold provided but no interactive config - const showReadOnlyIndicator = - autoCompactionThreshold !== undefined && !autoCompaction && data.maxTokens; - return (
@@ -54,9 +43,6 @@ const ContextUsageBarComponent: React.FC = ({
{autoCompaction && data.maxTokens && } - {showReadOnlyIndicator && ( - - )}
{showWarning && ( diff --git a/src/browser/components/RightSidebar/ThresholdSlider.tsx b/src/browser/components/RightSidebar/ThresholdSlider.tsx index 8f864e4d16..1434c134ad 100644 --- a/src/browser/components/RightSidebar/ThresholdSlider.tsx +++ b/src/browser/components/RightSidebar/ThresholdSlider.tsx @@ -279,56 +279,3 @@ export const HorizontalThresholdSlider: React.FC<{ config: AutoCompactionConfig export const VerticalThresholdSlider: React.FC<{ config: AutoCompactionConfig }> = ({ config }) => ( ); - -// ----- Read-only indicator (for tooltips) ----- - -interface ThresholdIndicatorProps { - /** Threshold percentage (0-100). 100 means disabled. */ - threshold: number; -} - -/** - * A read-only visual indicator showing the auto-compaction threshold position. - * Shows the same notch markers as the interactive slider, but without drag functionality. - * Designed for use in tooltips where interaction isn't possible. - */ -export const HorizontalThresholdIndicator: React.FC = ({ threshold }) => { - const isEnabled = threshold < DISABLE_THRESHOLD; - const color = isEnabled ? "var(--color-plan-mode)" : "var(--color-muted)"; - - // Container covers the full bar area - const containerStyle: React.CSSProperties = { - position: "absolute", - top: 0, - bottom: 0, - left: 0, - right: 0, - zIndex: 50, - pointerEvents: "none", - }; - - // Indicator positioning - const indicatorStyle: React.CSSProperties = { - position: "absolute", - pointerEvents: "none", - display: "flex", - alignItems: "center", - left: `${threshold}%`, - top: "50%", - transform: "translate(-50%, -50%)", - flexDirection: "column", - }; - - // Line between triangles - const lineStyle: React.CSSProperties = { width: 1, height: 6, background: color }; - - return ( -
-
- -
- -
-
- ); -};