1
1
document . addEventListener ( "DOMContentLoaded" , ( ) => {
2
- loadCompanyNames ( ) ; // Load company names when the page loads
2
+ // loadCompanyNames(); // Load company names when the page loads
3
+ loadCompanyNames ( ) ;
4
+ bindTabEvents ( ) ;
3
5
} ) ;
4
6
5
7
let companyInfo = { } ; // To store parsed company_info.json
8
+ let selectedRow = null ; // To track the currently selected row
6
9
7
- async function openTab ( tabName , headerText ) {
10
+ function bindTabEvents ( ) {
11
+ const companyTab = document . getElementById ( 'companyQuestionsTab' ) ;
12
+ const interviewTab = document . getElementById ( 'interviewQuestionsTab' ) ;
13
+
14
+ companyTab . addEventListener ( 'click' , ( ) => openTab ( 'companyQuestions' , 'Filtered by Company' , companyTab ) ) ;
15
+ interviewTab . addEventListener ( 'click' , ( ) => openTab ( 'companyTable' , 'Filtered by Problems' , interviewTab ) ) ;
16
+ }
17
+
18
+ async function openTab ( tabName , headerText , tabElement ) {
8
19
document . getElementById ( 'companyInfoHeaderText' ) . innerText = headerText ;
9
20
10
21
const contents = document . getElementsByClassName ( 'tab-content' ) ;
@@ -18,13 +29,13 @@ async function openTab(tabName, headerText) {
18
29
}
19
30
20
31
document . getElementById ( tabName ) . classList . add ( 'active' ) ;
21
- event . target . classList . add ( 'active' ) ;
32
+ tabElement . classList . add ( 'active' ) ;
22
33
23
34
// Check if company names are already loaded
24
- const tbody = document . getElementById ( 'companyNameTable' ) . querySelector ( 'tbody' ) ;
35
+ /* const tbody = document.getElementById('companyNameTable').querySelector('tbody');
25
36
if (tabName === 'companyQuestions' && tbody.children.length === 0) {
26
37
await loadCompanyNames();
27
- }
38
+ } */
28
39
}
29
40
30
41
0 commit comments