From edb8fa92649ae967bdd51ce14b6aa3e07a5ac2b3 Mon Sep 17 00:00:00 2001
From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com>
Date: Sat, 27 Dec 2025 17:07:23 +0000
Subject: [PATCH 5/6] fix: Move InfoCard to components folder and remove tests
Co-authored-by: jhbruhn <1036566+jhbruhn@users.noreply.github.com>
---
src/components/ErrorPopover.tsx | 2 +-
.../{ui/info-card.tsx => InfoCard.tsx} | 0
.../WorkflowStepper/StepPopover.tsx | 2 +-
src/components/ui/info-card.test.tsx | 157 ------------------
vitest.config.ts | 6 -
5 files changed, 2 insertions(+), 165 deletions(-)
rename src/components/{ui/info-card.tsx => InfoCard.tsx} (100%)
delete mode 100644 src/components/ui/info-card.test.tsx
diff --git a/src/components/ErrorPopover.tsx b/src/components/ErrorPopover.tsx
index 282f26f..fa2ab14 100644
--- a/src/components/ErrorPopover.tsx
+++ b/src/components/ErrorPopover.tsx
@@ -7,7 +7,7 @@ import {
InfoCardDescription,
InfoCardList,
InfoCardListItem,
-} from "@/components/ui/info-card";
+} from "./InfoCard";
interface ErrorPopoverContentProps {
machineError?: number;
diff --git a/src/components/ui/info-card.tsx b/src/components/InfoCard.tsx
similarity index 100%
rename from src/components/ui/info-card.tsx
rename to src/components/InfoCard.tsx
diff --git a/src/components/WorkflowStepper/StepPopover.tsx b/src/components/WorkflowStepper/StepPopover.tsx
index 741f075..43273e9 100644
--- a/src/components/WorkflowStepper/StepPopover.tsx
+++ b/src/components/WorkflowStepper/StepPopover.tsx
@@ -13,7 +13,7 @@ import {
InfoCardDescription,
InfoCardList,
InfoCardListItem,
-} from "@/components/ui/info-card";
+} from "../InfoCard";
export interface StepPopoverProps {
stepId: number;
diff --git a/src/components/ui/info-card.test.tsx b/src/components/ui/info-card.test.tsx
deleted file mode 100644
index 94ef41b..0000000
--- a/src/components/ui/info-card.test.tsx
+++ /dev/null
@@ -1,157 +0,0 @@
-import { describe, it, expect } from "vitest";
-import { render, screen } from "@testing-library/react";
-import {
- InfoCard,
- InfoCardTitle,
- InfoCardDescription,
- InfoCardList,
- InfoCardListItem,
-} from "./info-card";
-
-describe("InfoCard", () => {
- describe("rendering", () => {
- it("should render with default info variant", () => {
- render(
-
- Test Title
- ,
- );
-
- expect(screen.getByText("Test Title")).toBeTruthy();
- });
-
- it("should render with all variants", () => {
- const variants = ["info", "warning", "error", "success"] as const;
-
- variants.forEach((variant) => {
- const { container } = render(
-
- {variant} Card
- ,
- );
-
- expect(screen.getByText(`${variant} Card`)).toBeTruthy();
- const firstChild = container.firstChild as HTMLElement | null;
- expect(firstChild?.classList.contains("border-l-4")).toBe(true);
- });
- });
-
- it("should render custom icon when provided", () => {
- const CustomIcon = (props: React.SVGProps
) => (
-
- );
-
- render(
-
- Title
- ,
- );
-
- expect(screen.getByTestId("custom-icon")).toBeTruthy();
- });
-
- it("should not render icon when showDefaultIcon is false", () => {
- const { container } = render(
-
- Title
- ,
- );
-
- const svg = container.querySelector("svg");
- expect(svg).toBeNull();
- });
- });
-
- describe("InfoCardTitle", () => {
- it("should render with correct variant colors", () => {
- const { rerender } = render(
- Info Title,
- );
- const infoTitle = screen.getByText("Info Title");
- expect(infoTitle.classList.contains("text-info-900")).toBe(true);
-
- rerender(Error Title);
- const errorTitle = screen.getByText("Error Title");
- expect(errorTitle.classList.contains("text-danger-900")).toBe(true);
- });
- });
-
- describe("InfoCardDescription", () => {
- it("should render description text", () => {
- render(This is a description);
- expect(screen.getByText("This is a description")).toBeTruthy();
- });
-
- it("should apply variant colors", () => {
- render(
-
- Warning description
- ,
- );
- const desc = screen.getByText("Warning description");
- expect(desc.classList.contains("text-warning-800")).toBe(true);
- });
- });
-
- describe("InfoCardList", () => {
- it("should render unordered list by default", () => {
- render(
-
- Item 1
- Item 2
- ,
- );
-
- const list = screen.getByRole("list");
- expect(list.tagName).toBe("UL");
- expect(list.classList.contains("list-disc")).toBe(true);
- });
-
- it("should render ordered list when specified", () => {
- render(
-
- First
- Second
- ,
- );
-
- const list = screen.getByRole("list");
- expect(list.tagName).toBe("OL");
- expect(list.classList.contains("list-decimal")).toBe(true);
- });
-
- it("should render list items", () => {
- render(
-
- Item 1
- Item 2
- ,
- );
-
- expect(screen.getByText("Item 1")).toBeTruthy();
- expect(screen.getByText("Item 2")).toBeTruthy();
- });
- });
-
- describe("composition", () => {
- it("should render full info card with all components", () => {
- render(
-
- Success!
-
- Operation completed successfully
-
-
- First step completed
- Second step completed
-
- ,
- );
-
- expect(screen.getByText("Success!")).toBeTruthy();
- expect(screen.getByText("Operation completed successfully")).toBeTruthy();
- expect(screen.getByText("First step completed")).toBeTruthy();
- expect(screen.getByText("Second step completed")).toBeTruthy();
- });
- });
-});
diff --git a/vitest.config.ts b/vitest.config.ts
index a265845..527491c 100644
--- a/vitest.config.ts
+++ b/vitest.config.ts
@@ -1,12 +1,6 @@
import { defineConfig } from "vitest/config";
-import { resolve } from "path";
export default defineConfig({
- resolve: {
- alias: {
- "@": resolve(__dirname, "./src"),
- },
- },
test: {
globals: true,
environment: "jsdom",
From 7c3f79ae7e650afb91efa82d004cbfa04424f3c0 Mon Sep 17 00:00:00 2001
From: Jan-Henrik Bruhn
Date: Sun, 28 Dec 2025 09:00:03 +0100
Subject: [PATCH 6/6] fix: TypeScript error in InfoCard icon variant check
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Fix TypeScript build error "Type 'null' cannot be used as an index type"
by adding explicit null check for variant before indexing defaultIcons.
The variant from VariantProps can be null even with a default value,
so TypeScript requires an explicit check.
Changes:
- Added null check: showDefaultIcon && variant
- Added 'as const' to defaultIcons for better type inference
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Sonnet 4.5
---
src/components/InfoCard.tsx | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/components/InfoCard.tsx b/src/components/InfoCard.tsx
index 2ba19d0..40c33d0 100644
--- a/src/components/InfoCard.tsx
+++ b/src/components/InfoCard.tsx
@@ -103,9 +103,10 @@ function InfoCard({
warning: ExclamationTriangleIcon,
error: ExclamationTriangleIcon,
success: CheckCircleIcon,
- };
+ } as const;
- const Icon = CustomIcon || (showDefaultIcon ? defaultIcons[variant] : null);
+ const Icon =
+ CustomIcon || (showDefaultIcon && variant ? defaultIcons[variant] : null);
return (