From 75a7950f61852fc70c0bd7ee4a81c340b706e219 Mon Sep 17 00:00:00 2001 From: Shekar Siri Date: Fri, 2 Jul 2021 09:14:16 +0530 Subject: [PATCH] feature(ui) - assist ui changes --- .../Assist/ChatWindow/ChatWindow.tsx | 3 +- .../AssistActions/AssistActions.tsx | 29 +++++++++++------ frontend/app/components/Session/Session.js | 2 +- .../Session_/Player/Controls/Controls.js | 32 ++++++++++--------- .../components/shared/SessionItem/Counter.tsx | 17 ++++++++++ .../shared/SessionItem/SessionItem.js | 5 ++- 6 files changed, 61 insertions(+), 27 deletions(-) create mode 100644 frontend/app/components/shared/SessionItem/Counter.tsx diff --git a/frontend/app/components/Assist/ChatWindow/ChatWindow.tsx b/frontend/app/components/Assist/ChatWindow/ChatWindow.tsx index daf0c610a..aa5460120 100644 --- a/frontend/app/components/Assist/ChatWindow/ChatWindow.tsx +++ b/frontend/app/components/Assist/ChatWindow/ChatWindow.tsx @@ -15,12 +15,13 @@ const ChatWindow: FC = function ChatWindow() { navigator.mediaDevices.getUserMedia({video:true, audio:true}) .then(oStream => { setOutputStream(oStream); - callPeer(oStream, setInputStream, () => { + const call = callPeer(oStream, setInputStream, () => { console.log('endd') outputStream?.getTracks().forEach(t => t.stop()); //inputStream?. }); // Returns false when unable to connect. // TODO: handle calling state + console.log(call) }) .catch(console.log) // TODO: handle error in ui }, []) diff --git a/frontend/app/components/Assist/components/AssistActions/AssistActions.tsx b/frontend/app/components/Assist/components/AssistActions/AssistActions.tsx index 11e2863d9..e331ef7d3 100644 --- a/frontend/app/components/Assist/components/AssistActions/AssistActions.tsx +++ b/frontend/app/components/Assist/components/AssistActions/AssistActions.tsx @@ -1,8 +1,7 @@ import React from 'react' -import { Button, Icon } from 'UI' +import { Popup, Icon } from 'UI' import { connect } from 'react-redux' import cn from 'classnames' -import { callPeer } from 'App/player'; import { toggleChatWindow } from 'Duck/sessions'; import stl from './AassistActions.css' @@ -14,14 +13,26 @@ interface Props { function AssistActions({ toggleChatWindow }: Props) { return (
-
toggleChatWindow(true)} - > - -
+ toggleChatWindow(true)} + role="button" + > + +
+ } + content={ `Start Video Call` } + size="tiny" + inverted + position="top center" + />
-
+
Request Control
diff --git a/frontend/app/components/Session/Session.js b/frontend/app/components/Session/Session.js index 5f921bc38..36fa66d7f 100644 --- a/frontend/app/components/Session/Session.js +++ b/frontend/app/components/Session/Session.js @@ -49,7 +49,7 @@ function Session({ { session.isIOS ? - : + : (session.live ? : ) } diff --git a/frontend/app/components/Session_/Player/Controls/Controls.js b/frontend/app/components/Session_/Player/Controls/Controls.js index 9dde2669f..d89729a5e 100644 --- a/frontend/app/components/Session_/Player/Controls/Controls.js +++ b/frontend/app/components/Session_/Player/Controls/Controls.js @@ -307,7 +307,7 @@ export default class Controls extends React.Component { }
- { !live && showDevTools && + { showDevTools && toggleBottomBlock(NETWORK) } @@ -329,7 +329,7 @@ export default class Controls extends React.Component { icon="fetch" /> } - { showGraphql && + { !live && showGraphql && toggleBottomBlock(GRAPHQL) } @@ -339,7 +339,7 @@ export default class Controls extends React.Component { icon="vendors/graphql" /> } - { showStorage && showDevTools && + { !live && showStorage && showDevTools && toggleBottomBlock(STORAGE) } @@ -360,7 +360,7 @@ export default class Controls extends React.Component { hasErrors={ logRedCount > 0 } /> } - { showExceptions && showDevTools && + { !live && showExceptions && showDevTools && toggleBottomBlock(EXCEPTIONS) } @@ -371,7 +371,7 @@ export default class Controls extends React.Component { hasErrors={ exceptionsCount > 0 } /> } - { !live && showDevTools && showStack && + { showDevTools && showStack && toggleBottomBlock(STACKEVENTS) } @@ -382,7 +382,7 @@ export default class Controls extends React.Component { hasErrors={ stackRedCount > 0 } /> } - { showProfiler && showDevTools && + { !live && showProfiler && showDevTools && toggleBottomBlock(PROFILER) } @@ -391,7 +391,7 @@ export default class Controls extends React.Component { label="Profiler" icon="code" /> - } + } toggleBottomBlock(PERFORMANCE) } @@ -399,7 +399,7 @@ export default class Controls extends React.Component { label="Performance" icon="tachometer-slow" /> - { showLongtasks && + { !live && showLongtasks && toggleBottomBlock(LONGTASKS) } @@ -420,13 +420,15 @@ export default class Controls extends React.Component { } - toggleBottomBlock(INSPECTOR) } - icon={ inspectorMode ? 'close' : 'inspect' } - label="Inspect" - /> + {!live && ( + toggleBottomBlock(INSPECTOR) } + icon={ inspectorMode ? 'close' : 'inspect' } + label="Inspect" + /> + )}
} diff --git a/frontend/app/components/shared/SessionItem/Counter.tsx b/frontend/app/components/shared/SessionItem/Counter.tsx new file mode 100644 index 000000000..5d9a82f9b --- /dev/null +++ b/frontend/app/components/shared/SessionItem/Counter.tsx @@ -0,0 +1,17 @@ +import React from 'react' +import { Duration } from 'luxon'; +import { durationFormatted, formatTimeOrDate } from 'App/date'; + +interface Props { + startTime: any +} + +function Counter({ startTime }: Props) { + return ( +
+ {startTime && Duration.fromMillis(startTime).toFormat('m:ss')} +
+ ) +} + +export default Counter diff --git a/frontend/app/components/shared/SessionItem/SessionItem.js b/frontend/app/components/shared/SessionItem/SessionItem.js index cb72fbd41..7ec36ef74 100644 --- a/frontend/app/components/shared/SessionItem/SessionItem.js +++ b/frontend/app/components/shared/SessionItem/SessionItem.js @@ -15,6 +15,8 @@ import { session as sessionRoute } from 'App/routes'; import { durationFormatted, formatTimeOrDate } from 'App/date'; import stl from './sessionItem.css'; import LiveTag from 'Shared/LiveTag'; +import { session } from '../../../routes'; +import Counter from './Counter' const Label = ({ label = '', color = 'color-gray-medium'}) => (
{label}
@@ -53,7 +55,7 @@ export default class SessionItem extends React.PureComponent { userDeviceType, userUuid, userNumericHash, - live + live }, timezone, onUserClick, @@ -108,6 +110,7 @@ export default class SessionItem extends React.PureComponent {
)} + { live && } { live && }