Skip to content
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

Add Video Call Chat Links #1878

Merged
merged 41 commits into from
Apr 1, 2021
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
2eda7b9
initial commit
Mar 18, 2021
d495521
turned reportscreeen into a class component
Mar 19, 2021
a1c657e
added a button
Mar 19, 2021
aecd46e
Merge branch 'master' of https://github.com/Expensify/Expensify.cash …
Mar 19, 2021
917ca42
cleaned up
Mar 19, 2021
e506b41
scaffold popover in report screen
Mar 19, 2021
d1e4a8a
clean up
Mar 19, 2021
19e1500
Merge branch 'master' of https://github.com/Expensify/Expensify.cash …
Mar 19, 2021
2800fe5
Merge branch 'master' of https://github.com/Expensify/Expensify.cash …
Mar 19, 2021
2266752
set up a component for the menu
Mar 19, 2021
0bc93f7
Merge branch 'master' of https://github.com/Expensify/Expensify.cash …
Mar 22, 2021
3e919b4
added zoom and meet links and svgs
Mar 22, 2021
2a783c9
made the menu
Mar 22, 2021
0ec1237
loosened Icon prop conditions to allow for non-expensify content
Mar 22, 2021
48d4b1d
whoops
Mar 22, 2021
a75f4df
added style for video chat menu
Mar 22, 2021
1707c2f
took out custom style
Mar 22, 2021
ec774a4
style - keeping class comp for now
Mar 22, 2021
04d9b5c
Merge branch 'master' of https://github.com/Expensify/Expensify.cash …
Mar 24, 2021
692e9ad
updated zoom icon
Mar 24, 2021
ebbdbd8
refactored and included phone.svg
Mar 24, 2021
050b7d6
refactored headerview to class component
Mar 26, 2021
83a34e8
made video chat menu anchor to the ui button
Mar 26, 2021
1570d72
fixed report screen stuff
Mar 26, 2021
5d53d18
added additional style prop
Mar 30, 2021
df0544d
added animationOut prop for popovers
Mar 30, 2021
cbe1692
Merge branch 'master' of https://github.com/Expensify/Expensify.cash …
Mar 30, 2021
6331bd0
renamed the video chat component and included the button in it
Mar 31, 2021
0f77ca5
took lots of stuff out of the header view
Mar 31, 2021
bb2e83b
refactored back to stateless component
Mar 31, 2021
df8c590
cleaned up
Mar 31, 2021
112c806
whitespace
Mar 31, 2021
448ccc6
style
Mar 31, 2021
452fa7b
style
Mar 31, 2021
6fa2c38
changed style name and added support for arrays
Mar 31, 2021
c2590e7
clean up
Mar 31, 2021
9a5dd82
style
Mar 31, 2021
4f5ef64
changed wrapperStyle type to object
Mar 31, 2021
e9c932a
style
Mar 31, 2021
d994dd7
added menuItems array to constructor
Mar 31, 2021
f2f82b9
changed Icon propTypes
Mar 31, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions assets/images/Zoom - Blue.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions assets/images/google-meet.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/CONST.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ const CONST = {
PRESSED: 'pressed',
},
CLOUDFRONT_URL,
NEW_ZOOM_MEETING_URL: 'https://zoom.us/start/videomeeting',
NEW_GOOGLE_MEET_MEETING_URL: 'https://meet.google.com/new',
PDF_VIEWER_URL: '/pdf/web/viewer.html',
EXPENSIFY_ICON_URL: `${CLOUDFRONT_URL}/images/favicon-2019.png`,
UPWORK_URL: 'https://www.upwork.com/ab/jobs/search/?q=Expensify%20React%20Native&user_location_match=2',
Expand Down
5 changes: 4 additions & 1 deletion src/components/Icon/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@ import * as Expensicons from './Expensicons';

