Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.
TypeScript ai-agentai-resume-analyzerapplication-trackerapplication-tracking-systematscareerjob-applicationjob-automationjob-huntingjob-searchjob-seeker-toolsjob-trackerjob-trackingjobsearchjobseekersmcpollamaresumeresume-reviewself-hosted
fix: agent panel full screen issue
Khuram Niazdeadf3447498
diff --git a/__tests__/AgentChatProvider.spec.tsx b/__tests__/AgentChatProvider.spec.tsxindex f15bd43..39ccc65 100644--- a/__tests__/AgentChatProvider.spec.tsx+++ b/__tests__/AgentChatProvider.spec.tsx@@ -52,6 +52,7 @@ import {} from "@/actions/agentChat.actions";import { getUserSettings } from "@/actions/userSettings.actions";import { checkOllamaConnection } from "@/utils/ai.utils";+import { APP_CONSTANTS } from "@/lib/constants";function Probe() {const c = useAgentChat();@@ -83,6 +84,7 @@ function Probe() {<span data-testid="state">{`${c.isOpen}|${c.approvalPending}|${c.interruptedTurn}|${holder}|${c.preflight.ok}`}</span><span data-testid="composer-nonce">{c.composerNonce}</span><span data-testid="panel-expanded">{String(c.isPanelExpanded)}</span>+ <span data-testid="panel-width">{c.panelWidth}</span><span data-testid="review-stream">{c.toolStreams["rv1"] ?? ""}</span><span data-testid="job-writes">{c.jobWrites}</span></div>@@ -545,6 +547,19 @@ describe("AgentChatProvider", () => {expect(screen.getByTestId("review-stream")).toHaveTextContent("SCORES:");});+ it("collapses a re-expanded sidebar when the panel is expanded", async () => {+ setup();+ await userEvent.click(screen.getByText("open"));+ await userEvent.click(screen.getByText("toggleSidebar"));+ await userEvent.click(screen.getByText("togglePanelExpand"));+ expect(screen.getByTestId("panel-expanded").textContent).toBe("true");+ expect(screen.getByTestId("sidebar").textContent).toBe("false");+ // The rail is still open at click time; the width must not measure it.+ expect(screen.getByTestId("panel-width").textContent).toBe(+ String(window.innerWidth - APP_CONSTANTS.SIDEBAR_WIDTH.collapsed.px),+ );+ });+it("restores an expanded panel when the sidebar re-expands", async () => {setup();await userEvent.click(screen.getByText("open"));diff --git a/src/components/agent/AgentChatProvider.tsx b/src/components/agent/AgentChatProvider.tsxindex c505dfb..8a431d9 100644--- a/src/components/agent/AgentChatProvider.tsx+++ b/src/components/agent/AgentChatProvider.tsx@@ -105,6 +105,12 @@ function useAgentChatValue(initialMessages: UIMessage[]) {if (isPanelExpanded && (sidebarExpanded || navigated)) togglePanelExpand();}, [sidebarExpanded, isPanelExpanded, pathname, togglePanelExpand]);+ // Collapse first, or the effect above sees an open sidebar and undoes it.+ const toggleExpand = useCallback(() => {+ if (!isPanelExpanded) collapseSidebar();+ togglePanelExpand();+ }, [isPanelExpanded, collapseSidebar, togglePanelExpand]);+const [interruptedTurn, setInterruptedTurn] = useState(false);const [preflight, setPreflight] = useState<Preflight>({checked: false,@@ -412,7 +418,7 @@ function useAgentChatValue(initialMessages: UIMessage[]) {startResize,isResizing,isPanelExpanded,- togglePanelExpand,+ togglePanelExpand: toggleExpand,};}diff --git a/src/hooks/useResizablePanel.ts b/src/hooks/useResizablePanel.tsindex aa98646..226048a 100644--- a/src/hooks/useResizablePanel.ts+++ b/src/hooks/useResizablePanel.ts@@ -41,9 +41,8 @@ export function useResizablePanel(storageKey: string) {if (isExpanded) {next = DEFAULT_WIDTH;} else {- const sidebarWidth =- document.getElementById(APP_CONSTANTS.SIDEBAR_DOM_ID)?.offsetWidth ?? 0;- next = window.innerWidth - sidebarWidth;+ // Not measured: expanding collapses the rail, which hasn't rendered yet.+ next = window.innerWidth - APP_CONSTANTS.SIDEBAR_WIDTH.collapsed.px;}widthRef.current = next;setWidth(next);diff --git a/src/lib/constants.ts b/src/lib/constants.tsindex 26763ec..60ddf27 100644--- a/src/lib/constants.ts+++ b/src/lib/constants.ts@@ -55,7 +55,7 @@ export const APP_CONSTANTS = {// Paired so the rail width and its matching content offset can't drift.SIDEBAR_WIDTH: {expanded: { rail: "w-56", contentOffset: "sm:pl-56" },- collapsed: { rail: "w-14", contentOffset: "sm:pl-14" },+ collapsed: { rail: "w-14", contentOffset: "sm:pl-14", px: 56 },},// Cloud API-key verification timeout. Without it a black-holed TLS