tweak(phone/call-modal): Tweaked appearance of call modal (#178)

Correct actions will now display if calling another player.

Also added ringing flavor text when the person calling is the transmitter.
This commit is contained in:
Taso authored and GitHub committed 2021-04-03 18:02:47 -04:00
1 parent 4bf3248168
commit 8ca8b1b5fe
15 files changed
+248 -136

No files matched your search

@@ -46,7 +46,8 @@ InjectDebugData([
{
id: 3,
display: 'Chip',
number: '111-1111',
number: '603-275-8373',
avatar: 'http://i.tasoagc.dev/2QYV',
},
{
id: 4,
+11 -2
View File
@@ -9,10 +9,11 @@ interface IUseContacts {
getDisplayByNumber: (number: string) => string;
getContactByNumber: (number: string) => Contact | null;
getContact: (id: number) => Contact | null;
getPictureByNumber: (number: string) => string | null;
}
export const useContacts = (): IUseContacts => {
const contacts = useRecoilValue(contactsState.contacts);
const contacts = useRecoilValue<Contact[]>(contactsState.contacts);
const getDisplayByNumber = useCallback(
(number: string) => {
@@ -22,6 +23,14 @@ export const useContacts = (): IUseContacts => {
[contacts],
);
const getPictureByNumber = useCallback(
(number: string) => {
const found = contacts.find((contact) => contact.number === number);
return found ? found.avatar : null;
},
[contacts],
);
const getContactByNumber = useCallback(
(number: string): Contact | null => {
for (const contact of contacts) {
@@ -42,5 +51,5 @@ export const useContacts = (): IUseContacts => {
[contacts],
);
return { contacts, getDisplayByNumber, getContact, getContactByNumber };
return { contacts, getDisplayByNumber, getContact, getContactByNumber, getPictureByNumber };
};
@@ -0,0 +1,3 @@
const getBackgroundPath = (bg: string) => `media/backgrounds/${bg}`;
export default getBackgroundPath;