File size: 11,197 Bytes
f757315
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Analytics - ResumeRocket</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
    <script src="https://unpkg.com/feather-icons"></script>
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#d946ef',
                        secondary: '#6b7280'
                    }
                }
            }
        }
    </script>
    <style>
        .gradient-bg {
            background: linear-gradient(135deg, #fdf4ff 0%, #faf5ff 100%);
        }
        .chart-placeholder {
            background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
        }
    </style>
</head>
<body class="gradient-bg min-h-screen">
    <!-- Navigation -->
    <nav class="bg-white shadow-sm border-b">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex justify-between h-16">
                <div class="flex items-center">
                    <div class="flex-shrink-0 flex items-center">
                        <div class="w-8 h-8 bg-primary rounded-lg flex items-center justify-center">
                            <i data-feather="rocket" class="text-white w-4 h-4"></i>
                        </div>
                        <span class="ml-2 text-xl font-bold text-gray-900">ResumeRocket</span>
                    </div>
                    <div class="hidden md:ml-6 md:flex md:space-x-8">
                            <a href="index.html" class="border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">Home</a>
                            <a href="job.html" class="border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">Job Description</a>
                            <a href="resumes.html" class="border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">Resumes</a>
                            <a href="candidates.html" class="border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">Candidates</a>
                            <a href="analytics.html" class="border-primary text-gray-900 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">Analytics</a>
                            <a href="settings.html" class="border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300 inline-flex items-center px-1 pt-1 border-b-2 text-sm font-medium">Settings</a>
                        </div>
                </div>
                <div class="flex items-center space-x-4">
                    <span class="text-sm text-gray-500">Analytics</span>
                </div>
            </div>
        </div>
    </nav>

    <!-- Breadcrumbs -->
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4">
        <nav class="flex" aria-label="Breadcrumb">
            <ol class="flex items-center space-x-4">
                <li>
                    <div>
                        <a href="index.html" class="text-gray-400 hover:text-gray-500">
                            <i data-feather="home" class="w-4 h-4"></i>
                        </a>
                    </div>
                </li>
                <li>
                    <div class="flex items-center">
                        <i data-feather="chevron-right" class="w-4 h-4 text-gray-400"></i>
                        <span class="ml-4 text-sm font-medium text-gray-500">Analytics</span>
                    </div>
                </li>
            </ol>
        </nav>
    </div>

    <!-- Main Content -->
    <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
        <div class="bg-white rounded-lg shadow-lg p-6">
            <h1 class="text-2xl font-bold text-gray-900 mb-6">Scoring Analytics</h1>
            
            <!-- Export Buttons -->
            <div class="flex justify-end space-x-3 mb-6">
                <button id="copy-json-btn" class="bg-white border border-gray-300 text-gray-700 px-4 py-2 rounded-lg text-sm font-medium hover:bg-gray-50">
                        Copy JSON
                    </button>
                    <button id="copy-csv-btn" class="bg-primary hover:bg-fuchsia-600 text-white px-4 py-2 rounded-lg text-sm font-medium">
                        Export CSV
                    </button>
                </div>

            <!-- Charts Grid -->
            <div class="grid grid-cols-1 lg:grid-cols-2 gap-6 mb-8">
                <!-- Hybrid Score Bar Chart -->
                <div class="bg-white rounded-lg border border-gray-200 p-4">
                        <h3 class="text-lg font-medium text-gray-900 mb-4">Hybrid Scores by Candidate</h3>
                    <div class="chart-placeholder h-64 rounded-lg flex items-center justify-center">
                            <i data-feather="bar-chart-2" class="w-12 h-12 text-gray-400"></i>
                        </div>
                    </div>

                <!-- Area Coverage Stacked Bar -->
                <div class="bg-white rounded-lg border border-gray-200 p-4">
                        <h3 class="text-lg font-medium text-gray-900">Area Coverage (Shortlist Avg)</h3>
                    <div class="chart-placeholder h-64 rounded-lg flex items-center justify-center">
                            <i data-feather="bar-chart" class="w-12 h-12 text-gray-400"></i>
                        </div>
                    </div>

                <!-- Sensitivity Line Chart -->
                <div class="bg-white rounded-lg border border-gray-200 p-4">
                        <h3 class="text-lg font-medium text-gray-900 mb-4">Cutoff Sensitivity</h3>
                    <div class="chart-placeholder h-64 rounded-lg flex items-center justify-center">
                            <i data-feather="trending-up" class="w-12 h-12 text-gray-400"></i>
                        </div>
                    </div>

                <!-- Drop Reasons Table -->
                <div class="bg-white rounded-lg border border-gray-200 p-4">
                        <h3 class="text-lg font-medium text-gray-900 mb-4">Top Drop Reasons</h3>
                    <div class="overflow-x-auto">
                        <table class="min-w-full divide-y divide-gray-200">
                                <thead class="bg-gray-50">
                                    <tr>
                                        <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Weak Area</th>
                                        <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Count</th>
                                        <th class="px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">Avg Coverage</th>
                                    </tr>
                                </thead>
                                <tbody id="drop-reasons-body" class="bg-white divide-y divide-gray-200">
                                    <!-- Dynamic content will be inserted here -->
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>

            <!-- Empty State -->
            <div id="empty-analytics" class="text-center py-12">
                            <i data-feather="pie-chart" class="w-12 h-12 text-gray-400 mx-auto mb-4"></i>
                            <p class="text-gray-500 mb-4">No scoring data available for analytics</p>
                        <div class="flex justify-center space-x-4">
                                <a href="job.html" class="bg-primary hover:bg-fuchsia-600 text-white px-6 py-3 rounded-lg font-medium">
                                    Configure Job Description
                                </a>
                                <a href="resumes.html" class="bg-white border border-gray-300 text-gray-700 px-6 py-3 rounded-lg font-medium hover:bg-gray-50">
                                    Upload Resumes
                                </a>
                            </div>
                        </div>
        </div>
    </div>

    <script>
        feather.replace();
        
        const copyJsonBtn = document.getElementById('copy-json-btn');
        const copyCsvBtn = document.getElementById('copy-csv-btn');
        const dropReasonsBody = document.getElementById('drop-reasons-body');
        const emptyAnalytics = document.getElementById('empty-analytics');

        let analyticsData = null;

        // Load analytics data
        function loadAnalyticsData() {
            const state = JSON.parse(localStorage.getItem('resumerocket_state') || '{}');
            analyticsData = state.result;
            updateAnalyticsDisplay();
        }

        function updateAnalyticsDisplay() {
            if (!analyticsData) {
                emptyAnalytics.classList.remove('hidden');
            } else {
                emptyAnalytics.classList.add('hidden');
                
                // Update drop reasons table
                const dropReasons = [
                    { area: "State Management", count: 3, avgCoverage: 0.45 },
                    { area: "Testing", count: 2, avgCoverage: 0.32 },
                    { area: "Build Tools", count: 1, avgCoverage: 0.18 }
                ];
                
                dropReasonsBody.innerHTML = dropReasons.map(reason => `
                    <tr>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-900">${reason.area}</td>
                    <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${reason.count}</td>
                        <td class="px-6 py-4 whitespace-nowrap text-sm text-gray-500">${(reason.avgCoverage * 100).toFixed(1)}%</td>
                    </tr>
                `).join('');
            }
        }

        // Export functionality
        copyJsonBtn.addEventListener('click', () => {
            if (analyticsData) {
                navigator.clipboard.writeText(JSON.stringify(analyticsData, null, 2);
                alert('JSON data copied to clipboard!');
            } else {
                alert('No scoring data available to copy');
            }
        });

        copyCsvBtn.addEventListener('click', () => {
            if (analyticsData) {
                const csv = analyticsData.ranked.map(c => `${c.name},${c.score},${c.tech},${c.l2r},${c.r2l}`);
            navigator.clipboard.writeText(csv);
                alert('CSV data copied to clipboard!');
            } else {
                alert('No scoring data available to export');
            }
        });

        // Initialize
        loadAnalyticsData();
    </script>
</body>
</html>