From 9275d4499b61a282c46f3e73ac55a8f4b9320eda Mon Sep 17 00:00:00 2001 From: m5r Date: Mon, 6 Dec 2021 22:58:18 +0100 Subject: [PATCH] call recipient from phone calls history --- .../components/phone-calls-list.tsx | 45 ++++++++++++------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/app/phone-calls/components/phone-calls-list.tsx b/app/phone-calls/components/phone-calls-list.tsx index b967e10..539979e 100644 --- a/app/phone-calls/components/phone-calls-list.tsx +++ b/app/phone-calls/components/phone-calls-list.tsx @@ -1,4 +1,5 @@ import { useEffect } from "react"; +import { Link, Routes } from "blitz"; import { HiPhoneMissedCall, HiPhoneIncoming, HiPhoneOutgoing } from "react-icons/hi"; import clsx from "clsx"; @@ -34,27 +35,39 @@ export default function PhoneCallsList() { const isOutboundCall = phoneCall.direction === Direction.Outbound; const isInboundCall = phoneCall.direction === Direction.Inbound; const isMissedCall = isInboundCall && phoneCall.status === CallStatus.NoAnswer; - const recipient = isOutboundCall + const formattedRecipient = isOutboundCall ? phoneCall.toMeta.formattedPhoneNumber : phoneCall.fromMeta.formattedPhoneNumber; + const recipient = isOutboundCall ? phoneCall.to : phoneCall.from; + return ( -
  • -
    - {isOutboundCall ? : null} - {isInboundCall && !isMissedCall ? : null} - {isInboundCall && isMissedCall ? : null} -
    +
  • + + +
    + {isOutboundCall ? : null} + {isInboundCall && !isMissedCall ? ( + + ) : null} + {isInboundCall && isMissedCall ? ( + + ) : null} +
    -
    - {recipient} - - {isOutboundCall ? phoneCall.toMeta.country : phoneCall.fromMeta.country} - -
    +
    + + {formattedRecipient} + + + {isOutboundCall ? phoneCall.toMeta.country : phoneCall.fromMeta.country} + +
    - - {formatRelativeDate(new Date(phoneCall.createdAt))} - + + {formatRelativeDate(new Date(phoneCall.createdAt))} + +
    +
  • ); })}