mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-04 22:16:40 +00:00
mad formatting
This commit is contained in:
1 parent
6777498bcc
commit
046447b0fb
74 files changed
+329
-309
No files matched your search
@@ -19,7 +19,7 @@ export const CallModal = () => {
|
||||
<CallTimer isAccepted={call?.accepted} />
|
||||
</Box>
|
||||
<div className={classes.actions}>
|
||||
<CallControls size="medium" />
|
||||
<CallControls size='medium' />
|
||||
</div>
|
||||
</AppContent>
|
||||
</AppWrapper>
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import React, { useEffect, useRef } from 'react';
|
||||
import { useDuration } from '../hooks/useDuration';
|
||||
|
||||
|
||||
const runTimer = (updatedTime, setDuration) => {
|
||||
let newTime = { ...updatedTime.current };
|
||||
if (newTime.m >= 60) {
|
||||
@@ -17,25 +16,24 @@ const runTimer = (updatedTime, setDuration) => {
|
||||
newTime = { ...newTime, ms: newTime.ms + 1 };
|
||||
updatedTime.current = newTime;
|
||||
setDuration(newTime);
|
||||
}
|
||||
};
|
||||
|
||||
function CallTimer({ isAccepted }) {
|
||||
const { duration, setDuration } = useDuration();
|
||||
const updatedTime = useRef({ ms: 0, s: 0, m: 0, h: 0 });
|
||||
const timer = useRef(null)
|
||||
|
||||
const timer = useRef(null);
|
||||
|
||||
useEffect(() => {
|
||||
if (isAccepted) {
|
||||
runTimer(updatedTime, setDuration)
|
||||
runTimer(updatedTime, setDuration);
|
||||
timer.current = setInterval(() => {
|
||||
runTimer(updatedTime, setDuration)
|
||||
runTimer(updatedTime, setDuration);
|
||||
}, 10);
|
||||
} else {
|
||||
clearInterval(timer.current);
|
||||
timer.current = null;
|
||||
}
|
||||
return () => clearInterval(timer.current)
|
||||
return () => clearInterval(timer.current);
|
||||
}, [isAccepted, setDuration]);
|
||||
|
||||
if (!duration || !isAccepted) return null;
|
||||
|
||||
@@ -3,14 +3,14 @@ import { atom } from 'recoil';
|
||||
export const callerState = {
|
||||
currentCall: atom({
|
||||
key: 'currentCall',
|
||||
default: null
|
||||
default: null,
|
||||
}),
|
||||
callModal: atom({
|
||||
key: 'callingModal',
|
||||
default: false
|
||||
default: false,
|
||||
}),
|
||||
callDuration: atom({
|
||||
key: 'callDuration',
|
||||
default: {ms: 0, s: 0, m: 0, h: 0}
|
||||
})
|
||||
default: { ms: 0, s: 0, m: 0, h: 0 },
|
||||
}),
|
||||
};
|
||||
@@ -8,5 +8,5 @@ interface ModalProps {
|
||||
|
||||
export const useCallModal = (): ModalProps => {
|
||||
const [modal, setModal] = useRecoilState(callerState.callModal);
|
||||
return { modal, setModal }
|
||||
}
|
||||
return { modal, setModal };
|
||||
};
|
||||
Reference in new issue
Block a user