diff --git a/apps/app/next-env.d.ts b/apps/app/next-env.d.ts
new file mode 100644
index 00000000..c4b7818f
--- /dev/null
+++ b/apps/app/next-env.d.ts
@@ -0,0 +1,6 @@
+///
+///
+import "./.next/dev/types/routes.d.ts";
+
+// NOTE: This file should not be edited
+// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
diff --git a/apps/ui/src/components/ui/category-autocomplete.tsx b/apps/ui/src/components/ui/category-autocomplete.tsx
index 236a08c0..956e6a96 100644
--- a/apps/ui/src/components/ui/category-autocomplete.tsx
+++ b/apps/ui/src/components/ui/category-autocomplete.tsx
@@ -1,5 +1,5 @@
-import * as React from "react";
+import { Tag } from "lucide-react";
import { Autocomplete } from "@/components/ui/autocomplete";
interface CategoryAutocompleteProps {
@@ -9,6 +9,7 @@ interface CategoryAutocompleteProps {
placeholder?: string;
className?: string;
disabled?: boolean;
+ error?: boolean;
"data-testid"?: string;
}
@@ -19,6 +20,7 @@ export function CategoryAutocomplete({
placeholder = "Select or type a category...",
className,
disabled = false,
+ error = false,
"data-testid": testId,
}: CategoryAutocompleteProps) {
return (
@@ -27,10 +29,14 @@ export function CategoryAutocomplete({
onChange={onChange}
options={suggestions}
placeholder={placeholder}
- searchPlaceholder="Search category..."
+ searchPlaceholder="Search or type new category..."
emptyMessage="No category found."
className={className}
disabled={disabled}
+ error={error}
+ icon={Tag}
+ allowCreate
+ createLabel={(v) => `Create "${v}"`}
data-testid={testId}
itemTestIdPrefix="category-option"
/>
diff --git a/apps/ui/tests/utils/components/autocomplete.ts b/apps/ui/tests/utils/components/autocomplete.ts
index 4850cf24..f9015b6d 100644
--- a/apps/ui/tests/utils/components/autocomplete.ts
+++ b/apps/ui/tests/utils/components/autocomplete.ts
@@ -57,3 +57,22 @@ export async function getCategoryOption(
.replace(/\s+/g, "-")}`;
return page.locator(`[data-testid="${optionTestId}"]`);
}
+
+/**
+ * Click the "Create new" option for a category that doesn't exist
+ */
+export async function clickCreateNewCategoryOption(
+ page: Page
+): Promise {
+ const option = page.locator('[data-testid="category-option-create-new"]');
+ await option.click();
+}
+
+/**
+ * Get the "Create new" option element for categories
+ */
+export async function getCreateNewCategoryOption(
+ page: Page
+): Promise {
+ return page.locator('[data-testid="category-option-create-new"]');
+}