mirror of
https://github.com/R0m1k3/PleinR.git
synced 2026-10-16 19:56:57 +02:00
Backend: edition image d'entete + logo des adherents
- Champs upload image d'entete (coverUrl) et logo (logoUrl) dans le formulaire d'edition d'un adherent (composant ImageField, fichier -> data-URL via hidden input) - updateMember persiste desormais coverUrl + logoUrl, et revalide la fiche publique /adherents/[id] - serverActions.bodySizeLimit a 4mb (les data-URL depassent la limite par defaut de 1mb) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
6ee7e44c1b
commit
b4d94f2115
4 files changed
+98
No files matched your search
@@ -141,6 +141,8 @@ export async function updateMember(formData: FormData) {
|
||||
phone: String(formData.get("phone") ?? "").trim() || null,
|
||||
website: String(formData.get("website") ?? "").trim() || null,
|
||||
memberSince: formData.get("memberSince") ? Number(formData.get("memberSince")) : null,
|
||||
coverUrl: String(formData.get("coverUrl") ?? "").trim() || null,
|
||||
logoUrl: String(formData.get("logoUrl") ?? "").trim() || null,
|
||||
tags: String(formData.get("tags") ?? "").trim() || null,
|
||||
hours: String(formData.get("hours") ?? "").trim() || null,
|
||||
status: String(formData.get("status") ?? "pending") as "active" | "pending",
|
||||
@@ -149,6 +151,7 @@ export async function updateMember(formData: FormData) {
|
||||
.where(eq(members.id, id));
|
||||
|
||||
revalidatePath("/backend/adherents");
|
||||
revalidatePath(`/adherents/${id}`);
|
||||
revalidatePath("/");
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import { auth } from "@/auth";
|
||||
import { db } from "@/db";
|
||||
import { categories, members } from "@/db/schema";
|
||||
import { can } from "@/lib/rbac";
|
||||
import { ImageField } from "@/components/ImageField";
|
||||
import { deleteMember, updateMember } from "../../actions";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
@@ -110,6 +111,11 @@ export default async function EditMemberPage({
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="grid grid-2" style={{ gap: 16, marginTop: 16 }}>
|
||||
<ImageField name="coverUrl" label="Image d'entête (bannière)" defaultValue={member.coverUrl ?? ""} height={130} />
|
||||
<ImageField name="logoUrl" label="Logo" defaultValue={member.logoUrl ?? ""} height={130} />
|
||||
</div>
|
||||
|
||||
<div style={{ marginTop: 16 }}>
|
||||
<label className="field-label">Description (une ligne vide sépare les paragraphes)</label>
|
||||
<textarea name="description" rows={4} defaultValue={member.description ?? ""} className="field" style={{ resize: "vertical" }} />
|
||||
|
||||
Reference in new issue
Block a user