-
Notifications
You must be signed in to change notification settings - Fork 56
fix(call-control): add-call-control-widget #362
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
87898e8
fix(call-control): add-call-control-widget
Shreyas281299 a0d1237
fix(call-control): add-web-component-for-call-control
Shreyas281299 8b3eadb
fix(call-control): review-comments
Shreyas281299 838b157
fix(call-control): fix-uts
Shreyas281299 888b549
fix(call-control): review-comments
Shreyas281299 4231874
fix(call-control): fix-types
Shreyas281299 ae49bd2
fix(call-control): fix-incoming-call-issue
Shreyas281299 fc5de26
fix(call-control): review-comments
Shreyas281299 8d1dbf6
Merge remote-tracking branch 'upstream/ccwidgets' into call-control
Shreyas281299 7357bbf
fix(cc-widgets): code-refactor-for-observer-hook
Shreyas281299 f49b6db
fix(call-control): fix callback in call control
Shreyas281299 d60f049
fix(call-control): move-audio-logic-into-call-control
Shreyas281299 e6aa5b4
fix(call-control): remove-console-logs
Shreyas281299 62dec74
Merge remote-tracking branch 'upstream/ccwidgets' into call-control
Shreyas281299 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
import {StationLogin} from '@webex/cc-station-login'; | ||
import {UserState} from '@webex/cc-user-state'; | ||
import {IncomingTask, TaskList} from '@webex/cc-task'; | ||
import {IncomingTask, TaskList, CallControl} from '@webex/cc-task'; | ||
import store from '@webex/cc-store'; | ||
|
||
export {StationLogin, UserState, IncomingTask, TaskList, store}; | ||
export {StationLogin, UserState, IncomingTask, CallControl, TaskList, store}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
84 changes: 84 additions & 0 deletions
84
packages/contact-center/task/src/CallControl/call-control.presentational.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import React, {useState} from 'react'; | ||
import {WrapupCodes} from '@webex/cc-store'; | ||
rarajes2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
import {CallControlPresentationalProps} from '../task.types'; | ||
import './call-control.styles.scss'; | ||
|
||
function CallControlPresentational(props: CallControlPresentationalProps) { | ||
const [isHeld, setIsHeld] = useState(false); | ||
const [isRecording, setIsRecording] = useState(true); | ||
const [selectedWrapupReason, setSelectedWrapupReason] = useState<string | null>(null); | ||
const [selectedWrapupId, setSelectedWrapupId] = useState<string | null>(null); | ||
|
||
const {currentTask, audioRef, toggleHold, toggleRecording, endCall, wrapupCall, wrapupCodes, wrapupRequired} = props; | ||
|
||
const handletoggleHold = () => { | ||
toggleHold(!isHeld); | ||
setIsHeld(!isHeld); | ||
}; | ||
|
||
const handletoggleRecording = () => { | ||
toggleRecording(isRecording); | ||
setIsRecording(!isRecording); | ||
}; | ||
|
||
const handleWrapupCall = () => { | ||
if (selectedWrapupReason && selectedWrapupId) { | ||
wrapupCall(selectedWrapupReason, selectedWrapupId); | ||
setSelectedWrapupReason(''); | ||
} | ||
}; | ||
|
||
const handleWrapupChange = (event: React.ChangeEvent<HTMLSelectElement>) => { | ||
const {text, value} = event.target.options[event.target.selectedIndex]; | ||
setSelectedWrapupReason(text); | ||
setSelectedWrapupId(value); | ||
}; | ||
|
||
return ( | ||
<> | ||
<audio ref={audioRef} id="remote-audio" autoPlay></audio> | ||
{currentTask && ( | ||
rarajes2 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<div className="box"> | ||
<section className="section-box"> | ||
<fieldset className="fieldset"> | ||
<legend className="legend-box">Call Control</legend> | ||
<div style={{display: 'flex', flexDirection: 'column', flexGrow: 1}}> | ||
<div style={{display: 'flex', gap: '1rem'}}> | ||
<button className="btn" onClick={handletoggleHold} disabled={wrapupRequired}> | ||
{isHeld ? 'Resume' : 'Hold'} | ||
</button> | ||
<button className="btn" onClick={handletoggleRecording} disabled={wrapupRequired}> | ||
{isRecording ? 'Pause Recording' : 'Resume Recording'} | ||
</button> | ||
<button className="btn" onClick={endCall} disabled={wrapupRequired}> | ||
End | ||
</button> | ||
</div> | ||
<div style={{display: 'flex', gap: '1rem', marginTop: '1rem'}}> | ||
<select className="select" onChange={handleWrapupChange} disabled={!wrapupRequired}> | ||
<option value="">Select the wrap-up reason</option> | ||
{wrapupCodes.map((wrapup: WrapupCodes) => ( | ||
<option key={wrapup.id} value={wrapup.id}> | ||
{wrapup.name} | ||
</option> | ||
))} | ||
</select> | ||
<button | ||
className="btn" | ||
onClick={handleWrapupCall} | ||
disabled={!wrapupRequired && !selectedWrapupReason} | ||
> | ||
Wrap Up | ||
</button> | ||
</div> | ||
</div> | ||
</fieldset> | ||
</section> | ||
</div> | ||
)} | ||
</> | ||
); | ||
} | ||
|
||
export default CallControlPresentational; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.