webcodelab commited on
Commit
9e1a061
·
verified ·
1 Parent(s): 6b8f5a1

Update app/templates/dashboard.html

Browse files
Files changed (1) hide show
  1. app/templates/dashboard.html +32 -103
app/templates/dashboard.html CHANGED
@@ -3,9 +3,8 @@
3
 
4
  {% block extra_head %}
5
  {#
6
- No extra head elements are strictly needed here if base.html links
7
- to your main CSS (e.g., login.css, which will be expanded with dashboard styles).
8
- If you prefer to keep dashboard-specific CSS separate, you'd link it here:
9
  <link rel="stylesheet" href="{{ url_for('static', filename='css/dashboard.css') }}">
10
  #}
11
  {% endblock %}
@@ -32,11 +31,11 @@
32
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-award"><circle cx="12" cy="8" r="7"></circle><polyline points="8.21 13.89 7 23 12 20 17 23 15.79 13.89"></polyline></svg>
33
  <span>Resume Rankings</span>
34
  </a>
35
- <a href="{{ url_for('auth.try_api') }}" class="nav-item">
36
- <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-upload-cloud"><polyline points="16 16 12 12 8 16"></polyline><line x1="12" y1="12" x2="12" y2="21"></line><path d="M20.39 18.39A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.3"></path><polyline points="16 16 12 12 8 16"></polyline></svg>
37
- <span>Upload Resumes</span>
38
  </a>
39
- <a href="{{ url_for('auth.try_api') }}" class="nav-item">
40
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-settings"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>
41
  <span>Settings</span>
42
  </a>
@@ -88,59 +87,51 @@
88
  </div>
89
  </div>
90
 
91
- <div class="section-card api-key-section">
92
  <h3 class="section-title">Your API Key</h3>
93
- <p class="section-description">Use this key to authenticate your requests to the ResumeRanker API.</p>
94
- <div class="input-group">
95
- <input type="text" class="form-input" id="apiKey" value="{{ user.api_key }}" readonly>
96
- <button class="btn primary-btn copy-btn" type="button" onclick="copyApiKey()">Copy</button>
97
- </div>
98
- <form method="POST" action="{{ url_for('auth.regenerate_api_key') }}" class="api-key-form">
99
- <button class="btn secondary-btn">Regenerate API Key</button>
100
- </form>
101
- <p class="docs-link"><a href="{{ url_for('auth.docs') }}">📘 View API Documentation</a></p>
102
- </div>
103
-
104
- <div class="section-card upload-section">
105
- <h3 class="section-title">Upload Resumes</h3>
106
- <p class="section-description">Drag and drop your resume files here, or click to browse.</p>
107
- <div class="drop-area" id="dropArea">
108
- <input type="file" id="fileInput" multiple accept=".pdf,.doc,.docx" style="display: none;">
109
- <p>Drag & Drop files or <span class="browse-link">Click to browse</span></p>
110
- <ul id="fileList" class="uploaded-files-list"></ul>
111
- </div>
112
- <button class="btn primary-btn upload-now-btn" id="uploadNowBtn" style="display: none;">Upload Now</button>
113
  </div>
114
 
115
- <div class="section-card recent-uploads-section">
116
  <h3 class="section-title">Recent Uploads</h3>
117
  {% if recent_uploads %}
118
- <div class="table-responsive">
119
  <table class="data-table">
120
  <thead>
121
  <tr>
122
  <th>Resume Name</th>
123
  <th>Score</th>
124
- <th>Uploaded Date</th>
125
- <th>Action</th>
126
  </tr>
127
  </thead>
128
  <tbody>
129
- {% for resume in recent_uploads %}
130
  <tr>
131
  <td data-label="Resume Name">{{ resume.name }}</td>
132
  <td data-label="Score">{{ resume.score }}</td>
133
- <td data-label="Uploaded Date">{{ resume.uploaded_date }}</td>
134
- <td data-label="Action"><a href="{{ url_for('auth.view_result', resume_id=resume.id) }}" class="btn small-btn view-btn">View Result</a></td>
135
  </tr>
136
  {% endfor %}
137
  </tbody>
138
  </table>
139
  </div>
 
 
 
140
  {% else %}
141
- <p class="no-data-message">No recent uploads yet. Start by uploading a resume!</p>
142
  {% endif %}
143
  </div>
 
 
 
 
 
 
 
 
 
144
  </div>
145
  </div>
146
  </div>
@@ -179,6 +170,7 @@
179
  };
180
  // Close sidebar if click outside on mobile
181
  mainContentArea.onclick = (event) => {
 
182
  if (sidebar.classList.contains('open') && !sidebar.contains(event.target) && !hamburgerDashboard.contains(event.target)) {
183
  sidebar.classList.remove('open');
184
  mainContentArea.classList.remove('shifted');
@@ -194,71 +186,8 @@
194
  };
195
  });
196
 
