Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 3 additions & 22 deletions src/page/HomePage/HeaderView.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React from 'react';
import {Button, View, Text} from 'react-native';
import {signOut} from '../../store/actions/SessionActions';
import {fetch as getPersonalDetails} from '../../store/actions/PersonalDetailsActions';
import {View, Text} from 'react-native';
import styles from '../../style/StyleSheet';
import STOREKEYS from '../../store/STOREKEYS';
import WithStore from '../../components/WithStore';
Expand All @@ -10,35 +8,18 @@ import {withRouter} from '../../lib/Router';
class HeaderView extends React.Component {
render() {
return (
<View style={[styles.nav, styles.flexRow, styles.flexWrap]}>
<Text style={styles.brand}>Expensify Chat</Text>
<View style={[styles.appContentHeader, styles.flexRow, styles.flexWrap]}>
{this.state && this.state.reportName && (
<Text style={[styles.navText, styles.ml1]}>
<Text style={[styles.navText]}>
{this.state.reportName}
</Text>
)}
<Text style={styles.flex1} />
{this.state && this.state.userDisplayName && (
<Text style={[styles.navText, styles.mr1]}>
{`Welcome ${this.state.userDisplayName}!`}
</Text>
)}
<Button onPress={signOut} title="Sign Out" />
</View>
);
}
}

