Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
B
BoxDialer
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
BoxDialer
Commits
245af567
Commit
245af567
authored
Dec 15, 2023
by
Muhammadali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
54e0e39e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
148 additions
and
169 deletions
+148
-169
package.json
package.json
+1
-1
index.jsx
src/components/Modal/index.jsx
+147
-168
No files found.
package.json
View file @
245af567
{
"name"
:
"boxdialer"
,
"version"
:
"4.8.7
4
"
,
"version"
:
"4.8.7
5
"
,
"description"
:
""
,
"main"
:
"src/boxDialer.js"
,
"scripts"
:
{
...
...
src/components/Modal/index.jsx
View file @
245af567
/** @format */
import
React
,
{
useEffect
,
useState
}
from
'
react
'
;
import
MainBlock
,
{
ModalContainer
}
from
'
./style
'
;
import
React
,
{
useEffect
,
useState
}
from
'
react
'
;
import
MainBlock
,
{
ModalContainer
}
from
'
./style
'
;
import
VerticalAlignTopIcon
from
'
@mui/icons-material/VerticalAlignTop
'
;
import
CallEndIcon
from
'
@mui/icons-material/CallEnd
'
;
import
MicIcon
from
'
@mui/icons-material/Mic
'
;
...
...
@@ -14,180 +14,159 @@ import CallCardDropDown from '../CallCardDropDown';
import
ModalNumpad
from
'
../ModalNumpad
'
;
import
{
useConfigHoldMute
}
from
"
../../storage
"
const
Modal
=
({
children
,
hidden
,
hangupButton
,
phoneNumber
,
callType
})
=>
{
const
boxDialer
=
window
.
BoxDialer
;
const
Modal
=
({
children
,
hidden
,
hangupButton
,
phoneNumber
,
callType
})
=>
{
const
boxDialer
=
window
.
BoxDialer
;
const
configHoldMute
=
useConfigHoldMute
((
state
)
=>
state
)
const
[
rollUp
,
setRollUp
]
=
useState
(
false
);
const
[
modalHidden
,
setModalHidden
]
=
useState
(
false
);
const
[
transferModel
,
setTransferModel
]
=
useState
(
true
);
const
[
numpadModal
,
setNumpadModal
]
=
useState
(
false
);
const
configHoldMute
=
useConfigHoldMute
((
state
)
=>
state
)
const
[
rollUp
,
setRollUp
]
=
useState
(
false
);
const
[
modalHidden
,
setModalHidden
]
=
useState
(
false
);
const
[
transferModel
,
setTransferModel
]
=
useState
(
true
);
const
[
numpadModal
,
setNumpadModal
]
=
useState
(
false
);
useEffect
(()
=>
{
setModalHidden
(
hidden
);
},
[
hidden
]);
useEffect
(()
=>
{
setModalHidden
(
hidden
);
},
[
hidden
]);
const
selectUserFunc
=
(
e
)
=>
{
if
(
e
)
{
boxDialer
.
transferButtonClick
(
e
);
setTransferModel
(
true
);
}
};
const
selectUserFunc
=
(
e
)
=>
{
if
(
e
)
{
boxDialer
.
transferButtonClick
(
e
);
setTransferModel
(
true
);
}
};
const
openNumpad
=
()
=>
{
if
(
window
.
BX
)
{
}
else
{
setNumpadModal
(
!
numpadModal
);
}
};
if
(
!
modalHidden
)
return
;
const
openNumpad
=
()
=>
{
if
(
window
.
BX
)
{
}
else
{
setNumpadModal
(
!
numpadModal
);
}
};
if
(
!
modalHidden
)
return
;
const
selectModalType
=
(
type
)
=>
{
switch
(
type
)
{
case
'
incoming
'
:
return
(
<
ModalContainer
.
Footer
rollUp=
{
rollUp
}
>
<
button
className=
'redButton'
onClick=
{
()
=>
boxDialer
.
skipButtonClick
()
}
>
<
CallEndIcon
/>
ЗАКРЫТЬ
</
button
>
<
button
className=
'greenButton'
onClick=
{
()
=>
boxDialer
.
answerButtonClick
()
}
>
ОТВЕТИТЬ
</
button
>
</
ModalContainer
.
Footer
>
);
case
'
outgoing
'
:
return
(
<
ModalContainer
.
Footer
rollUp=
{
rollUp
}
>
<
button
className=
'greenButton'
onClick=
{
()
=>
boxDialer
.
answerButtonClick
()
}
>
ОТВЕТИТЬ
</
button
>
</
ModalContainer
.
Footer
>
);
case
'
connectingIncoming
'
:
return
(
<
ModalContainer
.
Footer
rollUp=
{
rollUp
}
>
<
button
className=
'redButton'
onClick=
{
()
=>
boxDialer
.
skipButtonClick
()
}
>
<
CallEndIcon
/>
ЗАКРЫТЬ
</
button
>
</
ModalContainer
.
Footer
>
);
case
'
connectingOutgoing
'
:
return
(
<
ModalContainer
.
Footer
rollUp=
{
rollUp
}
>
<
button
className=
'redButton'
onClick=
{
()
=>
boxDialer
.
skipButtonClick
()
}
>
<
CallEndIcon
/>
ЗАКРЫТЬ
</
button
>
</
ModalContainer
.
Footer
>
);
case
'
connected
'
:
return
(
<
ModalContainer
.
Footer
justify=
{
'
space-between
'
}
rollUp=
{
rollUp
}
>
<
div
className=
'outcomingEventStyle'
>
<
div
onClick=
{
()
=>
boxDialer
.
holdButtonClick
()
}
>
{
configHoldMute
?.
state
?.
callHold
?
(
<
PlayArrowIcon
style=
{
{
color
:
'
#fff
'
}
}
/>
)
:
(
<
PauseIcon
style=
{
{
color
:
'
#fff
'
}
}
/>
)
}
</
div
>
<
div
onClick=
{
()
=>
boxDialer
.
muteButtonClick
()
}
>
{
configHoldMute
?.
state
?.
callMute
?
(
<
MicOffIcon
style=
{
{
color
:
'
#fff
'
}
}
/>
)
:
(
<
MicIcon
style=
{
{
color
:
'
#fff
'
}
}
/>
)
}
</
div
>
<
div
className=
'transferAreaIcon'
onClick=
{
()
=>
{
window
.
BX
?
boxDialer
.
selectUser
()
:
setTransferModel
(
!
transferModel
);
}
}
>
<
SendToMobileIcon
style=
{
{
color
:
'
#fff
'
}
}
/>
<
CallCardDropDown
hiddenState=
{
transferModel
}
selectUserFunc=
{
selectUserFunc
}
/>
</
div
>
<
div
className=
{
'
openNumpadAreaIcon
'
}
>
<
DialpadIcon
style=
{
{
color
:
'
#fff
'
}
}
onClick=
{
()
=>
openNumpad
()
}
/>
<
ModalNumpad
hidden=
{
numpadModal
}
/>
</
div
>
</
div
>
<
button
className=
'redButton'
onClick=
{
()
=>
boxDialer
.
skipButtonClick
()
}
>
<
CallEndIcon
/>
ЗАКРЫТЬ
</
button
>
</
ModalContainer
.
Footer
>
);
default
:
return
(
<
ModalContainer
.
Footer
rollUp=
{
rollUp
}
>
Do not fount event
</
ModalContainer
.
Footer
>
);
}
};
const
selectModalType
=
(
type
)
=>
{
console
.
log
(
'
selectModalType_inset_component:
'
,
type
)
switch
(
type
)
{
case
'
incoming
'
:
return
(<
ModalContainer
.
Footer
rollUp=
{
rollUp
}
>
<
button
className=
'redButton'
onClick=
{
()
=>
boxDialer
.
skipButtonClick
()
}
>
<
CallEndIcon
/>
ЗАКРЫТЬ
</
button
>
<
button
className=
'greenButton'
onClick=
{
()
=>
boxDialer
.
answerButtonClick
()
}
>
ОТВЕТИТЬ
</
button
>
</
ModalContainer
.
Footer
>);
case
'
outgoing
'
:
return
(<
ModalContainer
.
Footer
rollUp=
{
rollUp
}
>
<
button
className=
'greenButton'
onClick=
{
()
=>
boxDialer
.
answerButtonClick
()
}
>
ОТВЕТИТЬ
</
button
>
</
ModalContainer
.
Footer
>);
case
'
connectingIncoming
'
:
return
(<
ModalContainer
.
Footer
rollUp=
{
rollUp
}
>
<
button
className=
'redButton'
onClick=
{
()
=>
boxDialer
.
skipButtonClick
()
}
>
<
CallEndIcon
/>
ЗАКРЫТЬ
</
button
>
</
ModalContainer
.
Footer
>);
case
'
connectingOutgoing
'
:
return
(<
ModalContainer
.
Footer
rollUp=
{
rollUp
}
>
<
button
className=
'redButton'
onClick=
{
()
=>
boxDialer
.
skipButtonClick
()
}
>
<
CallEndIcon
/>
ЗАКРЫТЬ
</
button
>
</
ModalContainer
.
Footer
>);
case
'
connected
'
:
return
(<
ModalContainer
.
Footer
justify=
{
'
space-between
'
}
rollUp=
{
rollUp
}
>
<
div
className=
'outcomingEventStyle'
>
<
div
onClick=
{
()
=>
boxDialer
.
holdButtonClick
()
}
>
{
configHoldMute
?.
state
?.
callHold
?
(<
PlayArrowIcon
style=
{
{
color
:
'
#fff
'
}
}
/>)
:
(
<
PauseIcon
style=
{
{
color
:
'
#fff
'
}
}
/>)
}
</
div
>
<
div
onClick=
{
()
=>
boxDialer
.
muteButtonClick
()
}
>
{
configHoldMute
?.
state
?.
callMute
?
(<
MicOffIcon
style=
{
{
color
:
'
#fff
'
}
}
/>)
:
(
<
MicIcon
style=
{
{
color
:
'
#fff
'
}
}
/>)
}
</
div
>
<
div
className=
'transferAreaIcon'
onClick=
{
()
=>
{
window
.
BX
?
boxDialer
.
selectUser
()
:
setTransferModel
(
!
transferModel
);
}
}
>
<
SendToMobileIcon
style=
{
{
color
:
'
#fff
'
}
}
/>
<
CallCardDropDown
hiddenState=
{
transferModel
}
selectUserFunc=
{
selectUserFunc
}
/>
</
div
>
<
div
className=
{
'
openNumpadAreaIcon
'
}
>
<
DialpadIcon
style=
{
{
color
:
'
#fff
'
}
}
onClick=
{
()
=>
openNumpad
()
}
/>
<
ModalNumpad
hidden=
{
numpadModal
}
/>
</
div
>
</
div
>
<
button
className=
'redButton'
onClick=
{
()
=>
boxDialer
.
skipButtonClick
()
}
>
<
CallEndIcon
/>
ЗАКРЫТЬ
</
button
>
</
ModalContainer
.
Footer
>);
default
:
return
(<
ModalContainer
.
Footer
rollUp=
{
rollUp
}
>
Do not fount event
</
ModalContainer
.
Footer
>);
}
};
return
(
<
MainBlock
hidden=
{
modalHidden
||
modalHidden
}
rollUp=
{
rollUp
}
onClick=
{
(
e
)
=>
e
.
stopPropagation
()
}
>
<
ModalContainer
onClick=
{
(
e
)
=>
e
.
stopPropagation
()
}
rollUp=
{
rollUp
}
>
{
children
}
<
ModalContainer
.
Top
className=
{
'
top
'
}
rollUp=
{
rollUp
}
>
<
p
>
Звонок
{
callType
===
'
outcoming
'
?
'
на
'
:
'
от
'
}
{
phoneNumber
}
</
p
>
return
(<
MainBlock
hidden=
{
modalHidden
||
modalHidden
}
rollUp=
{
rollUp
}
onClick=
{
(
e
)
=>
e
.
stopPropagation
()
}
>
<
ModalContainer
onClick=
{
(
e
)
=>
e
.
stopPropagation
()
}
rollUp=
{
rollUp
}
>
{
children
}
<
ModalContainer
.
Top
className=
{
'
top
'
}
rollUp=
{
rollUp
}
>
<
p
>
Звонок
{
callType
===
'
outcoming
'
?
'
на
'
:
'
от
'
}
{
phoneNumber
}
</
p
>
<
p
className=
'rollUpButton'
onClick=
{
()
=>
setRollUp
(
true
)
}
>
Свернуть
</
p
>
</
ModalContainer
.
Top
>
<
hr
/>
<
ModalContainer
.
Head
rollUp=
{
rollUp
}
>
<
div
className=
'round'
></
div
>
<
p
className=
'name'
>
No name
</
p
>
</
ModalContainer
.
Head
>
{
selectModalType
(
callType
)
}
</
ModalContainer
>
<
div
className=
'rollUpVesion'
>
<
button
className=
'close'
onClick=
{
()
=>
{
hangupButton
();
setRollUp
(
false
);
setModalHidden
(
false
);
}
}
>
ЗАКРЫТЬ
</
button
>
<
button
className=
'rollUpUn'
onClick=
{
()
=>
setRollUp
(
false
)
}
>
<
VerticalAlignTopIcon
/>
</
button
>
</
div
>
</
MainBlock
>
);
<
p
className=
'rollUpButton'
onClick=
{
()
=>
setRollUp
(
true
)
}
>
Свернуть
</
p
>
</
ModalContainer
.
Top
>
<
hr
/>
<
ModalContainer
.
Head
rollUp=
{
rollUp
}
>
<
div
className=
'round'
></
div
>
<
p
className=
'name'
>
No name
</
p
>
</
ModalContainer
.
Head
>
{
selectModalType
(
callType
)
}
</
ModalContainer
>
<
div
className=
'rollUpVesion'
>
<
button
className=
'close'
onClick=
{
()
=>
{
hangupButton
();
setRollUp
(
false
);
setModalHidden
(
false
);
}
}
>
ЗАКРЫТЬ
</
button
>
<
button
className=
'rollUpUn'
onClick=
{
()
=>
setRollUp
(
false
)
}
>
<
VerticalAlignTopIcon
/>
</
button
>
</
div
>
</
MainBlock
>);
};
export
default
Modal
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment