Skip to content

Commit 358451f

Browse files
committed
begin building the recruiter flow
1 parent e83cf35 commit 358451f

File tree

4 files changed

+171
-26
lines changed

4 files changed

+171
-26
lines changed

clientv2/src/components/ProfileViewer/LinkProfileAttribute.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ export const LinkProfileAttribute: React.FC<LinkProfileAttributeProps> = ({
2121
return (
2222
<Group>
2323
{editable ? (
24-
<TextInput label={name} value={url} onChange={(e) => handleInputChange(e.target.value)} style={{width: '100%'}}/>
24+
<TextInput
25+
label={name}
26+
value={url}
27+
onChange={(e) => handleInputChange(e.target.value)}
28+
style={{ width: '100%' }}
29+
/>
2530
) : (
2631
<>
2732
<ThemeIcon color="blue" size={20} radius="xl">

clientv2/src/components/ProfileViewer/options.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export const institutionOptions = [
5757
...otherInstitutionOptions.sort(),
5858
];
5959

60-
const csPlusXMajors = [
60+
export const csPlusXMajors = [
6161
'Computer Science + Animal Sciences',
6262
'Computer Science + Crop Sciences',
6363
'Computer Science + Education',
@@ -76,14 +76,9 @@ const csPlusXMajors = [
7676
'Statistics & Computer Science',
7777
];
7878

79-
const commonMajors = [
80-
'Computer Science',
81-
'Computer Engineering',
82-
'Electrical Engineering',
83-
'Mathematics',
84-
];
79+
export const commonMajors = ['Computer Engineering', 'Electrical Engineering', 'Mathematics'];
8580

86-
const otherMajors = [
81+
export const otherMajors = [
8782
'Accountancy',
8883
'Advertising',
8984
'Aerospace Engineering',
@@ -183,19 +178,19 @@ export type DegreeLevel = (typeof degreeOptions)[number];
183178

184179
export const majorOptions: Record<DegreeLevel, any> = {
185180
"Associate's": [
186-
{ group: 'Common Majors', items: commonMajors },
181+
{ group: 'Common Majors', items: ['Computer Science', ...commonMajors] },
187182
{ group: 'Other Majors', items: otherMajors },
188183
],
189184
"Bachelor's": [
190-
{ group: 'Common Majors', items: [...commonMajors, ...csPlusXMajors] },
185+
{ group: 'Common Majors', items: ['Computer Science', ...commonMajors, ...csPlusXMajors] },
191186
{ group: 'Other Majors', items: otherMajors },
192187
],
193188
"Master's (Thesis)": [
194-
{ group: 'Common Majors', items: commonMajors },
189+
{ group: 'Common Majors', items: ['Computer Science', ...commonMajors] },
195190
{ group: 'Other Majors', items: otherMajors },
196191
],
197192
"Master's (Non-Thesis)": [
198-
{ group: 'Common Majors', items: commonMajors },
193+
{ group: 'Common Majors', items: ['Computer Science', ...commonMajors] },
199194
{ group: 'Other Majors', items: otherMajors },
200195
],
201196
PhD: [
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
import React, { useState } from 'react';
2+
import { Button, Grid, Group, MultiSelect, NumberInput, Stack, Tooltip } from '@mantine/core';
3+
import { csPlusXMajors, degreeOptions, majorOptions } from '../ProfileViewer/options';
4+
import { IconSearch } from '@tabler/icons-react';
5+
6+
interface DegreeFilterProps {
7+
onFilter: CallableFunction;
8+
}
9+
10+
export interface Filters {
11+
degreeTypes: string[];
12+
gpa?: number;
13+
graduationYears: string[];
14+
majors: string[];
15+
skills?: string[];
16+
}
17+
18+
const DegreeFilter: React.FC<DegreeFilterProps> = ({ onFilter }) => {
19+
const [degreeTypes, setDegreeType] = useState<string[]>([]);
20+
const [graduationYears, setGraduationYears] = useState<string[]>([]);
21+
const [majors, setMajors] = useState<string[]>([]);
22+
const [gpa, setGpa] = useState<number>(3.0);
23+
24+
const currentYear = new Date().getFullYear();
25+
const validGradYears: string[] = [
26+
currentYear - 1,
27+
currentYear,
28+
currentYear + 1,
29+
currentYear + 2,
30+
currentYear + 3,
31+
currentYear + 4,
32+
currentYear + 5,
33+
].map((x) => x.toString());
34+
35+
const handleFilter = () => {
36+
const filters: Filters = {
37+
degreeTypes,
38+
gpa,
39+
graduationYears,
40+
majors,
41+
};
42+
onFilter(filters);
43+
};
44+
45+
const selectAlCsMajors = () => {
46+
setMajors(['Computer Science', ...csPlusXMajors]);
47+
};
48+
49+
const SelectAllCSButton = () => (
50+
<Tooltip label="Selects Computer Science and CS + X majors.">
51+
<Button onClick={selectAlCsMajors} fullWidth mt="xs">
52+
Select All CS Majors
53+
</Button>
54+
</Tooltip>
55+
);
56+
57+
return (
58+
<Stack>
59+
<MultiSelect
60+
label="Degree Level"
61+
placeholder="Select degree level"
62+
data={degreeOptions}
63+
value={degreeTypes}
64+
onChange={setDegreeType}
65+
clearable
66+
/>
67+
<NumberInput
68+
label="GPA (Minimum, Inclusive)"
69+
min={0.0}
70+
max={4.0}
71+
clampBehavior="strict"
72+
allowNegative={false}
73+
decimalScale={2}
74+
value={gpa}
75+
hideControls
76+
onChange={(e) => setGpa(parseFloat(e as string))}
77+
/>
78+
<MultiSelect
79+
label="Graduation Year"
80+
placeholder="Select graduation years"
81+
data={validGradYears}
82+
value={graduationYears}
83+
onChange={setGraduationYears}
84+
/>
85+
<Grid align="flex-end">
86+
<Grid.Col span={9}>
87+
<MultiSelect
88+
label="Major"
89+
placeholder="Select majors"
90+
data={majorOptions["Bachelor's"]}
91+
value={majors}
92+
onChange={setMajors}
93+
clearable
94+
/>
95+
</Grid.Col>
96+
<Grid.Col span={3}>
97+
<SelectAllCSButton />
98+
</Grid.Col>
99+
</Grid>
100+
<Group>
101+
<Button color="green" leftSection={<IconSearch size={14} />} onClick={handleFilter}>
102+
Search
103+
</Button>
104+
</Group>
105+
</Stack>
106+
);
107+
};
108+
109+
export default DegreeFilter;
Lines changed: 49 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,61 @@
1-
import { Button, Title } from '@mantine/core';
1+
import { useState } from 'react';
2+
import { Title, Container } from '@mantine/core';
23
import { useAuth } from '@/components/AuthContext';
34
import { HeaderNavbar } from '@/components/Navbar';
5+
import DegreeFilter, { Filters } from '@/components/SearchProfiles';
6+
import { useApi } from '@/util/api';
7+
import { notifications } from '@mantine/notifications';
8+
import FullScreenLoader from '@/components/AuthContext/LoadingScreen';
49

10+
11+
function showErrorNotification(title?: string) {
12+
notifications.show({
13+
title: title || "Failed to Fetch Profiles",
14+
message: "Please try again or contact the ACM@UIUC Corporate Team.",
15+
color: 'red'
16+
})
17+
}
518
export function RecruiterHomePage() {
6-
const { userData, getToken } = useAuth();
7-
const [lastName, firstName] = userData?.name?.split(',') as string[];
8-
const doAuthStuff = async () => {
9-
if (!userData) {
10-
return;
19+
const { userData } = useAuth();
20+
const [loading, setLoading] = useState<boolean>(false);
21+
const api = useApi();
22+
23+
const handleFilter = async (filters: Filters) => {
24+
let response;
25+
try {
26+
setLoading(true);
27+
response = await api.post("/recruiter/search", filters)
28+
} catch {
29+
setLoading(false);
30+
return showErrorNotification()
31+
}
32+
if (response.status != 200) {
33+
setLoading(false);
34+
return showErrorNotification();
1135
}
12-
console.log(await getToken());
36+
console.log(response);
37+
setLoading(false);
1338
};
39+
if (loading) {
40+
return <FullScreenLoader />
41+
}
1442
return (
1543
<>
1644
<HeaderNavbar userData={userData} />
17-
<div style={{ display: 'flex', alignItems: 'center' }}>
18-
<Title>
19-
Hello {firstName} {lastName}!
20-
</Title>
21-
<Button onClick={doAuthStuff}>Do Auth Stuff</Button>
22-
</div>
45+
<Container>
46+
<div
47+
style={{
48+
display: 'flex',
49+
alignItems: 'center',
50+
justifyContent: 'space-between',
51+
marginBottom: '20px',
52+
}}
53+
>
54+
<Title order={1}>Search Resume Book</Title>
55+
</div>
56+
<DegreeFilter onFilter={handleFilter} />
57+
{/* Render filtered data here based on the filters state */}
58+
</Container>
2359
</>
2460
);
2561
}

0 commit comments

Comments
 (0)