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

Commit a0378fc

Browse files
committed
fixes issue#66
2 parents c19e503 + 6cf9adb commit a0378fc

File tree

14 files changed

+100
-35
lines changed

14 files changed

+100
-35
lines changed

client/src/components/AddToGroupModal/index.jsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,11 @@ export default function AddToGroupModal({ onCancel, updateUser, user }) {
131131
};
132132

133133
return (
134-
<Modal onCancel={onCancel}>
134+
<Modal
135+
onCancel={onCancel}
136+
className={style.container}
137+
overlayClassName={style.overlay}
138+
>
135139
<h1 className={style.title}>Add to Group</h1>
136140
<div className={style.searchRow}>
137141
<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: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,29 @@ 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+
console.log("filters unmounted...");
35+
handleReset();
36+
};
37+
// eslint-disable-next-line react-hooks/exhaustive-deps
38+
}, []);
39+
40+
const handleReset = () => {
41+
search.selectLocations([]);
42+
search.selectSkills([]);
43+
search.selectAchievements([]);
44+
search.selectAvailability({
45+
isAvailableSelected: false,
46+
isUnavailableSelected: false,
47+
});
48+
search.selectCompanyAttributes({});
49+
search.changePageNumber(1);
50+
};
51+
2952
useEffect(() => {
3053
setLocationsData(locations);
3154
setAchievementsData(achievements);
@@ -202,7 +225,10 @@ export default function SearchTabFilters({ locations, achievements }) {
202225

203226
return (
204227
<div className={styles.searchTabFilters}>
205-
<Summary filtersApplied={numberOfFiltersApplied} />
228+
<Summary
229+
filtersApplied={numberOfFiltersApplied}
230+
handleReset={handleReset}
231+
/>
206232
{search.isFilterActive(FILTERS.LOCATIONS) && (
207233
<div className={utilityStyles.mt32}>
208234
<Collapsible title="Location" collapsed={false}>
@@ -302,21 +328,7 @@ SearchTabFilters.propTypes = {
302328
achievements: PT.array,
303329
};
304330

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-
331+
function Summary({ filtersApplied, handleReset }) {
320332
return (
321333
<div className={styles.searchTabFiltersSummary}>
322334
<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 & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@ export default function Header({
2828
const [searchText, setSearchText] = React.useState("");
2929
const [showAccountDropdown, setShowAccountDropdown] = React.useState(false);
3030

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

@@ -100,7 +107,12 @@ export default function Header({
100107
<div className={`${iconStyles.chevronDownG} ${style.arrow}`}></div>
101108
)}
102109
{showAccountDropdown && (
103-
<ul className={style.dropdown}>
110+
<ul
111+
tabIndex="0"
112+
className={style.dropdown}
113+
ref={profileDropdownEl}
114+
onBlur={() => setShowAccountDropdown(false)}
115+
>
104116
<li
105117
className={style.dropdownItem}
106118
onClick={() => logoutWithRedirect()}

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
border-bottom-left-radius: 4px;
3333
border-bottom-right-radius: 4px;
3434
overflow: hidden;
35+
36+
&:focus {
37+
outline: none;
38+
}
3539
}
3640

3741
.dropdownItem {
@@ -76,6 +80,7 @@
7680

7781
.downArrow {
7882
margin-left: 15px;
83+
overflow: hidden;
7984
}
8085

8186
.menu {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
border: 0;
1818
color: $black;
1919
font: 400 12pt/1.25 Inter;
20-
height: 38px;
20+
height: 36px;
2121
outline: none;
2222
}
2323

client/src/components/Modal/index.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import PT from "prop-types";
44

55
import style from "./style.module.scss";
66

7-
export default function Modal({ children, className }) {
7+
export default function Modal({ children, className, overlayClassName = "" }) {
88
const [portal, setPortal] = React.useState();
99

1010
React.useEffect(() => {
@@ -21,6 +21,9 @@ export default function Modal({ children, className }) {
2121
let containerStyle = style.container;
2222
if (className) containerStyle += ` ${className}`;
2323

24+
let overlayStyle = style.overlay;
25+
if (overlayClassName) overlayStyle += ` ${overlayClassName}`;
26+
2427
return portal
2528
? ReactDom.createPortal(
2629
<>
@@ -32,7 +35,7 @@ export default function Modal({ children, className }) {
3235
</div>
3336
<button
3437
aria-label="Cancel"
35-
className={style.overlay}
38+
className={overlayStyle}
3639
ref={(node) => {
3740
if (node) {
3841
node.focus();

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,12 @@
1515
}
1616
}
1717

18+
@-moz-document url-prefix() {
19+
.close {
20+
margin-bottom: 2px;
21+
}
22+
}
23+
1824
.container {
1925
align-items: center;
2026
background: $white;

client/src/components/SuggestionBox/index.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import config from "../../config";
44
import api from "../../services/api";
55
import style from "./style.module.scss";
66

7+
const NO_RESULTS_FOUND = "no results found";
8+
79
/**
810
* Decides what is displayed after the user selects a suggestion
911
* @param {Object} suggestion The selected suggestion
@@ -88,7 +90,8 @@ export default function SuggestionBox({
8890

8991
const onSuggestionsFetchRequested = async ({ value }) => {
9092
if (purpose === "skills") {
91-
const data = await getSkillsSuggestions(apiClient, value);
93+
let data = await getSkillsSuggestions(apiClient, value);
94+
if (data.length < 1) data = [{ name: NO_RESULTS_FOUND }];
9295
setSuggestions(data);
9396
} else {
9497
const data = await getCompanyAttributesSuggestions(
@@ -104,7 +107,7 @@ export default function SuggestionBox({
104107

105108
const onSuggestionSelected = (event, { suggestion }) => {
106109
if (purpose === "skills") {
107-
onSelect(suggestion);
110+
if (suggestion.name !== NO_RESULTS_FOUND) onSelect(suggestion);
108111
} else {
109112
onSelect(companyAttrId, suggestion);
110113
}

client/src/components/tag/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,10 @@ export default function Tag({
6464
}, [text, selected]);
6565

6666
return (
67-
<button className={mainStyle} onClick={onClickAction}>
67+
<button className={mainStyle} title={text} onClick={onClickAction}>
6868
{text ? (
6969
<div className={styles.tagContent}>
70-
{text && <span title={text}>{text}</span>}
70+
{text && <span>{text}</span>}
7171
{icon && <TagButton icon={icon} />}
7272
</div>
7373
) : (

client/src/pages/Search/Global.jsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,18 @@ export default function SearchGlobal({ keyword }) {
5858
const [windowWidth, setWindowWidth] = React.useState(window.innerWidth);
5959
const [orderBy, setOrderBy] = React.useState(config.DEFAULT_SORT_ORDER);
6060
const [totalPages, setTotalPages] = React.useState(0);
61+
const dropdownRef = React.useRef(null);
6162

6263
const prevOrderBy = usePrevious(orderBy);
6364

6465
const usersPerPage = config.ITEMS_PER_PAGE;
6566

6667
React.useEffect(() => {
6768
window.addEventListener("resize", updateWindowDimensions);
69+
window.addEventListener("click", onWholeContentClick);
6870
return () => {
6971
window.removeEventListener("resize", updateWindowDimensions);
72+
window.removeEventListener("click", onWholeContentClick);
7073
};
7174
});
7275

@@ -237,6 +240,7 @@ export default function SearchGlobal({ keyword }) {
237240
});
238241

239242
setUsers(data);
243+
setSortByDropdownShown(false);
240244
setTotalResults(Number(headers["x-total"]));
241245
setTotalPages(Number(headers["x-total-pages"]));
242246
}
@@ -269,6 +273,12 @@ export default function SearchGlobal({ keyword }) {
269273
searchContext.changePageNumber(newPageNumber);
270274
};
271275

276+
const onWholeContentClick = (evt) => {
277+
if (dropdownRef.current && !dropdownRef.current.contains(evt.target)) {
278+
setSortByDropdownShown(false);
279+
}
280+
};
281+
272282
return (
273283
<>
274284
<div className={style.sideMenu}>
@@ -286,6 +296,7 @@ export default function SearchGlobal({ keyword }) {
286296
</div>
287297
<div
288298
className={style.sort}
299+
ref={dropdownRef}
289300
onClick={() => setSortByDropdownShown(!sortByDropdownShown)}
290301
style={{
291302
marginRight:
@@ -302,7 +313,7 @@ export default function SearchGlobal({ keyword }) {
302313
{getOrderByText(orderBy)}
303314
</span>
304315
)}
305-
<DownArrowIcon />
316+
<DownArrowIcon className={style.downArrow} />
306317
{sortByDropdownShown && (
307318
<ul className={style.dropdown}>
308319
<li

client/src/pages/Search/style.module.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@
5656
margin-bottom: 100px;
5757
}
5858

59+
.downArrow {
60+
overflow: hidden;
61+
}
62+
5963
.pills {
6064
margin: 15px -5px 0;
6165
}

client/src/services/api.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ export default () => {
3333
await loginWithRedirect({
3434
redirect_uri: window.location.origin,
3535
});
36-
} else if (
37-
error.response &&
38-
error.response.status === 409 &&
39-
error.response.data.message
40-
) {
36+
} else if (error.response && error.response.data.message) {
4137
const modError = new Error(error.response.data.message);
4238
return Promise.reject(modError);
4339
}

0 commit comments

Comments
 (0)