Новое вложение ЗВОНОК теперь отправляется от лица звонящего
This commit is contained in:
@@ -4,6 +4,7 @@ import { Avatar, Box, Flex, Text } from "@mantine/core";
|
||||
import { useRosettaColors } from "@/app/hooks/useRosettaColors";
|
||||
import { IconPhoneOutgoing, IconX } from "@tabler/icons-react";
|
||||
import { translateDurationToTime } from "@/app/providers/CallProvider/translateDurationTime";
|
||||
import { usePublicKey } from "@/app/providers/AccountProvider/usePublicKey";
|
||||
|
||||
export function MessageCall(props: AttachmentProps) {
|
||||
const {
|
||||
@@ -13,9 +14,10 @@ export function MessageCall(props: AttachmentProps) {
|
||||
props.attachment,
|
||||
props.parent,
|
||||
);
|
||||
const publicKey = usePublicKey();
|
||||
const preview = getPreview();
|
||||
const callerRole = preview.split("::")[0];
|
||||
const duration = parseInt(preview.split("::")[1]);
|
||||
const caller = props.parent.from == publicKey;
|
||||
const duration = parseInt(preview);
|
||||
const colors = useRosettaColors();
|
||||
const error = duration == 0;
|
||||
|
||||
@@ -30,10 +32,10 @@ export function MessageCall(props: AttachmentProps) {
|
||||
<Flex gap={'sm'} direction={'row'}>
|
||||
<Avatar bg={error ? colors.error : colors.brandColor} size={40}>
|
||||
{!error && <>
|
||||
{callerRole == "0" && (
|
||||
{!caller && (
|
||||
<IconPhoneOutgoing color={'white'} size={22}></IconPhoneOutgoing>
|
||||
)}
|
||||
{callerRole == "1" && (
|
||||
{caller && (
|
||||
<IconPhoneOutgoing color={'white'} size={22} style={{
|
||||
transform: 'rotate(180deg)'
|
||||
}}></IconPhoneOutgoing>
|
||||
@@ -45,7 +47,7 @@ export function MessageCall(props: AttachmentProps) {
|
||||
</Avatar>
|
||||
<Flex direction={'column'} gap={5}>
|
||||
<Text size={'sm'}>{
|
||||
error ? (callerRole == "0" ? "Missed call" : "Rejected call") : (callerRole == "0" ? "Incoming call" : "Outgoing call")
|
||||
error ? (!caller ? "Missed call" : "Rejected call") : (!caller ? "Incoming call" : "Outgoing call")
|
||||
}</Text>
|
||||
{!error &&
|
||||
<Text size={'xs'} c={colors.chevrons.active}>
|
||||
|
||||
Reference in New Issue
Block a user