diff --git a/src/components/admin/catalog/catalog-items-table/add-item-form-fields.tsx b/src/components/admin/catalog/catalog-items-table/add-item-form-fields.tsx new file mode 100644 index 00000000..dce7dfc0 --- /dev/null +++ b/src/components/admin/catalog/catalog-items-table/add-item-form-fields.tsx @@ -0,0 +1,175 @@ +"use client"; + +import { Input } from "@/components/ui/input"; +import { Label } from "@/components/ui/label"; +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select"; +import { type DEFAULT_NEW_ITEM, POINTS_TYPES } from "./types"; + +export interface AddItemFormFieldsProps { + data: typeof DEFAULT_NEW_ITEM; + onChange: (key: string, value: string | number) => void; +} + +export function AddItemFormFields({ data, onChange }: AddItemFormFieldsProps) { + return ( +
+
+ + onChange("catalogName", e.target.value)} + /> +
+
+ + onChange("itemIds", e.target.value)} + /> +
+ +
+
+ + + onChange("costCredits", parseInt(e.target.value, 10) || 0) + } + /> +
+
+ + + onChange("costPoints", parseInt(e.target.value, 10) || 0) + } + /> +
+
+ + +
+
+ +
+
+ + + onChange("amount", parseInt(e.target.value, 10) || 1) + } + /> +
+
+ + + onChange("orderNumber", parseInt(e.target.value, 10) || 0) + } + /> +
+
+ + onChange("offerId", parseInt(e.target.value, 10))} + /> +
+
+ +
+
+ + + onChange("limitedSells", parseInt(e.target.value, 10) || 0) + } + /> +
+
+ + + onChange("limitedStack", parseInt(e.target.value, 10) || 0) + } + /> +
+
+ +
+
+ + +
+
+ + +
+
+ +
+ + onChange("extradata", e.target.value)} + placeholder="Optional extra data" + /> +
+
+ ); +} diff --git a/src/components/admin/catalog/catalog-items-table/catalog-items-table.tsx b/src/components/admin/catalog/catalog-items-table/catalog-items-table.tsx index 9d09306c..74e02a37 100644 --- a/src/components/admin/catalog/catalog-items-table/catalog-items-table.tsx +++ b/src/components/admin/catalog/catalog-items-table/catalog-items-table.tsx @@ -95,6 +95,7 @@ import { MovePageCombobox, ToggleField, } from "./field-helpers"; +import { AddItemFormFields } from "./add-item-form-fields"; import { FurniIcon } from "./furni-icon"; import { SongPicker } from "./song-picker"; import { @@ -796,171 +797,6 @@ export function CatalogItemsTable({ } // ── Add Item Form Fields (for "Add" dialog) ─────────────────── - function AddItemFormFields({ - data, - onChange, - }: { - data: typeof DEFAULT_NEW_ITEM; - onChange: (key: string, value: string | number) => void; - }) { - return ( -
-
- - onChange("catalogName", e.target.value)} - /> -
-
- - onChange("itemIds", e.target.value)} - /> -
- -
-
- - - onChange("costCredits", parseInt(e.target.value, 10) || 0) - } - /> -
-
- - - onChange("costPoints", parseInt(e.target.value, 10) || 0) - } - /> -
-
- - -
-
- -
-
- - - onChange("amount", parseInt(e.target.value, 10) || 1) - } - /> -
-
- - - onChange("orderNumber", parseInt(e.target.value, 10) || 0) - } - /> -
-
- - - onChange("offerId", parseInt(e.target.value, 10)) - } - /> -
-
- -
-
- - - onChange("limitedSells", parseInt(e.target.value, 10) || 0) - } - /> -
-
- - - onChange("limitedStack", parseInt(e.target.value, 10) || 0) - } - /> -
-
- -
-
- - -
-
- - -
-
- -
- - onChange("extradata", e.target.value)} - placeholder="Optional extra data" - /> -
-
- ); - } return ( <>