-
{alert.message}
-
{/* Auto-compact threshold indicator with edit */}
{isEditingThreshold ? (
@@ -140,16 +127,13 @@ export const AlertBox = ({ alert, className }: AlertBoxProps) => {
value={thresholdValue}
onChange={(e) => {
const val = parseInt(e.target.value, 10);
- // Allow empty input for easier editing
if (e.target.value === '') {
setThresholdValue(1);
} else if (!isNaN(val)) {
- // Clamp value between 1 and 100
setThresholdValue(Math.max(1, Math.min(100, val)));
}
}}
onBlur={(e) => {
- // On blur, ensure we have a valid value
const val = parseInt(e.target.value, 10);
if (isNaN(val) || val < 1) {
setThresholdValue(1);
@@ -167,11 +151,9 @@ export const AlertBox = ({ alert, className }: AlertBoxProps) => {
}
}}
onFocus={(e) => {
- // Select all text on focus for easier editing
e.target.select();
}}
onClick={(e) => {
- // Prevent issues with text selection
e.stopPropagation();
}}
className="w-12 px-1 text-[10px] bg-white/10 border border-current/30 rounded outline-none text-center focus:bg-white/20 focus:border-current/50 transition-colors"
@@ -213,72 +195,6 @@ export const AlertBox = ({ alert, className }: AlertBoxProps) => {
>
)}
-
-
- {(() => {
- let closestDotIndex = -1;
- if (currentThreshold !== undefined && currentThreshold > 0 && currentThreshold <= 1) {
- let minDistance = Infinity;
- for (let j = 0; j < 30; j++) {
- const dotPos = j / 29;
- const distance = Math.abs(dotPos - currentThreshold);
- if (distance < minDistance) {
- minDistance = distance;
- closestDotIndex = j;
- }
- }
- }
-
- return [...Array(30)].map((_, i) => {
- const progress = alert.progress!.current / alert.progress!.total;
- const progressPercentage = Math.round(progress * 100);
- const dotPosition = i / 29; // 0 to 1 range for 30 dots
- const isActive = dotPosition <= progress;
- const isThresholdDot = i === closestDotIndex;
-
- const getProgressColor = () => {
- if (progressPercentage <= 50) {
- return 'bg-green-500';
- } else if (progressPercentage <= 75) {
- return 'bg-yellow-500';
- } else if (progressPercentage <= 90) {
- return 'bg-orange-500';
- } else {
- return 'bg-red-500';
- }
- };
-
- const progressColor = getProgressColor();
- const inactiveColor = 'bg-gray-300 dark:bg-gray-600';
-
- return (
-
- );
- });
- })()}
-
-
-
-
- {formatTokenCount(alert.progress!.current)}
-
-
- {Math.round((alert.progress!.current / alert.progress!.total) * 100)}%
-
-
-
- {formatTokenCount(alert.progress!.total)}
-
-
{alert.showCompactButton && alert.onCompact && (