Fix bug where add contact form would reload page
GitLab: #196
Change-Id: I9629febd64317ac3fb48341ff40e285b4047d455
diff --git a/client/src/components/NewContactForm.tsx b/client/src/components/NewContactForm.tsx
index 21ead27..d3e328b 100644
--- a/client/src/components/NewContactForm.tsx
+++ b/client/src/components/NewContactForm.tsx
@@ -18,12 +18,14 @@
import { SearchRounded } from '@mui/icons-material';
import { InputAdornment, InputBase } from '@mui/material';
import { ChangeEvent, useContext, useState } from 'react';
+import { useTranslation } from 'react-i18next';
import { MessengerContext } from '../contexts/MessengerProvider';
export default function NewContactForm() {
const { setSearchQuery } = useContext(MessengerContext);
const [value, setValue] = useState('');
+ const { t } = useTranslation();
const handleChange = (event: ChangeEvent<HTMLInputElement>) => {
setValue(event.target.value);
@@ -31,11 +33,11 @@
};
return (
- <form className="main-search" noValidate autoComplete="off">
+ <div className="main-search">
<InputBase
className="main-search-input"
type="search"
- placeholder="Ajouter un contact"
+ placeholder={t('conversation_add_contact_form')}
value={value}
onChange={handleChange}
startAdornment={
@@ -44,6 +46,6 @@
</InputAdornment>
}
/>
- </form>
+ </div>
);
}
diff --git a/client/src/locale/en/translation.json b/client/src/locale/en/translation.json
index aaaa85f..701998a 100644
--- a/client/src/locale/en/translation.json
+++ b/client/src/locale/en/translation.json
@@ -66,6 +66,7 @@
"message_swarm_created": "Swarm created",
"message_user_joined": "{{user}} joined",
"messages_scroll_to_end": "Scroll to end of conversation",
+ "conversation_add_contact_form": "Add a contact",
"message_input_placeholder_one": "Write to {{member0}}",
"message_input_placeholder_two": "Write to {{member0}} and {{member1}}",
"message_input_placeholder_three": "Write to {{member0}}, {{member1}} and {{member2}}",
diff --git a/client/src/locale/fr/translation.json b/client/src/locale/fr/translation.json
index f40ec7e..d91519f 100644
--- a/client/src/locale/fr/translation.json
+++ b/client/src/locale/fr/translation.json
@@ -66,6 +66,7 @@
"message_swarm_created": "Le Swarm a été créé",
"message_user_joined": "{{user}} s'est joint",
"messages_scroll_to_end": "Faire défiler jusqu'à la fin de la conversation",
+ "conversation_add_contact_form": "Ajouter un contact",
"message_input_placeholder_one": "Écrire à {{member0}}",
"message_input_placeholder_two": "Écrire à {{member0}} et {{member1}}",
"message_input_placeholder_three": "Écrire à {{member0}}, {{member1}} et {{member2}}",