export default withRouter(WithStore({
// Map this.state.userDisplayName to the personal details key in the store and bind it to the displayName property
// and load it with data from getPersonalDetails()
userDisplayName: {
key: STOREKEYS.MY_PERSONAL_DETAILS,
path: 'displayName',
loader: getPersonalDetails,
prefillWithKey: STOREKEYS.MY_PERSONAL_DETAILS,
},

// Map this.state.reportName to the data for a specific report in the store, and bind it to the reportName property
// It uses the data returned from the props path (ie. the reportID) to replace %DATAFROMPROPS% in the key it
// binds to
Expand Down
4 changes: 2 additions & 2 deletions src/page/HomePage/HomePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ export default class App extends React.Component {
<>
<StatusBar barStyle="dark-content" />
<SafeAreaView style={[styles.flex1, styles.h100p]}>
<View style={[styles.flexRow, styles.h100p]}>
<View style={[styles.appContentWrapper, styles.flexRow, styles.h100p]}>
<Route path="/:reportID?">
<View style={{width: 300}}>
<Sidebar />
</View>
<View style={[styles.flex1, styles.flexColumn]}>
<View style={[styles.appContent, styles.flex1, styles.flexColumn]}>
<Header />
<Main />
</View>
Expand Down
2 changes: 1 addition & 1 deletion src/page/HomePage/MainView.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import styles from '../../style/StyleSheet';
import ReportView from './Report/ReportView';

const MainView = () => (
<View style={[styles.flex4, styles.p1]}>
<View style={[styles.chatContent, styles.flex4]}>
<ReportView />
</View>
);
Expand Down
2 changes: 1 addition & 1 deletion src/page/HomePage/Report/ReportHistoryCompose.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class ReportHistoryCompose extends React.Component {

render() {
return (
<View style={[styles.mt2]}>
<View style={[styles.chatItemCompose]}>
<TextInput
ref={el => this.textInput = el}
multiline
Expand Down
6 changes: 3 additions & 3 deletions src/page/HomePage/Report/ReportHistoryItemSingle.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ const ReportHistoryItemSingle = ({historyItem}) => {
? `${CONST.CLOUDFRONT_URL}/images/icons/concierge_2019.svg`
: historyItem.avatar;
return (
<>
<View style={[styles.flexRow, styles.mt2]}>
<View style={[styles.chatItem]}>
<View style={[styles.flexRow]}>
<View style={[styles.historyItemAvatarWrapper]}>
<Image
source={{uri: avatarUrl}}
Expand All @@ -44,7 +44,7 @@ const ReportHistoryItemSingle = ({historyItem}) => {
<Text style={[styles.historyItemMessageWrapper]}>
<ReportHistoryItemMessage historyItem={historyItem} />
</Text>
</>
</View>
);
};

Expand Down
8 changes: 4 additions & 4 deletions src/page/HomePage/SidebarLink.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ class SidebarLink extends React.Component {
render() {
const paramsReportID = parseInt(this.props.match.params.reportID, 10);
const isReportActive = paramsReportID === this.props.reportID;
const linkWrapperActiveStyle = isReportActive && styles.sidebarLinkActive;
const linkActiveStyle = isReportActive ? styles.sidebarLinkActiveAnchor : styles.sidebarLink;
const linkWrapperActiveStyle = isReportActive && styles.sidebarLinkWrapperActive;
const linkActiveStyle = isReportActive ? styles.sidebarLinkActive : styles.sidebarLink;
const textActiveStyle = isReportActive ? styles.sidebarLinkActiveText : styles.sidebarLinkText;
return (
<View style={linkWrapperActiveStyle}>
<View style={[styles.sidebarListItem, linkWrapperActiveStyle]}>
<Link to={`/${this.props.reportID}`} style={linkActiveStyle}>
<View style={[styles.flexRow]}>
<View style={[styles.sidebarLinkInner]}>
<Text style={[textActiveStyle, styles.flex1]}>{this.props.reportName}</Text>
{this.state && this.state.isUnread && (
<View style={styles.unreadBadge} />
Expand Down
45 changes: 36 additions & 9 deletions src/page/HomePage/SidebarView.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import React from 'react';
import {View, Image} from 'react-native';
import _ from 'underscore';
import {Button, Text, View, Image} from 'react-native';
import {signOut} from '../../store/actions/SessionActions';
import {fetch as getPersonalDetails} from '../../store/actions/PersonalDetailsActions';
import styles from '../../style/StyleSheet';
import WithStore from '../../components/WithStore';
import STOREKEYS from '../../store/STOREKEYS';
Expand All @@ -24,20 +26,45 @@ class SidebarView extends React.Component {
const reports = this.state && this.state.reports;
this.updateUnreadReportIndicator();
return (
<View style={[styles.flex1, styles.p1]}>
<Image
style={{height: 50, width: 200}}
source={logo}
/>
{_.map(reports, report => (
<SidebarLink key={report.reportID} reportID={report.reportID} reportName={report.reportName} />
))}
<View style={[styles.flex1, styles.sidebar]}>
<View style={[styles.sidebarHeader]}>
<Image
style={[styles.sidebarHeaderLogo]}
source={logo}
/>
</View>
<View style={[styles.sidebarListContainer]}>
<View style={[styles.sidebarListItem]}>
<Text style={[styles.sidebarListHeader]}>
Chats
</Text>
</View>
{_.map(reports, report => (
<SidebarLink key={report.reportID} reportID={report.reportID} reportName={report.reportName} />
))}
</View>
<View style={[styles.sidebarFooter]}>
{this.state && this.state.userDisplayName && (
<Text style={[styles.sidebarFooterUsername]}>
{this.state.userDisplayName}
</Text>
)}
<Button onPress={signOut} title="Sign Out" />
</View>
</View>
);
}
}

export default WithStore({
// Map this.state.userDisplayName to the personal details key in the store and bind it to the displayName property
// and load it with data from getPersonalDetails()
userDisplayName: {
key: STOREKEYS.MY_PERSONAL_DETAILS,
path: 'displayName',
loader: getPersonalDetails,
prefillWithKey: STOREKEYS.MY_PERSONAL_DETAILS,
},
reports: {
key: STOREKEYS.REPORTS,
loader: fetchAll,
Expand Down
176 changes: 143 additions & 33 deletions src/style/StyleSheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,41 +45,10 @@ const styles = {
textLightGray: {
color: '#7d8b8f',
},
nav: {
backgroundColor: '#efefef',
padding: 20,
},
brand: {
fontSize: 25,
fontWeight: 'bold',
},
navText: {
padding: 8,
},
sidebarLink: {
paddingTop: 4,
paddingRight: 8,
paddingBottom: 4,
paddingLeft: 8,
textDecorationLine: 'none',
},
sidebarLinkActive: {
backgroundColor: '#007bff',
borderRadius: 4,
},
sidebarLinkActiveAnchor: {
paddingTop: 4,
paddingRight: 8,
paddingBottom: 4,
paddingLeft: 8,
textDecorationLine: 'none',
},
sidebarLinkText: {
color: '#007bff',
},
sidebarLinkActiveText: {
color: '#ffffff',
},

// History Items
historyItemAvatarWrapper: {
Expand All @@ -88,7 +57,6 @@ const styles = {
historyItemMessageWrapper: {
flexGrow: 1,
paddingLeft: 50,
marginBottom: 20,
},
historyItemAvatar: {
borderRadius: 20,
Expand All @@ -109,13 +77,155 @@ const styles = {
borderWidth: 1,
padding: 10,
},

// Sidebar Styles
sidebar: {
backgroundColor: '#37444C',
},

sidebarHeader: {
height: 72,
justifyContent: 'center',
paddingLeft: 24,
paddingRight: 24,
width: '100%',
},

sidebarHeaderLogo: {
height: 21,
width: 143,
},

sidebarFooter: {
borderTopWidth: 1,
borderTopColor: '#4A5960',
height: 72,
justifyContent: 'center',
paddingLeft: 24,
paddingRight: 24,
width: '100%',
},

sidebarListContainer: {
flexGrow: 1,
height: 100,
overflow: 'scroll',
paddingTop: 4,
paddingBottom: 4,
paddingLeft: 12,
paddingRight: 12,
},

sidebarListHeader: {
color: '#FFFFFF',
fontSize: 15,
fontWeight: '700',
paddingTop: 8,
paddingRight: 12,
paddingBottom: 8,
paddingLeft: 12,
},

sidebarListItem: {
height: 40,
justifyContent: 'center',
textDecoration: 'none',
},

sidebarLink: {
height: 40,
paddingTop: 8,
paddingRight: 12,
paddingBottom: 8,
paddingLeft: 12,
textDecoration: 'none',
},

sidebarLinkInner: {
alignItems: 'center',
flexDirection: 'row',
height: 24,
},

sidebarLinkText: {
color: '#C6C9CA',
fontSize: 13,
textDecoration: 'none',
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
},

sidebarLinkActive: {
backgroundColor: '#4A5960',
borderRadius: 8,
height: 40,
paddingTop: 8,
paddingRight: 12,
paddingBottom: 8,
paddingLeft: 12,
textDecoration: 'none',
},

sidebarLinkActiveText: {
color: '#ffffff',
fontSize: 13,
textDecoration: 'none',
whiteSpace: 'nowrap',
overflow: 'hidden',
textOverflow: 'ellipsis',
},

unreadBadge: {
backgroundColor: '#dc3545',
backgroundColor: '#2ECB70',
borderRadius: 15,
height: 10,
marginTop: 3,
width: 10,
},

// App Content styles
appContentWrapper: {
backgroundColor: '#37444C',
color: '#4A5960',
},

appContent: {
backgroundColor: '#fafafa',
borderTopLeftRadius: 12,
borderBottomLeftRadius: 12,
overflow: 'hidden',
},

appContentHeader: {
borderBottomWidth: 1,
borderBottomColor: '#ECECEC',
height: 73,
alignItems: 'center',
paddingLeft: 20,
paddingRight: 20,
},

navText: {
color: '#37444C',
fontSize: 17,
fontWeight: '700',
},

// Chat Item
chatItem: {
paddingTop: 8,
paddingBottom: 8,
paddingLeft: 16,
paddingRight: 16,
},

chatItemCompose: {
paddingTop: 8,
paddingBottom: 8,
paddingLeft: 16,
paddingRight: 16,
},
};

export default styles;
4 changes: 0 additions & 4 deletions web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@
#root > div > div {
height: 100% !important;
}
body {
font-size: 1rem;
line-height: 1.5;
}
</style>
</head>
<body>
Expand Down