Skip to content

Commit 7cb683c

Browse files
committed
Add tabbed interface for API key management and documentation
1 parent 2b19bd3 commit 7cb683c

File tree

1 file changed

+76
-21
lines changed

1 file changed

+76
-21
lines changed

public/views/api-keys.html

Lines changed: 76 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,33 @@
152152
text-decoration: underline;
153153
}
154154

155+
/* Tab styles */
156+
.dashboard-tabs {
157+
display: flex;
158+
margin-bottom: 20px;
159+
border-bottom: 1px solid #ddd;
160+
}
161+
162+
.tab-button {
163+
padding: 10px 20px;
164+
background: none;
165+
border: none;
166+
cursor: pointer;
167+
font-size: 16px;
168+
border-bottom: 3px solid transparent;
169+
}
170+
171+
.tab-button.active {
172+
border-bottom-color: var(--primary-color);
173+
font-weight: bold;
174+
}
175+
176+
.tab-content {
177+
background-color: var(--background-color);
178+
border-radius: 4px;
179+
padding: 20px;
180+
}
181+
155182
@media (max-width: 768px) {
156183
.header {
157184
flex-direction: column;
@@ -177,27 +204,36 @@
177204

178205
<h1>API Key Management</h1>
179206

180-
<div class="intro-section">
181-
<h2>About API Keys</h2>
182-
<p>API keys are used to authenticate your requests to the Document Generation API. Each key is associated with your account and can be used to access the API endpoints.</p>
183-
184-
<h3>Best Practices</h3>
185-
<ul>
186-
<li>Create separate API keys for different environments (development, staging, production)</li>
187-
<li>Rotate your API keys periodically for enhanced security</li>
188-
<li>Deactivate or delete API keys that are no longer in use</li>
189-
<li>Never share your API keys or commit them to version control</li>
190-
</ul>
191-
192-
<h3>Using Your API Keys</h3>
193-
<p>Include your API key in the request headers using one of the following methods:</p>
194-
<p><code>Authorization: Bearer pfs_your_api_key_here</code></p>
195-
<p>Or for backward compatibility:</p>
196-
<p><code>X-API-Key: your_email@example.com</code></p>
207+
<div class="dashboard-tabs">
208+
<button class="tab-button active" data-tab="manage">Manage Keys</button>
209+
<button class="tab-button" data-tab="docs">API Documentation</button>
197210
</div>
198211

199-
<div id="api-key-container" class="api-key-container">
200-
<api-key-manager></api-key-manager>
212+
<div class="tab-content" id="manage-tab">
213+
<div id="api-key-container" class="api-key-container">
214+
<api-key-manager></api-key-manager>
215+
</div>
216+
</div>
217+
218+
<div class="tab-content" id="docs-tab" style="display: none;">
219+
<div class="intro-section">
220+
<h2>About API Keys</h2>
221+
<p>API keys are used to authenticate your requests to the Document Generation API. Each key is associated with your account and can be used to access the API endpoints.</p>
222+
223+
<h3>Best Practices</h3>
224+
<ul>
225+
<li>Create separate API keys for different environments (development, staging, production)</li>
226+
<li>Rotate your API keys periodically for enhanced security</li>
227+
<li>Deactivate or delete API keys that are no longer in use</li>
228+
<li>Never share your API keys or commit them to version control</li>
229+
</ul>
230+
231+
<h3>Using Your API Keys</h3>
232+
<p>Include your API key in the request headers using one of the following methods:</p>
233+
<p><code>Authorization: Bearer pfs_your_api_key_here</code></p>
234+
<p>Or for backward compatibility:</p>
235+
<p><code>X-API-Key: your_email@example.com</code></p>
236+
</div>
201237
</div>
202238

203239
<div id="login-prompt" class="login-prompt" style="display: none;">
@@ -211,9 +247,7 @@ <h2>Authentication Required</h2>
211247
</footer>
212248

213249
<script>
214-
// No logo switching needed anymore
215250
document.addEventListener('DOMContentLoaded', () => {
216-
217251
// Check if user is logged in
218252
const apiKey = localStorage.getItem('api_key') || new URLSearchParams(window.location.search).get('api_key');
219253

@@ -224,6 +258,27 @@ <h2>Authentication Required</h2>
224258
document.getElementById('api-key-container').style.display = 'block';
225259
document.getElementById('login-prompt').style.display = 'none';
226260
}
261+
262+
// Set up tab switching
263+
const tabButtons = document.querySelectorAll('.tab-button');
264+
tabButtons.forEach(button => {
265+
button.addEventListener('click', () => {
266+
// Remove active class from all buttons
267+
tabButtons.forEach(btn => btn.classList.remove('active'));
268+
269+
// Add active class to clicked button
270+
button.classList.add('active');
271+
272+
// Hide all tab content
273+
document.querySelectorAll('.tab-content').forEach(tab => {
274+
tab.style.display = 'none';
275+
});
276+
277+
// Show selected tab content
278+
const tabId = button.dataset.tab;
279+
document.getElementById(`${tabId}-tab`).style.display = 'block';
280+
});
281+
});
227282
});
228283
</script>
229284
</body>

0 commit comments

Comments
 (0)