197
-
198
- // API Key Copy function
199
- function copyApiKey() {
200
- const input = document.getElementById("apiKey");
201
- input.select();
202
- input.setSelectionRange(0, 99999); // For mobile
203
- document.execCommand("copy");
204
- // Add a more subtle visual feedback like a tooltip or temporary text change
205
- const originalText = document.querySelector('.copy-btn').textContent;
206
- document.querySelector('.copy-btn').textContent = 'Copied!';
207
- setTimeout(() => {
208
- document.querySelector('.copy-btn').textContent = originalText;
209
- }, 1500);
210
- }
211
-
212
- // Drag and Drop / File Upload Logic
213
- const dropArea = document.getElementById('dropArea');
214
- const fileInput = document.getElementById('fileInput');
215
- const fileList = document.getElementById('fileList');
216
- const uploadNowBtn = document.getElementById('uploadNowBtn');
217
- let filesToUpload = [];
218
-
219
- dropArea.addEventListener('click', () => fileInput.click());
220
-
221
- dropArea.addEventListener('dragover', (e) => {
222
- e.preventDefault();
223
- dropArea.classList.add('drag-over');
224
- });
225
-
226
- dropArea.addEventListener('dragleave', () => {
227
- dropArea.classList.remove('drag-over');
228
- });
229
-
230
- dropArea.addEventListener('drop', (e) => {
231
- e.preventDefault();
232
- dropArea.classList.remove('drag-over');
233
- handleFiles(e.dataTransfer.files);
234
- });
235
-
236
- fileInput.addEventListener('change', (e) => {
237
- handleFiles(e.target.files);
238
- });
239
-
240
- function handleFiles(files) {
241
- filesToUpload = [...filesToUpload, ...Array.from(files)];
242
- fileList.innerHTML = ''; // Clear current list before repopulating
243
- filesToUpload.forEach(file => {
244
- const listItem = document.createElement('li');
245
- listItem.textContent = file.name;
246
- fileList.appendChild(listItem);
247
- });
248
- if (filesToUpload.length > 0) {
249
- uploadNowBtn.style.display = 'block';
250
- }
251
- }
252
-
253
- uploadNowBtn.addEventListener('click', () => {
254
- // Here you would implement your actual file upload logic using Fetch API or XMLHttpRequest
255
- console.log('Uploading files:', filesToUpload);
256
- alert('Files are ready to be uploaded! (Implement actual upload via AJAX/Fetch)');
257
- // Example: Clear after simulated upload
258
- filesToUpload = [];
259
- fileList.innerHTML = '';
260
- uploadNowBtn.style.display = 'none';
261
- });
262
-
263
  </script>
264
- {% endblock %}
 
 
3
 
4
  {% block extra_head %}
5
  {#
6
+ Ensure your main dashboard CSS is linked, likely in base.html now.
7
+ If you split it out, link it here:
 
8
  <link rel="stylesheet" href="{{ url_for('static', filename='css/dashboard.css') }}">
9
  #}
10
  {% endblock %}
 
31
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-award"><circle cx="12" cy="8" r="7"></circle><polyline points="8.21 13.89 7 23 12 20 17 23 15.79 13.89"></polyline></svg>
32
  <span>Resume Rankings</span>
33
  </a>
34
+ <a href="{{ url_for('auth.try_api') }}" class="nav-item"> {# Updated link for "Try It Now" #}
35
+ <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-play-circle"><circle cx="12" cy="12" r="10"></circle><polygon points="10 8 16 12 10 16 10 8"></polygon></svg>
36
+ <span>Try It Now</span> {# Updated text for "Try It Now" #}
37
  </a>
38
+ <a href="{{ url_for('auth.try_ap') }}" class="nav-item">
39
  <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-settings"><circle cx="12" cy="12" r="3"></circle><path d="M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z"></path></svg>
40
  <span>Settings</span>
41
  </a>
 
87
  </div>
88
  </div>
89
 
90
+ <div class="section-card api-key-summary">
91
  <h3 class="section-title">Your API Key</h3>
92
+ <p class="section-description">
93
+ API Key: <span class="api-key-display">{{ user.api_key[:8] }}...</span>
94
+ <a href="{{ url_for('auth.api_keys') }}" class="link-small">View Full Key & Manage</a>
95
+ </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  </div>
97
 
98
+ <div class="section-card recent-uploads-summary">
99
  <h3 class="section-title">Recent Uploads</h3>
100
  {% if recent_uploads %}
101
+ <div class="table-responsive-summary">
102
  <table class="data-table">
103
  <thead>
104
  <tr>
105
  <th>Resume Name</th>
106
  <th>Score</th>
 
 
107
  </tr>
108
  </thead>
109
  <tbody>
110
+ {% for resume in recent_uploads[:3] %} {# Show only top 3 recent uploads #}
111
  <tr>
112
  <td data-label="Resume Name">{{ resume.name }}</td>
113
  <td data-label="Score">{{ resume.score }}</td>
 
 
114
  </tr>
115
  {% endfor %}
116
  </tbody>
117
  </table>
118
  </div>
119
+ <p class="section-description text-center">
120
+ <a href="{{ url_for('auth.resume_rankings') }}" class="link-small">View All Rankings</a>
121
+ </p>
122
  {% else %}
123
+ <p class="no-data-message">No recent uploads yet. <a href="{{ url_for('auth.try_api') }}">Try it now!</a></p>
124
  {% endif %}
125
  </div>
126
+
127
+ <div class="section-card try-it-now-summary">
128
+ <h3 class="section-title">Try It Now</h3>
129
+ <p class="section-description">Quickly test the ResumeRanker API with your own data.</p>
130
+ <div class="text-center">
131
+ <a href="{{ url_for('auth.try_api') }}" class="btn primary-btn">Go to API Tester</a>
132
+ </div>
133
+ </div>
134
+
135
  </div>
136
  </div>
137
  </div>
 
170
  };
171
  // Close sidebar if click outside on mobile
172
  mainContentArea.onclick = (event) => {
173
+ // Check if sidebar is open and click is outside sidebar and not on hamburger
174
  if (sidebar.classList.contains('open') && !sidebar.contains(event.target) && !hamburgerDashboard.contains(event.target)) {
175
  sidebar.classList.remove('open');
176
  mainContentArea.classList.remove('shifted');
 
186
  };
187
  });
188
 
189
+ // Remove any previous API Key Copy or Drag and Drop scripts from the main dashboard.html
190
+ // These will now be on their dedicated pages.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  </script>
192
+ {% endblock %}
193
+