This repository has been archived by the owner on Jun 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 230
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add callnotification,callStartmsg,iframe code (#617)
* add callnotification,msg,iframe code * fix eslint issues * fix eslint file path issues * fix stylelint issues * done ui changes * add icons and improve ui * fix error * remove-icons * add icons * add i18n.t, change classname, improve ui * remove font-family * change iframe link * add check for jitsi * add jitsi link * add time message in system message and add catch * display alert, change function name * Improve overall codebase * Convert tabs to spaces for translation file * Accept jitsi url info from the message and remove dependency from Livechat.videoCall endpoint * Update index.js * add message in i18n file Co-authored-by: Murtaza Patrawala <34130764+murtaza98@users.noreply.github.com>
- Loading branch information
1 parent
5498c56
commit 33adbe4
Showing
17 changed files
with
242 additions
and
6 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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,14 @@ | ||
import { h } from 'preact'; | ||
|
||
import { Screen } from '../Screen'; | ||
import { createClassName } from '../helpers'; | ||
import styles from './styles.scss'; | ||
|
||
|
||
export const CallIFrame = (url) => ( | ||
<Screen.Content nopadding> | ||
<div className={createClassName(styles, 'call-iframe')}> | ||
<iframe className={createClassName(styles, 'call-iframe__content')} src={url} /> | ||
</div> | ||
</Screen.Content> | ||
); |
This file contains 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,64 @@ | ||
import { h } from 'preact'; | ||
import { useState } from 'preact/compat'; | ||
|
||
import I18n from '../../i18n'; | ||
import PhoneAccept from '../../icons/phone.svg'; | ||
import PhoneDecline from '../../icons/phoneOff.svg'; | ||
import constants from '../../lib/constants'; | ||
import { Avatar } from '../Avatar'; | ||
import { Button } from '../Button'; | ||
import { createClassName, getAvatarUrl } from '../helpers'; | ||
import styles from './styles.scss'; | ||
|
||
|
||
export const CallNotification = ({ callProvider, callerUsername, url, dispatch } = { callProvider: undefined, callerUsername: undefined, dispatch: undefined }) => { | ||
const [show, setShow] = useState(!!callProvider && !!callerUsername && !!dispatch && !!url); | ||
|
||
const acceptClick = async () => { | ||
setShow(!{ show }); | ||
|
||
switch (callProvider) { | ||
case constants.jitsiCallStartedMessageType: { | ||
window.open(url); | ||
await dispatch({ incomingCallAlert: null }); | ||
break; | ||
} | ||
case constants.webrtcCallStartedMessageType: { | ||
// TODO: add webrtc code here | ||
break; | ||
} | ||
} | ||
}; | ||
|
||
const declineClick = async () => { | ||
await dispatch({ incomingCallAlert: null }); | ||
}; | ||
|
||
return ( | ||
<div className={createClassName(styles, 'call-notification')}> | ||
{ show | ||
? ( | ||
<div className={createClassName(styles, 'call-notification__content')}> | ||
<div className={createClassName(styles, 'call-notification__content-avatar')}> | ||
<Avatar | ||
src={getAvatarUrl(callerUsername)} | ||
large | ||
/> | ||
</div> | ||
<div className={createClassName(styles, 'call-notification__content-message')}> | ||
{ I18n.t('Incoming video Call') } | ||
</div> | ||
<div className={createClassName(styles, 'call-notification__content-actions')}> | ||
<Button onClick={declineClick} className={createClassName(styles, 'call-notification__content-actions-accept')}> | ||
<PhoneDecline width={20} height={20} /> <span style='margin-left:5px'> {I18n.t('Decline')} </span> | ||
</Button> | ||
<Button onClick={acceptClick} className={createClassName(styles, 'call-notification__content-actions-decline')} > | ||
<PhoneAccept width={20} height={20} /><span style='margin-left:5px'> {I18n.t('Accept')} </span> | ||
</Button> | ||
</div> | ||
</div> | ||
) | ||
: null | ||
} | ||
</div>); | ||
}; |
This file contains 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,78 @@ | ||
@import '../../styles/colors'; | ||
@import '../../styles/variables'; | ||
|
||
.call-notification { | ||
position: relative; | ||
|
||
display: flex; | ||
|
||
width: 100%; | ||
height: 50%; | ||
|
||
&__content { | ||
display: flex; | ||
flex-direction: column; | ||
|
||
width: 100%; | ||
height: 100%; | ||
|
||
background: #1f2329; | ||
|
||
font-weight: 600; | ||
justify-content: space-evenly; | ||
|
||
&-avatar { | ||
display: flex; | ||
|
||
margin: 0 auto; | ||
align-self: flex-end; | ||
} | ||
|
||
&-message { | ||
margin: 0 auto; | ||
|
||
color: #ffffff; | ||
} | ||
|
||
&-actions { | ||
display: flex; | ||
flex-direction: row; | ||
|
||
margin: 0 auto; | ||
margin-bottom: 15px; | ||
|
||
color: white; | ||
|
||
align-items: flex-end; | ||
|
||
> button { | ||
margin-bottom: 0; | ||
margin-left: 10px; | ||
} | ||
|
||
&-accept { | ||
border-color: green; | ||
background-color: #2de0a5; | ||
} | ||
|
||
&-decline { | ||
border-color: red; | ||
background-color: #f5455c; | ||
} | ||
} | ||
} | ||
} | ||
|
||
.call-iframe { | ||
position: relative; | ||
top: 0; | ||
|
||
display: flex; | ||
|
||
width: 100%; | ||
height: 50%; | ||
|
||
&__content { | ||
height: 100%; | ||
} | ||
} |
This file contains 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 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 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 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 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 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 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
Oops, something went wrong.