diff --git a/app/assets/stylesheets/chat.scss b/app/assets/stylesheets/chat.scss index 4dc9f7740..38cd3585a 100644 --- a/app/assets/stylesheets/chat.scss +++ b/app/assets/stylesheets/chat.scss @@ -544,6 +544,50 @@ } } +.chat--video-visible { + .activechatchannel__conversation { + min-width: 25%; + @media screen and (min-width: 1440px) { + min-width: 45%; + } + } + .activechatchannel__activecontent { + &.activechatchannel__activecontent--video { + width: 380px; + min-width: 380px; + @media screen and (max-width: 426px) { + width: calc(100% - 16px); + min-width: calc(100% - 16px); + } + iframe { + position: absolute; + top: 0; + left: 0; + right: 0; + bottom: 0; + height: 100%; + width: 100%; + border: 0px; + } + } + width: 300px; + min-width: 300px; + @media screen and (min-width: 1000px) { + width: 400px; + min-width: 400px; + } + @media screen and (min-width: 1300px) { + width: 500px; + min-width: 500px; + } + } +} + +.chat--content-visible .activechatchannel__activecontent.activechatchannel__activecontent--video { + width: 280px; + min-width: 280px; +} + .live-chat-wrapper .activechatchannel__activecontent { min-width: 310px; margin-left: -180px; diff --git a/app/controllers/video_chats_controller.rb b/app/controllers/video_chats_controller.rb index 055eca400..42f2ab031 100644 --- a/app/controllers/video_chats_controller.rb +++ b/app/controllers/video_chats_controller.rb @@ -9,7 +9,8 @@ class VideoChatsController < ApplicationController account_sid = ApplicationConfig["TWILIO_ACCOUNT_SID"] api_key = ApplicationConfig["TWILIO_VIDEO_API_KEY"] api_secret = ApplicationConfig["TWILIO_VIDEO_API_SECRET"] - @username = "@" + current_user.username + @username = display_username + @video_type = video_type token = Twilio::JWT::AccessToken.new( account_sid, api_key, @@ -25,4 +26,20 @@ class VideoChatsController < ApplicationController @username = @username @token = token.to_jwt end + + private + + def display_username + return "@#{params[:username]}" if params[:username] && Rails.env.development? #simpler solo testing in dev + + "@" + current_user.username + end + + def video_type + if @chat_channel.channel_type == "direct" || @chat_channel.chat_channel_memberships.size < 5 + "peer-to-peer" + else + "group" + end + end end diff --git a/app/javascript/chat/__tests__/__snapshots__/chat.test.jsx.snap b/app/javascript/chat/__tests__/__snapshots__/chat.test.jsx.snap index 33eb91fdd..9338555db 100644 --- a/app/javascript/chat/__tests__/__snapshots__/chat.test.jsx.snap +++ b/app/javascript/chat/__tests__/__snapshots__/chat.test.jsx.snap @@ -2,7 +2,7 @@ exports[` should load chat 1`] = `
should render properly and test snapshot 1`] = ` -
-
-
- - - -
-`; diff --git a/app/javascript/chat/__tests__/video.test.jsx b/app/javascript/chat/__tests__/video.test.jsx deleted file mode 100644 index 5f50a8b77..000000000 --- a/app/javascript/chat/__tests__/video.test.jsx +++ /dev/null @@ -1,37 +0,0 @@ -import { h } from 'preact'; -import render from 'preact-render-to-json'; -import { deep } from 'preact-render-spy'; -import fetch from 'jest-fetch-mock'; -import Video from '../video'; - -global.fetch = fetch; - -let exited; -exited = false; - -const exitVideo = () => { - exited = true; -}; - -describe('
@@ -1115,7 +1038,6 @@ export default class Chat extends Component { {'>'} { + renderActiveChatChannel = (channelHeader) => { const { state, props } = this; return ( @@ -1203,7 +1125,6 @@ export default class Chat extends Component { id="messagelist" > {this.renderMessages()} - {incomingCall}
+
); }; + triggerExitVideo = () => { + this.setState({videoPath: null}) + } + handleMention = (e) => { const { activeChannel } = this.state; const mention = e.keyCode === 64; @@ -1558,53 +1487,17 @@ export default class Chat extends Component {
); } - let vid = ''; - let incomingCall = ''; - if (state.activeVideoChannelId) { - vid = ( -