Skip to content

Commit

Permalink
feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Kedrihan committed Jul 15, 2024
1 parent d2cb866 commit 7bb5cb9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 12 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useQueryParams } from '@common/hooks/useQueryParams';
import { BackspaceIcon, PhoneIcon } from '@heroicons/react/solid';
import { BackspaceIcon, PhoneIcon, ChatAltIcon} from '@heroicons/react/solid';
import cn from 'classnames';
import React, { useLayoutEffect } from 'react';
import { useForm } from 'react-hook-form';
Expand Down Expand Up @@ -38,15 +38,22 @@ const DialerKeyboard: React.FC = () => {
}
setValue('number', number + val);
};

const startMessage = (phoneNumber: string) => {
if (phoneNumber.length !== 8) {
return;
}
navigate(`/messages/new/${phoneNumber}`);
};

const removeOne = () => setValue('number', watch('number').toString().slice(0, -1));

const handleCall = () => {
const number = watch('number').toString();
if (number.length !== 8) {
return;
}

initializeCall(watch('number').toString());
initializeCall(number);
};

useLayoutEffect(() => {
Expand Down Expand Up @@ -91,12 +98,20 @@ const DialerKeyboard: React.FC = () => {
<DialerButton label={9} onClick={() => add('9')} />
<DialerButton label="-" onClick={() => add('-')} />
<DialerButton label={0} onClick={() => add('0')} />
<DialerButton label={<BackspaceIcon className="h-8 w-8" />} onClick={removeOne} />
<DialerButton label={<BackspaceIcon className="h-8 w-8" />} onClick={removeOne} />
</div>
<div className="grid grid-cols-2 justify-items-center mx-8">
<DialerButton
type="submit"
label={<PhoneIcon className="text-white h-8 w-8" />}
onClick={handleCall}
className="col-start-2 bg-[#2DD158] hover:bg-[#21B147]"
className="bg-[#2DD158] hover:bg-[#21B147]"
/>
<DialerButton
type="submit"
label={<ChatAltIcon className="text-white h-12 w-12" />}
onClick={() => startMessage(watch('number').toString())}
className="bg-[#2DD158] hover:bg-[#21B147]"
/>
</div>
</div>
Expand All @@ -105,4 +120,4 @@ const DialerKeyboard: React.FC = () => {
);
};

export default DialerKeyboard;
export default DialerKeyboard;
8 changes: 2 additions & 6 deletions resources/[soz]/soz-phone/src/nui/locale/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,17 +154,13 @@
},
"MESSAGES": {
"MESSAGES": {
"MESSAGE_CONVERSATION_CREATE_ALL_NUMBERS_FAILED": "Aucun des numéros n'ont été trouvés!",
"UNREAD_MESSAGES": "Vous avez {{ count }} message(s) non lu(s)",
"MESSAGE_GROUP_CREATE_SOME_NUMBERS_FAILED": "({{ numbers }}) ne sont pas attribués."
"UNREAD_MESSAGES": "Vous avez {{ count }} message(s) non lu(s)"
},
"FEEDBACK": {
"CONVERSATION_CREATE_ONE_NUMBER_FAILED": "{{ number }} n'est pas un numéro attribués",
"CONVERSATION_CREATE_ONE_NUMBER_FAILED": "{{ number }} n'est pas un numéro attribué",
"NEW_MESSAGE_FAILED": "Erreur d'envoi",
"INVALID_PHONE_NUMBER": "Numéro de téléphone invalide",
"MESSAGE_CONVERSATION_DUPLICATE": "Cette conversation existe déjà!",
"MESSAGE_GROUP_CREATE_FAILED": "Erreur lors de la création du groupe",
"MESSAGE_GROUP_CREATE_MINE": "Vous ne pouvez pas vous ajouter vous-même !",
"FETCHED_MESSAGES_FAILED": "Impossible de retrouver les messages",
"DELETE_CONVERSATION_FAILED": "Impossible de supprimer la conversation"
},
Expand Down

0 comments on commit 7bb5cb9

Please sign in to comment.