@@ -37,7 +37,7 @@ interface CompanyTip {
3737}
3838
3939interface CompaniesTabProps {
40- companyTips : CompanyTip [ ] ;
40+ companyTips ? : CompanyTip [ ] ;
4141 toggleTips : ( index : number ) => void ;
4242 toggleQuestions : ( index : number ) => void ;
4343 showTips : { [ key : number ] : boolean } ;
@@ -47,15 +47,14 @@ interface CompaniesTabProps {
4747const fadeIn = { hidden : { opacity : 0 , y : 20 } , visible : { opacity : 1 , y : 0 , transition : { duration : 0.6 } } }
4848const staggerContainer = { hidden : { } , visible : { transition : { staggerChildren : 0.1 } } }
4949
50- const CompaniesTab : React . FC < CompaniesTabProps > = ( { companyTips } ) => {
50+ const CompaniesTab : React . FC < CompaniesTabProps > = ( { companyTips= [ ] } ) => {
5151 const [ searchTerm , setSearchTerm ] = useState ( "" )
5252 const [ selectedIndustry , setSelectedIndustry ] = useState ( "" )
5353 const [ selectedRole , setSelectedRole ] = useState ( "" )
5454 const [ expandedQuestions , setExpandedQuestions ] = useState < { [ key : string ] : boolean } > ( { } )
55- const [ isOpen , setIsOpen ] = useState ( false )
5655
5756 const filteredCompanies = useMemo ( ( ) => {
58- return companyTips . filter ( ( company ) => {
57+ return ( companyTips || [ ] ) . filter ( ( company ) => {
5958 const matchesSearch =
6059 company . company . toLowerCase ( ) . includes ( searchTerm . toLowerCase ( ) ) ||
6160 company . focus . toLowerCase ( ) . includes ( searchTerm . toLowerCase ( ) ) ||
@@ -68,8 +67,8 @@ const CompaniesTab: React.FC<CompaniesTabProps> = ({ companyTips }) => {
6867 } )
6968 } , [ companyTips , searchTerm , selectedIndustry , selectedRole ] )
7069
71- const industries = [ ...new Set ( companyTips . map ( ( c ) => c . industry ) ) ]
72- const roles = [ ...new Set ( companyTips . flatMap ( ( c ) => c . roleTypes ) ) ]
70+ const industries = [ ...new Set ( ( companyTips || [ ] ) . map ( ( c ) => c . industry ) ) ]
71+ const roles = [ ...new Set ( ( companyTips || [ ] ) . flatMap ( ( c ) => c . roleTypes ) ) ]
7372
7473 const toggleQuestion = ( companyIndex : number , questionIndex : number ) => {
7574 const key = `${ companyIndex } -${ questionIndex } `
@@ -153,8 +152,8 @@ const CompaniesTab: React.FC<CompaniesTabProps> = ({ companyTips }) => {
153152 bgColor : "bg-orange-500" ,
154153 stats : "100+ Questions" ,
155154 } ,
156- ] . map ( ( item , i ) => (
157- < motion . div
155+ ] ? .map ( ( item , i ) => (
156+ item ? ( < motion . div
158157 key = { i }
159158 className = "bg-white dark:bg-gray-800 rounded-2xl p-6 text-center shadow-lg hover:shadow-xl transition-all duration-300 transform hover:scale-105"
160159 whileHover = { { y : - 5 } }
@@ -177,7 +176,7 @@ const CompaniesTab: React.FC<CompaniesTabProps> = ({ companyTips }) => {
177176 < div className = "inline-flex items-center px-3 py-1 bg-gray-100 dark:bg-gray-700 rounded-full text-xs font-semibold text-gray-700 dark:text-gray-300" >
178177 { item . stats }
179178 </ div >
180- </ motion . div >
179+ </ motion . div > ) : null
181180 ) ) }
182181 </ div >
183182
@@ -186,7 +185,8 @@ const CompaniesTab: React.FC<CompaniesTabProps> = ({ companyTips }) => {
186185 { metric : "92%" , label : "Interview Success Rate" , icon : "📈" , color : "text-green-600" } ,
187186 { metric : "150+" , label : "Companies Covered" , icon : "🏢" , color : "text-blue-600" } ,
188187 { metric : "50K+" , label : "Successful Candidates" , icon : "👥" , color : "text-purple-600" } ,
189- ] . map ( ( stat , i ) => (
188+ ] ?. map ( ( stat , i ) => (
189+ stat ?(
190190 < motion . div
191191 key = { i }
192192 className = "text-center p-6 bg-white/50 dark:bg-gray-800/50 rounded-xl backdrop-blur-sm border company-border"
@@ -199,7 +199,7 @@ const CompaniesTab: React.FC<CompaniesTabProps> = ({ companyTips }) => {
199199 < span > { stat . icon } </ span >
200200 { stat . label }
201201 </ div >
202- </ motion . div >
202+ </ motion . div > ) : null
203203 ) ) }
204204 </ div >
205205 </ div >
@@ -250,7 +250,7 @@ const CompaniesTab: React.FC<CompaniesTabProps> = ({ companyTips }) => {
250250 < div className = "flex items-center justify-between" >
251251 < div className = "text-sm text-gray-600 dark:text-gray-400 flex items-center gap-2" >
252252 < Building2 className = "w-4 h-4" />
253- Showing { filteredCompanies . length } of { companyTips . length } companies
253+ Showing { filteredCompanies . length } of { companyTips ? .length || 0 } companies
254254 </ div >
255255 < div className = "flex items-center gap-2 text-xs text-gray-500 dark:text-gray-400" >
256256 < Star className = "w-3 h-3" />
@@ -261,6 +261,7 @@ const CompaniesTab: React.FC<CompaniesTabProps> = ({ companyTips }) => {
261261
262262 < div className = "space-y-12" >
263263 { filteredCompanies . map ( ( company , companyIndex ) => {
264+ const [ isOpen , setIsOpen ] = useState ( false )
264265 return (
265266 < motion . div key = { companyIndex } variants = { fadeIn } className = "group" >
266267 < Card className = "overflow-hidden shadow-xl hover:shadow-2xl transition-all duration-500 transform hover:scale-[1.02] border-0" >
0 commit comments