const propTypes = {
// The asset to render.
src: PropTypes.oneOf(_.values(Expensicons)).isRequired,
src: PropTypes.oneOfType([
PropTypes.oneOf(_.values(Expensicons)),
PropTypes.func,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because I was reluctant to add the Zoom and Meet logos to a file called Expensicons 😄. Willing to do so, but this was my preferred method.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would say just do it! We could just as easily have called it IconLibrary or something, but Expensicons is just a fun name. No need to let that affect the implementation imo.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call just importing the full-color svg directly where you used it. 👍🏼
But I think that means that this change is unnecessary.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I see why you need this. My mistake 👍

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I'm not seeing it where is this a func ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the svg imported as functions? 🤔

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are imported as functional components

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh weird OK

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So then... validating that it is

PropTypes.oneOf(_.values(Expensicons))

serves no purpose at all ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah good point. I think that is redundant now since any function will also pass this type check

]).isRequired,

// The width of the icon.
width: PropTypes.number,
Expand Down
69 changes: 69 additions & 0 deletions src/components/VideoChatMenu.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import Popover from './Popover';
import withWindowDimensions, {windowDimensionsPropTypes} from './withWindowDimensions';
import MenuItem from './MenuItem';
import openURLInNewTab from '../libs/openURLInNewTab';
import ZoomIcon from '../../assets/images/Zoom - Blue.svg';
import GoogleMeetIcon from '../../assets/images/google-meet.svg';
import CONST from '../CONST';

const propTypes = {
// State that determines whether to display the create menu or not
isVisible: PropTypes.bool.isRequired,

// Callback that determines behavior when menu is closed
onClose: PropTypes.func.isRequired,

...windowDimensionsPropTypes,
};

class VideoChatMenu extends Component {
constructor(props) {
super(props);
}

render() {
const menuItemData = [
{
icon: ZoomIcon,
text: 'Zoom',
onPress: () => openURLInNewTab(CONST.NEW_ZOOM_MEETING_URL),
},
{
icon: GoogleMeetIcon,
text: 'Google Meet',
onPress: () => openURLInNewTab(CONST.NEW_GOOGLE_MEET_MEETING_URL),
},
].map(item => ({
...item,
onPress: () => {
this.props.onItemSelected();
Luke9389 marked this conversation as resolved.
Show resolved Hide resolved
item.onPress();
},
}));
return (
<Popover
onClose={this.props.onClose}
isVisible={this.props.isVisible}
anchorPosition={{
left: this.props.windowWidth - 250,
top: 50,
}}
>
{menuItemData.map(({icon, text, onPress}) => (
<MenuItem
key={text}
icon={icon}
title={text}
onPress={onPress}
/>
))}
</Popover>
);
}
}

VideoChatMenu.propTypes = propTypes;
VideoChatMenu.displayName = 'VideoChatMenu';
export default withWindowDimensions(VideoChatMenu);
14 changes: 13 additions & 1 deletion src/pages/home/HeaderView.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import styles from '../../styles/styles';
import ONYXKEYS from '../../ONYXKEYS';
import themeColors from '../../styles/themes/default';
import Icon from '../../components/Icon';
import {BackArrow, Pin} from '../../components/Icon/Expensicons';
import {BackArrow, Pin, Trashcan} from '../../components/Icon/Expensicons';
import compose from '../../libs/compose';
import {togglePinnedState} from '../../libs/actions/Report';
import withWindowDimensions, {windowDimensionsPropTypes} from '../../components/withWindowDimensions';
Expand All @@ -23,6 +23,9 @@ const propTypes = {
// Toggles the navigationMenu open and closed
onNavigationMenuButtonClicked: PropTypes.func.isRequired,

// Toggles the videoChatMenu open and closed
onVideoChatMenuButtonClicked: PropTypes.func.isRequired,

/* Onyx Props */
// The report currently being looked at
report: PropTypes.shape({
Expand Down Expand Up @@ -96,6 +99,15 @@ const HeaderView = (props) => {
</View>
</Pressable>
<View style={[styles.reportOptions, styles.flexRow]}>
<Pressable
onPress={() => props.onVideoChatMenuButtonClicked()}
style={[styles.touchableButtonImage, styles.mr0]}
>
<Icon
Luke9389 marked this conversation as resolved.
Show resolved Hide resolved
src={Trashcan}
fill={props.report.isPinned ? themeColors.heading : themeColors.icon}
Luke9389 marked this conversation as resolved.
Show resolved Hide resolved
/>
Luke9389 marked this conversation as resolved.
Show resolved Hide resolved
</Pressable>
<Pressable
onPress={() => togglePinnedState(props.report)}
style={[styles.touchableButtonImage, styles.mr0]}
Expand Down
70 changes: 47 additions & 23 deletions src/pages/home/ReportScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import HeaderView from './HeaderView';
import Navigation from '../../libs/Navigation/Navigation';
import ROUTES from '../../ROUTES';
import ONYXKEYS from '../../ONYXKEYS';
import VideoChatMenu from '../../components/VideoChatMenu';

const propTypes = {
// id of the most recently viewed report
Expand All @@ -19,32 +20,55 @@ const defaultProps = {
currentlyViewedReportID: 0,
};

const ReportScreen = (props) => {
const activeReportID = parseInt(props.currentlyViewedReportID, 10);
if (!activeReportID) {
return null;
class ReportScreen extends React.Component {
constructor(props) {
super(props);
this.toggleVideoChatMenu = this.toggleVideoChatMenu.bind(this);

this.state = {
isVideoChatMenuActive: false,
};
}

return (
<ScreenWrapper
style={[
styles.appContent,
styles.flex1,
styles.flexColumn,
]}
>
<HeaderView
reportID={activeReportID}
onNavigationMenuButtonClicked={() => Navigation.navigate(ROUTES.HOME)}
/>
<View style={[styles.dFlex, styles.flex1]}>
<ReportView reportID={activeReportID} />
</View>
</ScreenWrapper>
);
};
toggleVideoChatMenu() {
this.setState(state => ({
isVideoChatMenuActive: !state.isVideoChatMenuActive,
}));
}

render() {
const activeReportID = parseInt(this.props.currentlyViewedReportID, 10);
if (!activeReportID) {
return null;
}
return (
<ScreenWrapper
style={[
styles.appContent,
styles.flex1,
styles.flexColumn,
]}
>
<HeaderView
reportID={activeReportID}
onNavigationMenuButtonClicked={() => Navigation.navigate(ROUTES.HOME)}
onVideoChatMenuButtonClicked={this.toggleVideoChatMenu}
/>
Luke9389 marked this conversation as resolved.
Show resolved Hide resolved
<VideoChatMenu
onClose={this.toggleVideoChatMenu}
isVisible={this.state.isVideoChatMenuActive}
onItemSelected={this.toggleVideoChatMenu}
/>
<View style={[styles.dFlex, styles.flex1]}>
<ReportView
reportID={activeReportID}
/>
</View>
</ScreenWrapper>
);
}
}

ReportScreen.displayName = 'ReportScreen';
Luke9389 marked this conversation as resolved.
Show resolved Hide resolved
ReportScreen.propTypes = propTypes;
ReportScreen.defaultProps = defaultProps;
export default withOnyx({
Expand Down