From e43be96ccc7c82165916f18558bd600185e31e37 Mon Sep 17 00:00:00 2001 From: qalle-git <36276161+qalle-git@users.noreply.github.com> Date: Wed, 10 Jan 2024 20:37:07 +0100 Subject: [PATCH 1/4] feat(phone/contacts): add initials as icon on null --- .../contacts/components/List/ContactList.tsx | 17 ++++++++-- .../contacts/components/views/ContactInfo.tsx | 33 ++++++++++--------- .../components/list/MessageGroupItem.tsx | 13 ++++++-- apps/phone/src/utils/misc.ts | 16 +++++++++ 4 files changed, 59 insertions(+), 20 deletions(-) diff --git a/apps/phone/src/apps/contacts/components/List/ContactList.tsx b/apps/phone/src/apps/contacts/components/List/ContactList.tsx index b4d55a378..a3d596bc4 100644 --- a/apps/phone/src/apps/contacts/components/List/ContactList.tsx +++ b/apps/phone/src/apps/contacts/components/List/ContactList.tsx @@ -11,6 +11,7 @@ import { useContactActions } from '@apps/contacts/hooks/useContactActions'; import { useMyPhoneNumber } from '@os/simcard/hooks/useMyPhoneNumber'; import { Phone, MessageSquare, Plus } from 'lucide-react'; import { List, ListItem, NPWDButton } from '@npwd/keyos'; +import { initials } from '@utils/misc'; export const ContactList: React.FC = () => { const filteredContacts = useFilteredContacts(); @@ -47,7 +48,7 @@ export const ContactList: React.FC = () => { .sort() .map((letter) => (
{contact.display} diff --git a/apps/phone/src/apps/contacts/components/views/ContactInfo.tsx b/apps/phone/src/apps/contacts/components/views/ContactInfo.tsx index 15faa19cb..88dfc09e6 100644 --- a/apps/phone/src/apps/contacts/components/views/ContactInfo.tsx +++ b/apps/phone/src/apps/contacts/components/views/ContactInfo.tsx @@ -17,6 +17,7 @@ import LogDebugEvent from '@os/debug/LogDebugEvents'; import { useModal } from '@apps/contacts/hooks/useModal'; import { usePhone } from '@os/phone/hooks/usePhone'; import { cn } from '@utils/css'; +import { initials } from '@utils/misc'; interface ContactInfoRouteParams { mode: string; @@ -161,7 +162,7 @@ const ContactsInfoPage: React.FC = () => { if (addNumber) setNumber(addNumber); if (avatarParam) setAvatar(avatarParam); if (nameParam) setName(nameParam); - }, [addNumber, avatar, avatarParam, nameParam]); + }, [addNumber, avatarParam, nameParam]); if (!ResourceConfig) return null; @@ -174,17 +175,25 @@ const ContactsInfoPage: React.FC = () => { />