From 932f0b8f57928ab1f2b31df893df59e4fc7e16c7 Mon Sep 17 00:00:00 2001 From: Balaj Marius Date: Fri, 30 May 2025 10:37:16 +0300 Subject: [PATCH 1/3] fix: improve readability of errors on darkmode --- client/src/index.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/index.css b/client/src/index.css index 858f9e7f..3c00cad1 100644 --- a/client/src/index.css +++ b/client/src/index.css @@ -91,7 +91,7 @@ h1 { --muted-foreground: 215 20.2% 65.1%; --accent: 217.2 32.6% 17.5%; --accent-foreground: 210 40% 98%; - --destructive: 0 62.8% 30.6%; + --destructive: 0 81.8% 54.6%; --destructive-foreground: 210 40% 98%; --border: 217.2 24% 24%; --input: 217.2 24% 24%; From e6cffe7e99a0835ce64a8e2cef8510ef797e1ceb Mon Sep 17 00:00:00 2001 From: Balaj Marius Date: Fri, 30 May 2025 14:29:02 +0300 Subject: [PATCH 2/3] feat: added custom placeholder for no resource templates --- client/src/components/ResourcesTab.tsx | 12 ++++++++++++ client/src/components/ui/combobox.tsx | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/client/src/components/ResourcesTab.tsx b/client/src/components/ResourcesTab.tsx index 35742799..2491e1c5 100644 --- a/client/src/components/ResourcesTab.tsx +++ b/client/src/components/ResourcesTab.tsx @@ -248,6 +248,18 @@ const ResourcesTab = ({ id={key} placeholder={`Enter ${key}`} value={templateValues[key] || ""} + emptyMessage={ +
+ This resource does not support{" "} + + completions + + . +
+ } onChange={(value) => handleTemplateValueChange(key, value) } diff --git a/client/src/components/ui/combobox.tsx b/client/src/components/ui/combobox.tsx index 02624086..337c566b 100644 --- a/client/src/components/ui/combobox.tsx +++ b/client/src/components/ui/combobox.tsx @@ -21,7 +21,7 @@ interface ComboboxProps { onInputChange: (value: string) => void; options: string[]; placeholder?: string; - emptyMessage?: string; + emptyMessage?: string | React.ReactNode; id?: string; } From 3900c49557ef8dd9d79a594fb4ee30e3d201d1a4 Mon Sep 17 00:00:00 2001 From: Balaj Marius Date: Fri, 30 May 2025 14:37:46 +0300 Subject: [PATCH 3/3] feat: added combobox test --- client/src/components/__tests__/combobox.tsx | 41 ++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 client/src/components/__tests__/combobox.tsx diff --git a/client/src/components/__tests__/combobox.tsx b/client/src/components/__tests__/combobox.tsx new file mode 100644 index 00000000..167eee66 --- /dev/null +++ b/client/src/components/__tests__/combobox.tsx @@ -0,0 +1,41 @@ +import { render, screen, fireEvent } from "@testing-library/react"; +import "@testing-library/jest-dom"; +import { describe, it } from "@jest/globals"; +import { Combobox } from "../ui/combobox"; + +describe("combobox", () => { + it("should render custom empty message", async () => { + const customMessage = ( +
Custom empty message
+ ); + render( + {}} + onInputChange={() => {}} + options={[]} + emptyMessage={customMessage} + />, + ); + + fireEvent.click(screen.getByRole("combobox")); + + expect(await screen.findByTestId("custom-empty")).toBeInTheDocument(); + expect(screen.getByText("Custom empty message")).toBeInTheDocument(); + }); + + it("should render default empty message", async () => { + render( + {}} + onInputChange={() => {}} + options={[]} + />, + ); + + fireEvent.click(screen.getByRole("combobox")); + + expect(await screen.findByText("No results found.")).toBeInTheDocument(); + }); +});