Vitalik
8 months ago
26 changed files with 509 additions and 136 deletions
@ -1,3 +1,7 @@
@@ -1,3 +1,7 @@
|
||||
API_URL=https://tasks-api.rwsbank.com.ua |
||||
SOCKET_URL=https://tasks-api.rwsbank.com.ua |
||||
ONE_SIGNAL_KEY=5e1a5e18-33e5-4ed3-8423-45b1abc354c6 |
||||
# API_URL=https://tasks-api.rwsbank.com.ua |
||||
# SOCKET_URL=https://tasks-api.rwsbank.com.ua |
||||
# ONE_SIGNAL_KEY=5e1a5e18-33e5-4ed3-8423-45b1abc354c6 |
||||
|
||||
API_URL=https://taskme-api.work-jetup.site |
||||
SOCKET_URL=https://taskme-api.work-jetup.site |
||||
ONE_SIGNAL_KEY=8b9066f5-8c3f-49f7-bef4-c5ab621f9d27 |
||||
|
@ -1,4 +1,5 @@
@@ -1,4 +1,5 @@
|
||||
export * from './use-call-data.hook' |
||||
export * from './use-call-from.hook' |
||||
export * from './use-call-status.hook' |
||||
export * from './use-call-streams.hook' |
||||
export * from './use-calls-history.hook' |
||||
|
@ -0,0 +1,31 @@
@@ -0,0 +1,31 @@
|
||||
import { useMemo } from 'react' |
||||
import { useCallDataStore } from './use-call-data.hook' |
||||
|
||||
const rtcStatusLabel: Record<RTCIceConnectionState, string> = { |
||||
new: "З'єднання", |
||||
checking: '', |
||||
closed: '', |
||||
completed: '', |
||||
disconnected: '', |
||||
failed: '', |
||||
connected: '', |
||||
} |
||||
|
||||
export const useCallStatus = () => { |
||||
const connectedStatus = useCallDataStore(s => s.connectedStatus) |
||||
|
||||
const label = useMemo(() => { |
||||
if (['new', 'checking'].includes(connectedStatus)) { |
||||
return "З'єднання" |
||||
} |
||||
if (['completed', 'connected'].includes(connectedStatus)) { |
||||
return null |
||||
} |
||||
return "З'єднання" |
||||
}, [connectedStatus]) |
||||
|
||||
return { |
||||
connectedStatus, |
||||
label, |
||||
} |
||||
} |
@ -0,0 +1,52 @@
@@ -0,0 +1,52 @@
|
||||
import React, { FC, useEffect, useState } from 'react' |
||||
import { Txt } from '../elements' |
||||
import { StyleSheet, View } from 'react-native' |
||||
|
||||
interface IProps { |
||||
startTime: number |
||||
intervalMs?: number |
||||
} |
||||
|
||||
export const Timmer: FC<IProps> = ({ startTime, intervalMs = 1000 }) => { |
||||
const [label, setLabel] = useState<string>('00:00') |
||||
|
||||
const formatMilliseconds = milliseconds => { |
||||
const totalSeconds = Math.floor(milliseconds / 1000) |
||||
|
||||
const minutes = Math.floor(totalSeconds / 60) |
||||
const seconds = totalSeconds % 60 |
||||
|
||||
// Форматування часу
|
||||
const formattedTime = `${minutes.toString().padStart(2, '0')}:${seconds |
||||
.toString() |
||||
.padStart(2, '0')}` |
||||
|
||||
return formattedTime |
||||
} |
||||
|
||||
const calcLabel = () => { |
||||
const difference = new Date().getTime() - startTime |
||||
setLabel(formatMilliseconds(difference)) |
||||
} |
||||
|
||||
useEffect(() => { |
||||
const timer = setInterval(() => { |
||||
calcLabel() |
||||
}, intervalMs) |
||||
return () => clearInterval(timer) |
||||
}, [startTime]) |
||||
|
||||
return ( |
||||
<View style={styles.container}> |
||||
<Txt style={styles.label}>{label}</Txt> |
||||
</View> |
||||
) |
||||
} |
||||
|
||||
const styles = StyleSheet.create({ |
||||
container: {}, |
||||
label: { |
||||
color: '#fff', |
||||
fontSize: 20, |
||||
}, |
||||
}) |
Loading…
Reference in new issue