mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 14:38:45 +00:00
feat(contacts/nui | calling/client|server): getName | close modal on add | show dail history
This commit is contained in:
1 parent
0f10eac796
commit
89ea248d32
9 files changed
+72
-43
No files matched your search
@@ -2,13 +2,19 @@ import { useRecoilValue } from 'recoil';
|
||||
import { contactsState } from './state';
|
||||
|
||||
import { ContactProps } from '../../../common/typings/contact';
|
||||
import { useCall } from '../../../modal/hooks/useCall';
|
||||
import { useCallback } from 'react';
|
||||
|
||||
interface IUseContacts {
|
||||
contacts: ContactProps[]
|
||||
|
||||
getDisplayByNumber: (number: string) => string;
|
||||
}
|
||||
|
||||
export const useContacts = (): IUseContacts => {
|
||||
const contacts = useRecoilValue(contactsState.contacts);
|
||||
return { contacts };
|
||||
const getDisplayByNumber = useCallback((number: string) => {
|
||||
const found = contacts.find((contact) => contact.number === number)
|
||||
return found ? found.display : number
|
||||
}, [contacts])
|
||||
return { contacts, getDisplayByNumber };
|
||||
};
|
||||
Reference in new issue
Block a user