Skip to content

Commit 340b038

Browse files
authored
Merge pull request #66 from WildCodeSchool/USX-Champs-formulaire-unifiés
corrections
2 parents 1acc37b + 0816d12 commit 340b038

File tree

10 files changed

+44
-28
lines changed

10 files changed

+44
-28
lines changed

frontend/src/components/forms/groups/GroupForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export default function GroupForm({
7878
name="user_beneficiary"
7979
value={formData.user_beneficiary ?? ""}
8080
onChange={handleChange}
81-
label="Le nom du destinataire"
81+
label="Bénéficiaire"
8282
question="Voulez-vous ajouter un destinataire? "
8383
error={errors.user_beneficiary}
8484
/>

frontend/src/components/groups/Groups.tsx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import type { GetAllMyGroupsQuery } from "../../graphql/generated/graphql-types"
22
import { useToggle } from "../../hooks/useToggle";
33
import type { Message } from "../../types/Message";
44
import { formatDate } from "../../utils/dateCalculator";
5+
import { useMobileNavigationStore } from "../../zustand/mobileNavigationStore";
56
import GroupFormindex from "../forms/groups/index";
67
import Button from "../utils/Button";
78
import Card from "../utils/Card";
@@ -35,8 +36,16 @@ export default function Groups({
3536
onSuccess,
3637
}: GroupsProps) {
3738
const createGroupModal = useToggle(false);
39+
const { setBottomNavVisible } = useMobileNavigationStore();
40+
41+
const openCreateGroupModal = () => {
42+
createGroupModal.open();
43+
setBottomNavVisible(false);
44+
};
45+
3846
const closeCreateGroupModal = () => {
3947
createGroupModal.close();
48+
setBottomNavVisible(true);
4049
};
4150

4251
return (
@@ -51,7 +60,7 @@ export default function Groups({
5160
icon="plus"
5261
colour="green"
5362
small
54-
onClick={createGroupModal.open}
63+
onClick={openCreateGroupModal}
5564
/>
5665
}
5766
>
@@ -93,9 +102,9 @@ export default function Groups({
93102
className="p-0 overflow-y-auto max-h-[72vh] max-md:max-h-full"
94103
>
95104
<GroupFormindex
96-
onCancel={createGroupModal.close}
105+
onCancel={closeCreateGroupModal}
97106
onSuccess={() => {
98-
createGroupModal.close();
107+
closeCreateGroupModal();
99108
onSuccess?.();
100109
}}
101110
/>

frontend/src/components/utils/Input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export default function Input({
5252
{label && (
5353
<label
5454
htmlFor={id}
55-
className={`font-semibold text-md ${theme === "light" ? "text-white" : "dark:text-dark"}`}
55+
className={`font-semibold text-lg mb-2.5 ${theme === "light" ? "text-white" : "dark:text-dark"}`}
5656
>
5757
{label}
5858
</label>

frontend/src/components/utils/InputWithToggle.tsx

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,26 @@ export default function InputWithToggle({
2121
...props
2222
}: InputToggleProps) {
2323
return (
24-
<div className="flex flex-row w-full gap-1 justify-between items-center">
25-
{checked && (
26-
<Input
27-
theme={theme}
28-
{...props}
29-
placeholder={label}
30-
onChange={onChange}
31-
disabled={disabled}
32-
className="placeholder:!text-blue placeholder:!font-bold !text-white !font-bold pr-2"
33-
/>
24+
<div className="flex flex-col w-full">
25+
{checked && label && (
26+
<span className={`font-semibold text-lg mb-2.5 ${theme === "light" ? "text-white" : "text-dark"}`}>
27+
{label}
28+
</span>
3429
)}
35-
{!checked && <span className="text-white font-bold text-lg">{question}</span>}
36-
<ToggleSwitch checked={checked} onChange={onCheckedChange} colour={theme} />
30+
<div className="flex flex-row w-full gap-4 justify-between items-center">
31+
{checked && (
32+
<Input
33+
theme={theme}
34+
{...props}
35+
placeholder={label}
36+
onChange={onChange}
37+
disabled={disabled}
38+
className="placeholder:!text-blue placeholder:!font-bold !text-white !font-bold pr-2"
39+
/>
40+
)}
41+
{!checked && <span className="text-white font-bold text-lg">{question}</span>}
42+
<ToggleSwitch checked={checked} onChange={onCheckedChange} colour={theme} />
43+
</div>
3744
</div>
3845
);
3946
}

frontend/src/components/utils/Modal.tsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,8 @@ export default function Modal({
5757

5858
document.addEventListener("keydown", onKeyDown);
5959

60-
// lock background scroll
61-
const prevOverflow = document.body.style.overflow;
62-
document.body.style.overflow = "hidden";
63-
6460
return () => {
6561
document.removeEventListener("keydown", onKeyDown);
66-
document.body.style.overflow = prevOverflow;
6762
};
6863
}, [isOpen, onClose]);
6964

@@ -92,7 +87,7 @@ export default function Modal({
9287
"rounded-2xl",
9388
sizeClasses[size],
9489
// mobile full screen
95-
mobileFullscreen && "max-md:h-full max-md:max-w-none max-md:rounded-none",
90+
mobileFullscreen && "max-md:h-full max-md:max-w-none max-md:rounded-none max-md:overflow-y-auto",
9691
// if you want internal padding to live here (recommended)
9792
withPadding ? "p-6 max-md:p-6" : "p-0",
9893
colour ? colourClasses[colour] : "bg-white",

frontend/src/components/utils/SearchInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export default function SearchInput({
6666
{label && (
6767
<label
6868
htmlFor={id}
69-
className={`font-semibold text-md ${theme === "dark" ? "text-dark" : "text-white"}`}
69+
className={`font-semibold text-lg mb-2.5 ${theme === "dark" ? "text-dark" : "text-white"}`}
7070
>
7171
{label}
7272
</label>

frontend/src/components/utils/SearchSelectInput.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ export default function SearchSelectInput({
124124
{label && (
125125
<label
126126
htmlFor={id}
127-
className={`font-semibold text-md ${theme === "light" ? "text-white" : "dark:text-dark"}`}
127+
className={`font-semibold text-lg mb-2.5 ${theme === "light" ? "text-white" : "dark:text-dark"}`}
128128
>
129129
{label}
130130
</label>

frontend/src/pages/Conversations.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ export default function Conversations() {
142142
// Handle mobile view changes - hide/show bottom navigation
143143
useEffect(() => {
144144
if (isMobile) {
145-
setBottomNavVisible(mobileView === "groups");
145+
setBottomNavVisible(mobileView === "groups" && !isCreateGroupModalOpen && !isEditGroupModalOpen);
146146
} else {
147147
setBottomNavVisible(true);
148148
}
149-
}, [isMobile, mobileView, setBottomNavVisible]);
149+
}, [isMobile, mobileView, isCreateGroupModalOpen, isEditGroupModalOpen, setBottomNavVisible]);
150150

151151
// Reset mobile view when switching from mobile to desktop
152152
useEffect(() => {

frontend/src/pages/UserProfilePage.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ import {
1414
import consoleErrorDev from "../hooks/erreurMod";
1515
import { useIsMobile } from "../hooks/useIsMobile";
1616
import getProfilePictureUrl, { toBase64 } from "../utils/pictureProfileManager";
17+
import { useMobileNavigationStore } from "../zustand/mobileNavigationStore";
1718
import { useMyProfileStore } from "../zustand/myProfileStore";
1819

1920
const UserProfilePage = () => {
2021
const { userProfile, setUserProfile, clearUserProfile } = useMyProfileStore();
22+
const { setBottomNavVisible } = useMobileNavigationStore();
2123
const navigate = useNavigate();
2224
const isMobile = useIsMobile();
2325
const [imageUrl, setImageUrl] = useState(getProfilePictureUrl(null));
@@ -92,12 +94,14 @@ const UserProfilePage = () => {
9294

9395
const handleEditClick = () => {
9496
setIsEditing(true);
97+
setBottomNavVisible(false);
9598
setMessageError("");
9699
setMessageSuccess("");
97100
};
98101

99102
const handleCancelClick = () => {
100103
setIsEditing(false);
104+
setBottomNavVisible(true);
101105
setProfile({ ...profileBackup });
102106
setImageUrl(getProfilePictureUrl(userProfile?.image_url));
103107
setMessageError("");
@@ -137,6 +141,7 @@ const UserProfilePage = () => {
137141
}
138142

139143
setIsEditing(false);
144+
setBottomNavVisible(true);
140145
if (!userProfile) {
141146
setMessageError("Vous devez être connecté pour modifier votre profil");
142147
return;

frontend/src/pages/userprofile.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
.profile-content-inner {
113113
flex: 1;
114114
overflow-y: auto;
115-
padding-right: 32px;
115+
padding-right: 24px;
116116
margin-right: -24px;
117117
}
118118

0 commit comments

Comments
 (0)