Skip to content

Commit bb04b0d

Browse files
committed
Enhanced Companies Tab with Structured Profiles
1 parent 6e2ddff commit bb04b0d

File tree

11 files changed

+764
-778
lines changed

11 files changed

+764
-778
lines changed

src/pages/interview-prep/BehavioralTab.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,16 @@ interface BehavioralCategory {
88
}
99

1010
interface BehavioralTabProps {
11-
behavioralQuestions: BehavioralCategory[];
12-
expandedCategories: { [key: number]: boolean };
11+
behavioralQuestions?: BehavioralCategory[];
12+
expandedCategories?: { [key: number]: boolean };
1313
toggleCategory: (index: number) => void;
1414
}
1515

1616
const fadeIn = { hidden: { opacity: 0, y: 20 }, visible: { opacity: 1, y: 0, transition: { duration: 0.6 } } };
1717
const staggerContainer = { hidden: {}, visible: { transition: { staggerChildren: 0.2 } } };
1818

19-
const BehavioralTab: React.FC<BehavioralTabProps> = ({ behavioralQuestions,
20-
expandedCategories,
19+
const BehavioralTab: React.FC<BehavioralTabProps> = ({ behavioralQuestions=[],
20+
expandedCategories=[],
2121
toggleCategory, }) => {
2222
return (
2323
<motion.div initial="hidden" animate="visible" variants={staggerContainer}>

src/pages/interview-prep/CompaniesTab.tsx

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ interface CompanyTip {
3737
}
3838

3939
interface 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 {
4747
const fadeIn = { hidden: { opacity: 0, y: 20 }, visible: { opacity: 1, y: 0, transition: { duration: 0.6 } } }
4848
const 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

Comments
 (0)