11import 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
55interface Job {
66 position : string ;
@@ -13,13 +13,21 @@ interface Job {
1313interface 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+
2331const 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 ) }
0 commit comments