import { useRosettaColors } from "@/app/hooks/useRosettaColors"; import { useAvatars } from "@/app/providers/AvatarProvider/useAvatars"; import { CallContextValue, CallState } from "@/app/providers/CallProvider/CallProvider"; import { translateDurationToTime } from "@/app/providers/CallProvider/translateDurationTime"; import { useUserInformation } from "@/app/providers/InformationProvider/useUserInformation"; import { Avatar, Box, Flex, Text } from "@mantine/core"; import { IconChevronLeft, IconMicrophone, IconMicrophoneOff, IconPhone, IconPhoneX, IconQrcode, IconVolume, IconVolumeOff, IconX } from "@tabler/icons-react"; export interface CallProps { context: CallContextValue; } export function Call(props: CallProps) { const { activeCall, duration, callState, close, sound, setSound, setMuted, setShowCallView, muted} = props.context; const [userInfo] = useUserInformation(activeCall); const avatars = useAvatars(activeCall); const colors = useRosettaColors(); return ( setShowCallView(false)} justify={'center'} align={'center'}> Back 0 ? '#fff' : undefined} src={avatars.length > 0 ? avatars[0].avatar : undefined} color={'initials'} name={userInfo.title}> {userInfo.title} {callState == CallState.ACTIVE && ({translateDurationToTime(duration)})} {callState == CallState.CONNECTING && (Connecting...)} {callState == CallState.INCOMING && (Incoming call...)} {callState == CallState.ACTIVE || callState == CallState.CONNECTING && ( <> setSound(!sound)} style={{ borderRadius: 25, cursor: 'pointer' }} h={50} bg={sound ? colors.chevrons.active : colors.chevrons.disabled}> {!sound && } {sound && } setMuted(!muted)} style={{ borderRadius: 25, cursor: 'pointer' }} h={50} bg={!muted ? colors.chevrons.active : colors.chevrons.disabled}> {muted && } {!muted && } )} {callState == CallState.INCOMING && ( <> {userInfo.title != "Rosetta" && ( )} )} ) }