Skip to content

Commit cec966e

Browse files
authored
Merge branch 'wevote:develop' into develop
2 parents 18be97f + ce982f3 commit cec966e

File tree

5 files changed

+51
-17
lines changed

5 files changed

+51
-17
lines changed

src/js/components/SetUpAccount/SetUpAccountFriendRequests.jsx

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
import withStyles from '@mui/styles/withStyles';
22
import PropTypes from 'prop-types';
33
import React from 'react';
4+
import styled from 'styled-components';
45
import { renderLog } from '../../common/utils/logging';
5-
import VoterStore from '../../stores/VoterStore';
6+
import SuggestedFriendList from '../Friends/SuggestedFriendList';
7+
import FriendStore from '../../stores/FriendStore';
8+
import { SectionTitle } from '../Style/friendStyles';
69
import {
710
SetUpAccountIntroText,
811
SetUpAccountTitle,
912
SetUpAccountTop,
1013
StepCenteredWrapper,
1114
} from '../Style/SetUpAccountStyles';
15+
import sortFriendListByMutualFriends from '../../utils/friendFunctions';
1216

1317

1418
class SetUpAccountFriendRequests extends React.Component {
@@ -19,9 +23,13 @@ class SetUpAccountFriendRequests extends React.Component {
1923
}
2024

2125
componentDidMount () {
22-
window.scrollTo(0, 0);
23-
this.onVoterStoreChange();
24-
this.voterStoreListener = VoterStore.addListener(this.onVoterStoreChange.bind(this));
26+
const suggestedFriendListUnsorted = FriendStore.suggestedFriendList();
27+
const suggestedFriendList = sortFriendListByMutualFriends(suggestedFriendListUnsorted);
28+
this.setState({
29+
suggestedFriendList,
30+
});
31+
32+
this.friendStoreListener = FriendStore.addListener(this.onFriendStoreChange.bind(this));
2533
}
2634

2735
componentDidUpdate (prevProps) {
@@ -32,21 +40,37 @@ class SetUpAccountFriendRequests extends React.Component {
3240
}
3341

3442
componentWillUnmount () {
35-
this.voterStoreListener.remove();
43+
this.friendStoreListener.remove();
3644
}
3745

38-
onVoterStoreChange () {
46+
onFriendStoreChange () {
47+
const suggestedFriendListUnsorted = FriendStore.suggestedFriendList();
48+
const suggestedFriendList = sortFriendListByMutualFriends(suggestedFriendListUnsorted);
49+
this.setState({
50+
suggestedFriendList,
51+
});
3952
}
4053

4154
render () {
4255
renderLog('SetUpAccountFriendRequests'); // Set LOG_RENDER_EVENTS to log all renders
56+
const { suggestedFriendList } = this.state;
4357

4458
return (
4559
<StepCenteredWrapper>
4660
<SetUpAccountTop>
4761
<SetUpAccountTitle>Friends</SetUpAccountTitle>
4862
<SetUpAccountIntroText>&nbsp;</SetUpAccountIntroText>
4963
</SetUpAccountTop>
64+
{/* Chip filters here */}
65+
<SetUpAccountSubTitleWrapper>
66+
<SectionTitle>
67+
People you may know
68+
</SectionTitle>
69+
</SetUpAccountSubTitleWrapper>
70+
<SuggestedFriendList
71+
friendList={suggestedFriendList}
72+
editMode
73+
/>
5074
</StepCenteredWrapper>
5175
);
5276
}
@@ -59,4 +83,9 @@ SetUpAccountFriendRequests.propTypes = {
5983
const styles = () => ({
6084
});
6185

86+
const SetUpAccountSubTitleWrapper = styled('div')`
87+
max-width: 538px;
88+
width: 100%;
89+
`;
90+
6291
export default withStyles(styles)(SetUpAccountFriendRequests);

src/js/components/Style/friendStyles.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,13 @@ const FriendName = styled('h3', {
114114
${inSideColumn ? FriendNameInSideColumn : FriendNameNotInSideColumn}
115115
`));
116116

117+
const SectionTitle = styled('h2')`
118+
font-size: 18px;
119+
font-weight: bold;
120+
margin-bottom: 16px;
121+
width: fit-content;
122+
`;
123+
117124
const ToRightOfPhoto = styled('div')`
118125
align-items: flex-start;
119126
display: flex;
@@ -131,5 +138,6 @@ export {
131138
FriendDisplayDesktopButtonsWrapper,
132139
FriendDisplayOuterWrapper,
133140
FriendName,
141+
SectionTitle,
134142
ToRightOfPhoto,
135143
};

src/js/pages/FriendIntro/FriendIntroLanding.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ import VoterStore from '../../stores/VoterStore';
2424

2525
const FAQModal = React.lazy(() => import(/* webpackChunkName: 'FAQModal' */ '../../components/FriendIntro/FAQModal'));
2626

27-
// const logoColorOnWhite = '../../../img/global/svg-icons/we-vote-icon-square-color-dark.svg';
2827
const logoGrey = '../../../img/global/svg-icons/we-vote-icon-square-color-grey.svg';
2928
const voteFlag = '../../../img/get-started/your-vote-counts-cropped-200x200.gif';
30-
const inDevelopmentMode = false;
29+
const inDevelopmentMode = true;
3130

3231
class FriendIntroLanding extends Component {
3332
constructor (props) {

src/js/pages/Friends/SuggestedFriends.jsx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { renderLog } from '../../common/utils/logging';
55
import SuggestedFriendList from '../../components/Friends/SuggestedFriendList';
66
import MessageCard from '../../components/Widgets/MessageCard';
77
import FriendStore from '../../stores/FriendStore';
8+
import { SectionTitle } from '../../components/Style/friendStyles';
89
import sortFriendListByMutualFriends from '../../utils/friendFunctions';
910

1011
export default class SuggestedFriends extends Component {
@@ -76,11 +77,5 @@ export default class SuggestedFriends extends Component {
7677
}
7778
}
7879

79-
const SectionTitle = styled('h2')`
80-
width: fit-content; font-weight: bold;
81-
font-size: 18px;
82-
margin-bottom: 16px;
83-
`;
84-
8580
const SuggestedFriendsWrapper = styled('div')`
8681
`;

src/js/pages/SetUpAccount/SetUpAccountRoot.jsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import PropTypes from 'prop-types';
44
import React, { Suspense } from 'react';
55
import styled from 'styled-components';
66
import BallotActions from '../../actions/BallotActions';
7+
import FriendActions from '../../actions/FriendActions';
78
import VoterActions from '../../actions/VoterActions';
89
import apiCalming from '../../common/utils/apiCalming';
910
import { isCordovaWide } from '../../common/utils/cordovaUtils';
@@ -22,16 +23,15 @@ import AppObservableStore from '../../stores/AppObservableStore';
2223
import VoterStore from '../../stores/VoterStore';
2324
import Reassurance from '../Startup/Reassurance';
2425

25-
const logoColorOnWhite = '../../../img/global/svg-icons/we-vote-icon-square-color-dark.svg';
26-
2726
const AddContactsFromGoogleButton = React.lazy(() => import(/* webpackChunkName: 'AddContactsFromGoogleButton' */ '../../components/SetUpAccount/AddContactsFromGoogleButton'));
2827
const SetUpAccountAddPhoto = React.lazy(() => import(/* webpackChunkName: 'SetUpAccountAddPhoto' */ '../../components/SetUpAccount/SetUpAccountAddPhoto'));
2928
const SetUpAccountEditName = React.lazy(() => import(/* webpackChunkName: 'SetUpAccountEditName' */ '../../components/SetUpAccount/SetUpAccountEditName'));
3029
const SetUpAccountFriendRequests = React.lazy(() => import(/* webpackChunkName: 'SetUpAccountFriendRequests' */ '../../components/SetUpAccount/SetUpAccountFriendRequests'));
3130
const SetUpAccountImportContacts = React.lazy(() => import(/* webpackChunkName: 'SetUpAccountImportContacts' */ '../../components/SetUpAccount/SetUpAccountImportContacts'));
3231
const SetUpAccountInviteContacts = React.lazy(() => import(/* webpackChunkName: 'SetUpAccountInviteContacts' */ '../../components/SetUpAccount/SetUpAccountInviteContacts'));
3332

34-
const inDevelopmentMode = false;
33+
const inDevelopmentMode = true;
34+
const logoColorOnWhite = '../../../img/global/svg-icons/we-vote-icon-square-color-dark.svg';
3535

3636
function NextButton (props) {
3737
return (
@@ -102,6 +102,9 @@ class SetUpAccountRoot extends React.Component {
102102
if (apiCalming('voterBallotItemsRetrieve', 10000)) {
103103
BallotActions.voterBallotItemsRetrieve();
104104
}
105+
if (apiCalming('friendListsAll', 30000)) {
106+
FriendActions.getAllFriendLists();
107+
}
105108
}
106109

107110
componentDidUpdate (prevProps, prevState) {

0 commit comments

Comments
 (0)