Skip to content

Commit

Permalink
changed hook
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen-Gordon committed Mar 24, 2024
1 parent ddf7172 commit 79020e0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/app/@auth/(.)transaction/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ export default function Page() {
setIsLoading(false);
}, [txState]);

const payeeName = useFindPayeeName(transaction.from);

return (
<>
{!isLoading && (
Expand All @@ -65,7 +67,7 @@ export default function Page() {
</div>
<div className='text-blue-400'>
{transaction.from == address ? 'From' : 'To'}{' '}
{ useFindPayeeName(transaction.from)}
{payeeName}
</div>
<div className='mt-10 grid grid-cols-2 gap-4 text-white'>
<div>
Expand Down
4 changes: 2 additions & 2 deletions src/app/hooks/useFindPayeeName.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const useFindPayeeName = (payeeAddress: string) => {
const contactsState = useSelector((state: RootState) => state.contacts.value);

const findPayeeName = (payeeAddress: string): string | null => {
if (!payeeAddress || contactsState.length === 0) {
return null;
if ( contactsState.length === 0) {
return truncateEthAddress(payeeAddress);
}

const contact = contactsState.find(
Expand Down

0 comments on commit 79020e0

Please sign in to comment.