+
+
+
+
+ Images (JPEG, PNG, WebP, AVIF) et vidéos (MP4, WebM, MOV).
+
+
+
+ {!storageConfigured ? (
+
+ Le stockage des médias n'est pas configuré sur le serveur
+ (variables S3_*). L'envoi est désactivé.
+
+ ) : null}
+
+ {errors.length > 0 ? (
+
+ {errors.map((err, index) => (
+ -
+ {err.name ? `${err.name} : ` : ""}
+ {err.error}
+
+ ))}
+
+ ) : null}
+
+ {media.length === 0 ? (
+
+ Aucun média pour le moment. Ajoutez au moins une photo pour pouvoir
+ publier ce carbet.
+
+ ) : (
+
+ {media.map((item, index) => (
+ -
+
+ {item.type === "VIDEO" ? (
+
+ ) : (
+ // eslint-disable-next-line @next/next/no-img-element
+

+ )}
+ {index === 0 ? (
+
+ Couverture
+
+ ) : null}
+
+
+
+
+
+
+
+
+
+ ))}
+
+ )}
+
+ );
+}
diff --git a/src/app/espace-hote/carbets/actions.ts b/src/app/espace-hote/carbets/actions.ts
new file mode 100644
index 0000000..8964376
--- /dev/null
+++ b/src/app/espace-hote/carbets/actions.ts
@@ -0,0 +1,360 @@
+"use server";
+
+import { revalidatePath } from "next/cache";
+import { notFound, redirect } from "next/navigation";
+
+import { amenityLabel, isKnownAmenityKey } from "@/lib/amenities";
+import { canManageCarbet, requireOwnerSession } from "@/lib/carbet-access";
+import { prisma } from "@/lib/prisma";
+import { ensureUniqueCarbetSlug } from "@/lib/slug";
+import { deleteObject } from "@/lib/storage";
+import { Prisma } from "@/generated/prisma/client";
+import { CarbetStatus } from "@/generated/prisma/enums";
+
+import type { CarbetFormState } from "./form-types";
+
+type ParsedCarbet = {
+ title: string;
+ description: string;
+ river: string;
+ latitude: string;
+ longitude: string;
+ embarkPoint: string;
+ pirogueDurationMin: number;
+ capacity: number;
+ status: CarbetStatus;
+ amenities: string[];
+};
+
+function isCarbetStatus(value: string): value is CarbetStatus {
+ return (Object.values(CarbetStatus) as string[]).includes(value);
+}
+
+function parseCarbetForm(formData: FormData): {
+ data: ParsedCarbet;
+ errors: Record