fix(rental): extract category labels en fichier neutre (importable client)
All checks were successful
CI / test (pull_request) Successful in 2m9s
All checks were successful
CI / test (pull_request) Successful in 2m9s
This commit is contained in:
parent
46d3c2d3ab
commit
90cc7a94af
3 changed files with 24 additions and 30 deletions
|
|
@ -2,8 +2,7 @@
|
|||
|
||||
import { useState, useTransition } from "react";
|
||||
import { FormField, inputCls, selectCls, textareaCls } from "@/components/admin/FormField";
|
||||
import { RENTAL_CATEGORY_LABEL } from "@/lib/admin/rental-items";
|
||||
import { RentalCategory } from "@/generated/prisma/enums";
|
||||
import { RENTAL_CATEGORY_LABEL, RENTAL_CATEGORIES } from "@/lib/rental-category-labels";
|
||||
|
||||
type Props = {
|
||||
providers: { id: string; name: string; isSystemD: boolean }[];
|
||||
|
|
@ -26,14 +25,6 @@ type Props = {
|
|||
submitLabel?: string;
|
||||
};
|
||||
|
||||
const CATEGORIES: RentalCategory[] = [
|
||||
RentalCategory.SLEEP,
|
||||
RentalCategory.NAVIGATION,
|
||||
RentalCategory.FISHING,
|
||||
RentalCategory.COOKING,
|
||||
RentalCategory.SAFETY,
|
||||
];
|
||||
|
||||
export function ItemForm({ providers, initial = {}, action, submitLabel = "Enregistrer" }: Props) {
|
||||
const [pending, startTransition] = useTransition();
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
|
|
@ -66,7 +57,7 @@ export function ItemForm({ providers, initial = {}, action, submitLabel = "Enreg
|
|||
<FormField label="Catégorie" required>
|
||||
<select name="category" defaultValue={initial.category ?? ""} required className={selectCls}>
|
||||
<option value="" disabled>— sélectionner —</option>
|
||||
{CATEGORIES.map((c) => (
|
||||
{RENTAL_CATEGORIES.map((c) => (
|
||||
<option key={c} value={c}>{RENTAL_CATEGORY_LABEL[c]}</option>
|
||||
))}
|
||||
</select>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue