Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
refactor(desktop-app): remove dead widthForCursor helper from chat-drawer resize
Diego Zacarias5d6d31f55cc4
diff --git a/desktop-app/ui/src/hooks/__tests__/useChatDrawerResize.test.ts b/desktop-app/ui/src/hooks/__tests__/useChatDrawerResize.test.tsindex 77a1e3712..e6808fa0c 100644--- a/desktop-app/ui/src/hooks/__tests__/useChatDrawerResize.test.ts+++ b/desktop-app/ui/src/hooks/__tests__/useChatDrawerResize.test.ts@@ -1,5 +1,5 @@import { describe, expect, it } from 'vitest'-import { CHAT_DRAWER_MIN_WIDTH, clampWidth, widthForCursor } from '../useChatDrawerResize'+import { CHAT_DRAWER_MIN_WIDTH, clampWidth } from '../useChatDrawerResize'// R2-M1: the drawer resize hook's pure logic (clamp, drag mapping) had no direct// coverage — an inverted min/max or a reversed drag direction would leave every@@ -55,19 +55,3 @@ describe('clampWidth embed floor (docked sizing)', () => {expect(clampWidth(300, 700)).toBe(CHAT_DRAWER_MIN_WIDTH) // 340})})--describe('widthForCursor', () => {- // The drawer's right edge is fixed; width = rightEdge - pointerX. A leftward drag- // (smaller pointerX) must WIDEN the drawer, a rightward drag must narrow it.- it('maps the cursor to rightEdge - pointerX, clamped', () => {- expect(widthForCursor(1000, 400, 2000)).toBe(600)- })-- it('widens as the cursor moves left (smaller pointerX)', () => {- expect(widthForCursor(1000, 300, 2000)).toBeGreaterThan(widthForCursor(1000, 400, 2000))- })-- it('narrows toward the minimum as the cursor moves right past the min', () => {- expect(widthForCursor(1000, 900, 2000)).toBe(CHAT_DRAWER_MIN_WIDTH) // rightEdge-pointerX = 100 -> 340- })-})diff --git a/desktop-app/ui/src/hooks/useChatDrawerResize.ts b/desktop-app/ui/src/hooks/useChatDrawerResize.tsindex a63d80f15..9a018ffe4 100644--- a/desktop-app/ui/src/hooks/useChatDrawerResize.ts+++ b/desktop-app/ui/src/hooks/useChatDrawerResize.ts@@ -88,14 +88,6 @@ export function clampWidth(requested: number, panelWidth: number): number {return Math.round(Math.max(CHAT_DRAWER_MIN_WIDTH, Math.min(dynamicMax, requested)))}-/** Width the drawer should take for a cursor at `pointerX`, given the drawer's- * fixed right edge. Leftward drag (smaller `pointerX`) widens, rightward narrows- * (`rightEdge - pointerX`); result is clamped to the panel. Extracted so the drag- * direction is unit-testable (an inverted mapping would otherwise pass every test). */-export function widthForCursor(rightEdge: number, pointerX: number, panelWidth: number): number {- return clampWidth(rightEdge - pointerX, panelWidth)-}-export type ChatDrawerResize = {/** Current drawer width in px, already clamped to the live panel. */width: number