Skip to content

Commit 4369e9d

Browse files
committed
Add form styles and tooltips to API key management interface
1 parent 3bb2aec commit 4369e9d

File tree

3 files changed

+95
-15
lines changed

3 files changed

+95
-15
lines changed

public/css/api-keys.css

Lines changed: 66 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,19 @@
33
* API Keys page specific styles
44
*/
55

6+
/* Container */
7+
.container {
8+
max-width: 1200px;
9+
margin: 0 auto;
10+
padding: var(--spacing-lg);
11+
}
12+
613
/* API Keys container */
714
.api-key-container {
815
max-width: 100%;
916
margin-bottom: 30px;
1017
}
1118

12-
/* Page title */
13-
h1 {
14-
font-size: var(--font-size-2xl);
15-
font-weight: var(--font-weight-bold);
16-
color: var(--primary-color);
17-
margin-bottom: var(--spacing-lg);
18-
}
19-
2019
/* Dashboard tabs */
2120
.dashboard-tabs {
2221
display: flex;
@@ -52,6 +51,65 @@ h1 {
5251
margin-bottom: var(--spacing-xl);
5352
}
5453

54+
/* Form styles */
55+
.form-group {
56+
margin-bottom: 20px;
57+
}
58+
59+
.form-help {
60+
margin-top: 5px;
61+
font-size: var(--font-size-sm);
62+
color: var(--text-tertiary);
63+
}
64+
65+
input[type="text"] {
66+
width: 100%;
67+
padding: 12px;
68+
border: 1px solid var(--border-color);
69+
border-radius: var(--border-radius-md);
70+
background-color: var(--input-background);
71+
color: var(--text-primary);
72+
font-size: var(--font-size-md);
73+
transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
74+
}
75+
76+
input[type="text"]:focus {
77+
outline: none;
78+
border-color: var(--primary-color);
79+
box-shadow: 0 0 0 3px rgba(224, 35, 55, 0.1);
80+
}
81+
82+
.btn {
83+
display: inline-block;
84+
padding: 10px 20px;
85+
background-color: var(--primary-color);
86+
color: white;
87+
border: none;
88+
border-radius: var(--border-radius-md);
89+
font-size: var(--font-size-md);
90+
font-weight: var(--font-weight-medium);
91+
cursor: pointer;
92+
transition: background-color var(--transition-fast);
93+
}
94+
95+
.btn:hover {
96+
background-color: var(--primary-dark);
97+
}
98+
99+
.btn:disabled {
100+
opacity: 0.6;
101+
cursor: not-allowed;
102+
}
103+
104+
.btn-primary {
105+
background-color: var(--primary-color);
106+
color: white;
107+
}
108+
109+
.btn-primary:hover {
110+
background-color: var(--primary-dark);
111+
}
112+
55113
/* Login prompt */
56114
.login-prompt {
57115
text-align: center;

public/js/components/api-key-manager.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@ export class ApiKeyManager extends BaseComponent {
3434
h2 {
3535
margin-top: 0;
3636
margin-bottom: 20px;
37+
color: var(--primary-color);
38+
}
39+
40+
h3 {
41+
margin-top: 0;
42+
margin-bottom: 15px;
43+
color: var(--text-primary);
3744
}
3845
3946
.api-key-form {
@@ -48,6 +55,12 @@ export class ApiKeyManager extends BaseComponent {
4855
margin-bottom: 15px;
4956
}
5057
58+
.form-help {
59+
margin-top: 5px;
60+
font-size: var(--font-size-sm);
61+
color: var(--text-tertiary);
62+
}
63+
5164
label {
5265
display: block;
5366
margin-bottom: 5px;
@@ -280,6 +293,7 @@ export class ApiKeyManager extends BaseComponent {
280293
<div class="form-group">
281294
<label for="key-name">API Key Name</label>
282295
<input type="text" id="key-name" placeholder="e.g., Production, Development, Testing" value="${this._newKeyName}">
296+
<p class="form-help">Give your API key a descriptive name to identify its purpose.</p>
283297
</div>
284298
<button id="create-key-button" class="btn btn-primary" ${this._newKeyName.trim() === '' ? 'disabled' : ''}>Create API Key</button>
285299
</div>
@@ -300,6 +314,7 @@ export class ApiKeyManager extends BaseComponent {
300314
return `
301315
<div class="empty-state">
302316
<p>You don't have any API keys yet. Create one to get started.</p>
317+
<p>API keys are used to authenticate your requests to our API endpoints.</p>
303318
<button id="create-empty-key-button" class="btn btn-primary">Create Your First API Key</button>
304319
</div>
305320
`;
@@ -329,10 +344,10 @@ export class ApiKeyManager extends BaseComponent {
329344
<td>${this._formatDate(key.created_at)}</td>
330345
<td>${key.last_used_at ? this._formatDate(key.last_used_at) : 'Never'}</td>
331346
<td class="actions">
332-
<button class="toggle-button ${key.is_active ? 'active' : ''}" data-action="toggle" data-key-id="${key.id}">
347+
<button class="toggle-button ${key.is_active ? 'active' : ''}" data-action="toggle" data-key-id="${key.id}" title="${key.is_active ? 'Deactivate this API key' : 'Activate this API key'}">
333348
${key.is_active ? 'Deactivate' : 'Activate'}
334349
</button>
335-
<button class="delete-button" data-action="delete" data-key-id="${key.id}">Delete</button>
350+
<button class="delete-button" data-action="delete" data-key-id="${key.id}" title="Delete this API key permanently">Delete</button>
336351
</td>
337352
</tr>
338353
`).join('')}

public/views/api-keys.html

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@
2020
<pf-header></pf-header>
2121

2222
<div class="container">
23-
<h1>API Key Management</h1>
24-
2523
<div class="dashboard-tabs">
2624
<button class="tab-button active" data-tab="manage">Manage Keys</button>
2725
<button class="tab-button" data-tab="docs">API Documentation</button>
@@ -78,7 +76,9 @@ <h2>Authentication Required</h2>
7876
// Set up tab switching
7977
const tabButtons = document.querySelectorAll('.tab-button');
8078
tabButtons.forEach(button => {
81-
button.addEventListener('click', () => {
79+
button.onclick = () => {
80+
console.log('Tab button clicked:', button.dataset.tab);
81+
8282
// Remove active class from all buttons
8383
tabButtons.forEach(btn => btn.classList.remove('active'));
8484

@@ -92,8 +92,15 @@ <h2>Authentication Required</h2>
9292

9393
// Show selected tab content
9494
const tabId = button.dataset.tab;
95-
document.getElementById(`${tabId}-tab`).style.display = 'block';
96-
});
95+
const tabContent = document.getElementById(`${tabId}-tab`);
96+
97+
if (tabContent) {
98+
tabContent.style.display = 'block';
99+
console.log('Tab content displayed:', tabId);
100+
} else {
101+
console.error('Tab content not found:', tabId);
102+
}
103+
};
97104
});
98105

99106
// Force refresh of the API key manager component

0 commit comments

Comments
 (0)