Merge branch 'main' into feat/HYD-858

This commit is contained in:
Chubby Granny Chaser
2025-05-30 14:15:59 +01:00
committed by GitHub
8 changed files with 27 additions and 9 deletions

View File

@@ -29,11 +29,10 @@ export const UserFriendModalAddFriend = ({
setIsAddingFriend(true);
sendFriendRequest(friendCode)
.then(() => {
// TODO: add validation for this input?
setFriendCode("");
})
.catch(() => {
showErrorToast("Não foi possível enviar o pedido de amizade");
showErrorToast(t("error_adding_friend"));
})
.finally(() => {
setIsAddingFriend(false);
@@ -46,8 +45,8 @@ export const UserFriendModalAddFriend = ({
};
const handleClickSeeProfile = () => {
closeModal();
if (friendCode.length === 8) {
closeModal();
navigate(`/profile/${friendCode}`);
}
};
@@ -74,16 +73,19 @@ export const UserFriendModalAddFriend = ({
});
};
const handleChangeFriendCode = (e: React.ChangeEvent<HTMLInputElement>) => {
const friendCode = e.target.value.trim().slice(0, 8);
setFriendCode(friendCode);
};
return (
<>
<div className="user-friend-modal-add-friend__actions">
<TextField
label={t("friend_code")}
value={friendCode}
minLength={8}
maxLength={8}
containerProps={{ style: { width: "100%" } }}
onChange={(e) => setFriendCode(e.target.value)}
onChange={handleChangeFriendCode}
/>
<Button
disabled={isAddingFriend}