diff --git a/frontend/__tests__/routes/planner-tab.test.tsx b/frontend/__tests__/routes/planner-tab.test.tsx
new file mode 100644
index 0000000000..8f139ffc5f
--- /dev/null
+++ b/frontend/__tests__/routes/planner-tab.test.tsx
@@ -0,0 +1,55 @@
+import { screen } from "@testing-library/react";
+import { describe, expect, it, vi, beforeEach } from "vitest";
+import PlannerTab from "#/routes/planner-tab";
+import { renderWithProviders } from "../../test-utils";
+import { useConversationStore } from "#/stores/conversation-store";
+
+// Mock the handle plan click hook
+vi.mock("#/hooks/use-handle-plan-click", () => ({
+ useHandlePlanClick: () => ({
+ handlePlanClick: vi.fn(),
+ }),
+}));
+
+describe("PlannerTab", () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ // Reset store state to defaults
+ useConversationStore.setState({
+ planContent: null,
+ conversationMode: "code",
+ });
+ });
+
+ describe("Create a plan button", () => {
+ it("should be enabled when conversation mode is 'code'", () => {
+ // Arrange
+ useConversationStore.setState({
+ planContent: null,
+ conversationMode: "code",
+ });
+
+ // Act
+ renderWithProviders();
+
+ // Assert
+ const button = screen.getByRole("button");
+ expect(button).not.toBeDisabled();
+ });
+
+ it("should be disabled when conversation mode is 'plan'", () => {
+ // Arrange
+ useConversationStore.setState({
+ planContent: null,
+ conversationMode: "plan",
+ });
+
+ // Act
+ renderWithProviders();
+
+ // Assert
+ const button = screen.getByRole("button");
+ expect(button).toBeDisabled();
+ });
+ });
+});
diff --git a/frontend/src/routes/planner-tab.tsx b/frontend/src/routes/planner-tab.tsx
index dfda9b9a8f..11e5f8e3c0 100644
--- a/frontend/src/routes/planner-tab.tsx
+++ b/frontend/src/routes/planner-tab.tsx
@@ -7,6 +7,7 @@ import { useScrollToBottom } from "#/hooks/use-scroll-to-bottom";
import { MarkdownRenderer } from "#/components/features/markdown/markdown-renderer";
import { planComponents } from "#/components/features/markdown/plan-components";
import { useHandlePlanClick } from "#/hooks/use-handle-plan-click";
+import { cn } from "#/utils/utils";
function PlannerTab() {
const { t } = useTranslation();
@@ -14,7 +15,8 @@ function PlannerTab() {
React.useRef(null),
);
- const { planContent } = useConversationStore();
+ const { planContent, conversationMode } = useConversationStore();
+ const isPlanMode = conversationMode === "plan";
const { handlePlanClick } = useHandlePlanClick();
if (planContent !== null && planContent !== undefined) {
@@ -40,7 +42,13 @@ function PlannerTab() {