Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 9d3767d

Browse files
Merge branch 'develop' into issue_315
2 parents 1d9b6bd + 0318b7f commit 9d3767d

File tree

24 files changed

+254
-151
lines changed

24 files changed

+254
-151
lines changed

client/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 16 additions & 74 deletions
Loading

client/src/components/AddToGroupModal/Group/style.module.scss

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
height: 45px;
1111
padding: 0 30px;
1212
position: relative;
13+
justify-content: space-between;
1314

1415
&:last-child {
1516
border-bottom: 1px solid $lightGray2;
@@ -22,8 +23,3 @@
2223
max-width: 400px;
2324
white-space: nowrap;
2425
}
25-
26-
.switch {
27-
position: absolute;
28-
right: 30px;
29-
}

client/src/components/AddToGroupModal/index.jsx

Lines changed: 43 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from "react";
1+
import React, { useEffect } from "react";
22
import PT from "prop-types";
33

44
import Button from "../Button";
@@ -10,6 +10,7 @@ import { useAuth0 } from "../../react-auth0-spa";
1010
import * as groupLib from "../../lib/groups";
1111

1212
import style from "./style.module.scss";
13+
import Axios from "axios";
1314

1415
export default function AddToGroupModal({ onCancel, updateUser, user }) {
1516
const apiClient = api();
@@ -21,34 +22,50 @@ export default function AddToGroupModal({ onCancel, updateUser, user }) {
2122
const [updatingGroups, setUpdatingGroups] = React.useState(false);
2223
const [userGroups, setUserGroups] = React.useState(user.groups);
2324
const [creatingGroup, setCreatingGroup] = React.useState(false);
25+
const cancelTokenSource = Axios.CancelToken.source();
26+
27+
/**
28+
* Component unmount trigger
29+
*/
30+
useEffect(() => {
31+
return () => {
32+
cancelTokenSource.cancel();
33+
};
34+
});
2435

2536
React.useEffect(() => {
2637
if (isLoading || !isAuthenticated) {
2738
return;
2839
}
2940

3041
(async () => {
31-
const groups = await groupLib.getGroups(apiClient, auth0User.nickname);
32-
33-
groups.myGroups.forEach((g, i, a) => {
34-
userGroups.forEach((ug, iug, aug) => {
35-
if (g.id === ug.id && !ug.isDeleted) {
36-
a[i] = { ...g, isSelected: true };
37-
}
42+
const groups = await groupLib.getGroups(
43+
apiClient,
44+
auth0User.nickname,
45+
cancelTokenSource.token
46+
);
47+
48+
if (groups) {
49+
groups.myGroups.forEach((g, i, a) => {
50+
userGroups.forEach((ug, iug, aug) => {
51+
if (g.id === ug.id && !ug.isDeleted) {
52+
a[i] = { ...g, isSelected: true };
53+
}
54+
});
3855
});
39-
});
4056

41-
groups.otherGroups.forEach((g, i, a) => {
42-
userGroups.forEach((ug, iug, aug) => {
43-
if (g.id === ug.id && !ug.isDeleted) {
44-
a[i] = { ...g, isSelected: true };
45-
}
57+
groups.otherGroups.forEach((g, i, a) => {
58+
userGroups.forEach((ug, iug, aug) => {
59+
if (g.id === ug.id && !ug.isDeleted) {
60+
a[i] = { ...g, isSelected: true };
61+
}
62+
});
4663
});
47-
});
4864

49-
setMyGroups(groups.myGroups);
50-
setOtherGroups(groups.otherGroups);
51-
setIsLoadingGroups(false);
65+
setMyGroups(groups.myGroups);
66+
setOtherGroups(groups.otherGroups);
67+
setIsLoadingGroups(false);
68+
}
5269
})();
5370
// eslint-disable-next-line react-hooks/exhaustive-deps
5471
}, [isLoading, isAuthenticated, auth0User]);
@@ -111,7 +128,7 @@ export default function AddToGroupModal({ onCancel, updateUser, user }) {
111128

112129
const newGroup = await groupLib.createGroup(apiClient, groupName);
113130

114-
if (newGroup.id) {
131+
if (newGroup && newGroup.id) {
115132
const newOtherGroups = JSON.parse(JSON.stringify(otherGroups));
116133

117134
newOtherGroups.push(newGroup);
@@ -121,6 +138,8 @@ export default function AddToGroupModal({ onCancel, updateUser, user }) {
121138
alert(`Group with name ${groupName} created successfully`);
122139

123140
setFilter("");
141+
} else if (newGroup.message) {
142+
alert(newGroup.message);
124143
} else {
125144
alert("Group creation failed");
126145
}
@@ -129,7 +148,11 @@ export default function AddToGroupModal({ onCancel, updateUser, user }) {
129148
};
130149

131150
return (
132-
<Modal onCancel={onCancel}>
151+
<Modal
152+
onCancel={onCancel}
153+
className={style.container}
154+
overlayClassName={style.overlay}
155+
>
133156
<h1 className={style.title}>Add to Group</h1>
134157
<div className={style.searchRow}>
135158
<ZoomIcon className={style.zoomIcon} />

client/src/components/AddToGroupModal/style.module.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
@import "../../styles/mixins";
22

3+
.container {
4+
z-index: 1100;
5+
}
6+
7+
.overlay {
8+
z-index: 1010;
9+
}
10+
311
.buttons {
412
display: flex;
513
justify-content: flex-end;

client/src/components/FiltersSideMenu/filters.js

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,28 @@ export default function SearchTabFilters({ locations, achievements }) {
2626
const [locationsData, setLocationsData] = useState(locations);
2727
const [achievementsData, setAchievementsData] = useState(achievements);
2828

29+
/**
30+
* Component unmount trigger
31+
*/
32+
useEffect(() => {
33+
return () => {
34+
handleReset();
35+
};
36+
// eslint-disable-next-line react-hooks/exhaustive-deps
37+
}, []);
38+
39+
const handleReset = () => {
40+
search.selectLocations([]);
41+
search.selectSkills([]);
42+
search.selectAchievements([]);
43+
search.selectAvailability({
44+
isAvailableSelected: false,
45+
isUnavailableSelected: false,
46+
});
47+
search.selectCompanyAttributes({});
48+
search.changePageNumber(1);
49+
};
50+
2951
useEffect(() => {
3052
setLocationsData(locations);
3153
setAchievementsData(achievements);
@@ -202,7 +224,10 @@ export default function SearchTabFilters({ locations, achievements }) {
202224

203225
return (
204226
<div className={styles.searchTabFilters}>
205-
<Summary filtersApplied={numberOfFiltersApplied} />
227+
<Summary
228+
filtersApplied={numberOfFiltersApplied}
229+
handleReset={handleReset}
230+
/>
206231
{search.isFilterActive(FILTERS.LOCATIONS) && (
207232
<div className={utilityStyles.mt32}>
208233
<Collapsible title="Location" collapsed={false}>
@@ -302,21 +327,7 @@ SearchTabFilters.propTypes = {
302327
achievements: PT.array,
303328
};
304329

305-
function Summary({ filtersApplied }) {
306-
const search = useSearch();
307-
308-
const handleReset = () => {
309-
search.selectLocations([]);
310-
search.selectSkills([]);
311-
search.selectAchievements([]);
312-
search.selectAvailability({
313-
isAvailableSelected: false,
314-
isUnavailableSelected: false,
315-
});
316-
search.selectCompanyAttributes({});
317-
search.changePageNumber(1);
318-
};
319-
330+
function Summary({ filtersApplied, handleReset }) {
320331
return (
321332
<div className={styles.searchTabFiltersSummary}>
322333
<div className={styles.searchTabFiltersSummaryTextContainer}>

client/src/components/GroupsSideMenu/filters.module.css

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151

5252
.groupTabFiltersContentSearchCreate {
5353
align-self: flex-end;
54-
margin-left: auto;
54+
margin-left: 15px;
5555
}
5656

5757
.groupTabGroupsContainer {
@@ -83,13 +83,13 @@
8383

8484
.sectionItem {
8585
cursor: pointer;
86-
height: 24px;
8786
width: 322px;
8887
border-radius: 10px;
8988
border: 1px solid gray1_025;
9089

9190
display: flex;
9291
flex-direction: row;
92+
align-items: center;
9393
padding-left: 17px;
9494
padding-top: 13px;
9595
padding-bottom: 13px;
@@ -101,12 +101,13 @@
101101
}
102102

103103
.sectionItemTitle {
104-
align-self: flex-start;
105104
color: gray2;
105+
word-break: break-word;
106+
padding-right: 12px;
106107
}
107108

108109
.sectionItemBadge {
109-
align-self: flex-start;
110+
align-self: center;
110111
margin-left: auto;
111112
color: gray1;
112113

client/src/components/Header/index.jsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import React from "react";
22
import PT from "prop-types";
33

4-
import { ReactComponent as DownArrow } from "../../assets/images/down-arrow.svg";
54
import { ReactComponent as SearchTabIcon } from "../../assets/images/search-tab-icon.svg";
65
import { ReactComponent as GroupsTabIcon } from "../../assets/images/groups-tab-icon.svg";
76
import { ReactComponent as UploadsTabIcon } from "../../assets/images/uploads-tab-icon.svg";
@@ -29,6 +28,13 @@ export default function Header({
2928
const [searchText, setSearchText] = React.useState("");
3029
const [showAccountDropdown, setShowAccountDropdown] = React.useState(false);
3130

31+
const profileDropdownEl = React.useRef(null);
32+
React.useEffect(() => {
33+
if (showAccountDropdown) {
34+
profileDropdownEl.current.focus();
35+
}
36+
}, [showAccountDropdown]);
37+
3238
const handleSearch = (value) => {
3339
value = value || searchText;
3440

@@ -101,7 +107,12 @@ export default function Header({
101107
<div className={`${iconStyles.chevronDownG} ${style.arrow}`}></div>
102108
)}
103109
{showAccountDropdown && (
104-
<ul className={style.dropdown}>
110+
<ul
111+
tabIndex="0"
112+
className={style.dropdown}
113+
ref={profileDropdownEl}
114+
onBlur={() => setShowAccountDropdown(false)}
115+
>
105116
<li
106117
className={style.dropdownItem}
107118
onClick={() => logoutWithRedirect()}

0 commit comments

Comments
 (0)