From c53c54a32834ce97d46a404fcf740e14730e9cfd Mon Sep 17 00:00:00 2001 From: Antoine D <106921102+Suboyyy@users.noreply.github.com> Date: Fri, 27 Sep 2024 11:29:51 +0200 Subject: [PATCH] Merge master (#390) * Feat/delete image (#389) * fix: image put true if already true * feat: delete button + deleteImage function * feat: add delete button and function * todo * feat: checkbox to delete image works * feat: argg --------- Co-authored-by: Antoine D * fix: image preview no longer in itemModal * fix: lol username "with #" * change image upload text color * fix: delete img (normaly it works) * fix: Change the environment variable * fix: image input fix color --------- Co-authored-by: Antoine D --- src/app/(dashboard)/dashboard/account/page.tsx | 7 ++++++- src/app/robots.tsx | 2 +- src/components/UI/FileInput.tsx | 5 ++++- src/components/dashboard/ItemModal.tsx | 17 +++++++++++++++-- src/components/dashboard/PartnerModal.tsx | 1 + src/components/dashboard/TournamentModal.tsx | 3 +++ src/components/landing/LoginModal.tsx | 2 +- 7 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/app/(dashboard)/dashboard/account/page.tsx b/src/app/(dashboard)/dashboard/account/page.tsx index 1eddb2c1..b0b8154b 100644 --- a/src/app/(dashboard)/dashboard/account/page.tsx +++ b/src/app/(dashboard)/dashboard/account/page.tsx @@ -100,7 +100,12 @@ const Account = () => { - + )} -

+

Choisir un fichier{' '} {type .map((t) => `.${t}`) diff --git a/src/components/dashboard/ItemModal.tsx b/src/components/dashboard/ItemModal.tsx index 95024fab..ef107d52 100644 --- a/src/components/dashboard/ItemModal.tsx +++ b/src/components/dashboard/ItemModal.tsx @@ -26,6 +26,7 @@ const ItemModal = ({ const [infos, setInfos] = useState(item?.infos || null); const [logo, setLogo] = useState(null); const [display, setDisplay] = useState(item?.display || false); + const [deleteImg, setDeleteImg] = useState(false); const [attribute, setAttribute] = useState(item?.attribute || null); const [category, setCategory] = useState(item?.category || null); @@ -47,6 +48,10 @@ const ItemModal = ({ return `${year}-${month}-${day}T${hours}:${minutes}`; }; + function deleteLogo(): void { + setDeleteImg(!deleteImg); + } + return ( { let image; - if (item?.image || logo) { + if ((item?.image || logo) && !deleteImg) { image = true; } @@ -129,7 +134,15 @@ const ItemModal = ({ onChange={(value) => setQuantity(value as unknown as number)} />