Skip to content

Commit 3fcdbfb

Browse files
committed
added changes
1 parent 299b9b0 commit 3fcdbfb

3 files changed

Lines changed: 128 additions & 18 deletions

File tree

nextstep-backend/src/controllers/linkedin_jobs_controller.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ export const getJobsBySkillsAndRole = async (req: Request, res: Response) => {
77
const skillsParam = String(req.query.skills || '').trim();
88
const role = String(req.query.role || '').trim();
99
const location = String(req.query.location || 'Israel').trim();
10+
const dateSincePosted = String(req.query.dateSincePosted || 'past week').trim();
11+
const jobType = String(req.query.jobType || 'full time').trim();
12+
const experienceLevel = String(req.query.experienceLevel || 'entry level').trim();
1013

1114
if (!skillsParam || !role) {
1215
return res.status(400).json({ error: 'Skills and role are required' });
@@ -19,14 +22,14 @@ export const getJobsBySkillsAndRole = async (req: Request, res: Response) => {
1922
.filter(Boolean);
2023

2124
// Construct keyword by combining role and skills
22-
const keyword = `${role} backend developer`.trim();
25+
const keyword = `${role} ${skillsArray.join(' ')}`.trim();
2326

2427
const queryOptions = {
2528
keyword,
2629
location,
27-
dateSincePosted: 'past week',
28-
jobType: 'full time',
29-
experienceLevel: 'entry level',
30+
dateSincePosted,
31+
jobType,
32+
experienceLevel,
3033
limit: '10',
3134
page: '0',
3235
};

nextstep-frontend/src/components/LinkedInIntegration.tsx

Lines changed: 115 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useState } from 'react';
2-
import { Box, Typography, Button, Grid, CircularProgress, IconButton } from '@mui/material';
3-
import { ExpandLess, ExpandMore, LinkedIn } from '@mui/icons-material'; // Import LinkedIn icon
2+
import { Box, Typography, Button, Grid, CircularProgress, IconButton, TextField, MenuItem, Select, FormControl, InputLabel } from '@mui/material';
3+
import { ExpandLess, ExpandMore, LinkedIn, Settings } from '@mui/icons-material';
44

55
interface Job {
66
position: string;
@@ -13,13 +13,21 @@ interface Job {
1313
interface LinkedInIntegrationProps {
1414
jobs: Job[];
1515
loadingJobs: boolean;
16-
fetchJobs: () => Promise<void>;
16+
fetchJobs: (settings: LinkedInSettings) => Promise<void>;
1717
showJobRecommendations: boolean;
1818
toggleJobRecommendations: () => void;
1919
skills: string[];
2020
selectedRole: string;
2121
}
2222

23+
interface LinkedInSettings {
24+
location: string;
25+
dateSincePosted: string;
26+
jobType: string;
27+
experienceLevel: string;
28+
skills: string[];
29+
}
30+
2331
const LinkedInIntegration: React.FC<LinkedInIntegrationProps> = ({
2432
jobs,
2533
loadingJobs,
@@ -29,41 +37,133 @@ const LinkedInIntegration: React.FC<LinkedInIntegrationProps> = ({
2937
skills,
3038
selectedRole,
3139
}) => {
40+
const [settings, setSettings] = useState<LinkedInSettings>({
41+
location: 'Israel',
42+
dateSincePosted: 'past week',
43+
jobType: 'full time',
44+
experienceLevel: 'entry level',
45+
skills: skills.slice(0, 3), // Limit to first 3 skills
46+
});
47+
48+
const handleSettingChange = (key: keyof LinkedInSettings, value: string) => {
49+
setSettings((prev) => ({ ...prev, [key]: value }));
50+
};
51+
52+
const handleSkillChange = (index: number, value: string) => {
53+
const updatedSkills = [...settings.skills];
54+
updatedSkills[index] = value;
55+
setSettings((prev) => ({ ...prev, skills: updatedSkills }));
56+
};
57+
58+
const handleFetchJobs = () => {
59+
fetchJobs(settings);
60+
};
61+
3262
return (
3363
<Box sx={{ bgcolor: 'background.paper', p: 3, borderRadius: 2, boxShadow: 1, mt: 4 }}>
3464
<Box sx={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', mb: 2 }}>
3565
<Box sx={{ display: 'flex', alignItems: 'center', flex: 1 }}>
36-
<LinkedIn sx={{ color: '#0077b5'}} />
66+
<LinkedIn sx={{ color: '#0077b5' }} />
3767
<Typography variant="h6" textAlign="center" flex={1}>
3868
Job Recommendations
3969
</Typography>
4070
</Box>
4171
<IconButton size="small" onClick={toggleJobRecommendations} sx={{ p: 0 }}>
42-
{showJobRecommendations ? <ExpandLess /> : <ExpandMore />}
72+
{showJobRecommendations ? <ExpandLess /> : <Settings />}
4373
</IconButton>
4474
</Box>
4575
{showJobRecommendations && (
4676
<>
77+
<Box sx={{ mb: 3 }}>
78+
<Grid container spacing={2}>
79+
<Grid item xs={12}>
80+
<Typography variant="body2" color="text.secondary">
81+
<strong>Selected Role:</strong> {selectedRole || 'None'}
82+
</Typography>
83+
</Grid>
84+
<Grid item xs={12} sm={6}>
85+
<TextField
86+
label="Location"
87+
value={settings.location}
88+
onChange={(e) => handleSettingChange('location', e.target.value)}
89+
fullWidth
90+
/>
91+
</Grid>
92+
<Grid item xs={12} sm={6}>
93+
<FormControl fullWidth>
94+
<InputLabel>Date Since Posted</InputLabel>
95+
<Select
96+
value={settings.dateSincePosted}
97+
onChange={(e) => handleSettingChange('dateSincePosted', e.target.value)}
98+
>
99+
<MenuItem value="past day">Past Day</MenuItem>
100+
<MenuItem value="past week">Past Week</MenuItem>
101+
<MenuItem value="past month">Past Month</MenuItem>
102+
</Select>
103+
</FormControl>
104+
</Grid>
105+
<Grid item xs={12} sm={6}>
106+
<FormControl fullWidth>
107+
<InputLabel>Job Type</InputLabel>
108+
<Select
109+
value={settings.jobType}
110+
onChange={(e) => handleSettingChange('jobType', e.target.value)}
111+
>
112+
<MenuItem value="full time">Full Time</MenuItem>
113+
<MenuItem value="part time">Part Time</MenuItem>
114+
<MenuItem value="contract">Contract</MenuItem>
115+
</Select>
116+
</FormControl>
117+
</Grid>
118+
<Grid item xs={12} sm={6}>
119+
<FormControl fullWidth>
120+
<InputLabel>Experience Level</InputLabel>
121+
<Select
122+
value={settings.experienceLevel}
123+
onChange={(e) => handleSettingChange('experienceLevel', e.target.value)}
124+
>
125+
<MenuItem value="all">All</MenuItem>
126+
<MenuItem value="entry level">Entry Level</MenuItem>
127+
<MenuItem value="mid level">Mid Level</MenuItem>
128+
<MenuItem value="senior level">Senior Level</MenuItem>
129+
</Select>
130+
</FormControl>
131+
</Grid>
132+
</Grid>
133+
</Box>
134+
<Grid item xs={12}>
135+
<Typography variant="body2" color="text.secondary">
136+
<strong>Skills Sent:</strong>
137+
</Typography>
138+
{settings.skills.map((skill, index) => (
139+
<TextField
140+
key={index}
141+
label={`Skill ${index + 1}`}
142+
value={skill}
143+
onChange={(e) => handleSkillChange(index, e.target.value)}
144+
fullWidth
145+
sx={{ mt: 1 }}
146+
/>
147+
))}
148+
</Grid>
149+
<br/>
47150
<Box sx={{ textAlign: 'center', mb: 3 }}>
48151
<Button
49152
variant="outlined"
50-
onClick={fetchJobs}
51-
disabled={loadingJobs || skills.length === 0 || !selectedRole}
153+
onClick={handleFetchJobs}
154+
disabled={loadingJobs || settings.skills.length === 0 || !selectedRole}
52155
sx={{
53156
width: '100%',
54157
maxWidth: '200px',
55158
padding: '8px 0',
56159
fontSize: '0.85rem',
57160
borderRadius: '6px',
58-
'&:hover': {
59-
backgroundColor: '#lighten(#1976d2, 0.1)',
60-
},
61161
}}
62162
>
63163
{loadingJobs ? <CircularProgress size={16} color="inherit" /> : 'Find Jobs'}
64164
</Button>
65165
</Box>
66-
{jobs.length > 0 && (
166+
{jobs.length > 0 ? (
67167
<Grid container spacing={2}>
68168
{jobs.map((job, index) => (
69169
<Grid item xs={12} md={6} key={index}>
@@ -112,6 +212,10 @@ const LinkedInIntegration: React.FC<LinkedInIntegrationProps> = ({
112212
</Grid>
113213
))}
114214
</Grid>
215+
) : (
216+
<Typography variant="body2" color="text.secondary" textAlign="center" sx={{ mt: 2 }}>
217+
No job recommendations found. Try adjusting your search settings.
218+
</Typography>
115219
)}
116220
</>
117221
)}

nextstep-frontend/src/pages/MainDashboard.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,17 @@ const MainDashboard: React.FC = () => {
163163
};
164164

165165
// Fetch Linkedin Jobs
166-
const fetchJobs = async () => {
166+
const fetchJobs = async (settings: { location: string; dateSincePosted: string; jobType: string; experienceLevel: string; skills?: string[] }) => {
167167
setLoadingJobs(true);
168168
try {
169169
const response = await api.get('/linkedin-jobs/jobs', {
170170
params: {
171-
skills: skills.join(','),
171+
skills: (settings.skills || skills.slice(0, 3)).join(','), // Use updated skills or default to first three
172172
role: selectedRole,
173-
location: 'Israel', // Optional: Add location if needed
173+
location: settings.location,
174+
dateSincePosted: settings.dateSincePosted,
175+
jobType: settings.jobType,
176+
experienceLevel: settings.experienceLevel,
174177
},
175178
});
176179
setJobs(response.data);

0 commit comments

Comments
 (0)