Frontend polish: loading states, CSS variables, focus indicators, scroll lock
- Add tab refresh loading bar animation for all 4 tab loaders - Add profiles loading guard to prevent concurrent fetches - Centralize theme colors into CSS variables (--text-secondary, --text-muted, --bg-secondary, --success-color, --shadow-color) for both dark/light themes - Replace hardcoded gray values across 10 CSS files with variables - Fix duplicate .btn-sm definition in modal.css - Fix z-index: toast 2001→2500 to safely clear modals at 2000 - Add :focus-visible keyboard navigation indicators for all interactive elements - Add responsive breakpoints for tab bar and header on narrow screens - Prevent background page scroll when command palette is open Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,10 +2,10 @@
|
||||
* Profiles — profile cards, editor, condition builder, process picker.
|
||||
*/
|
||||
|
||||
import { apiKey, _profilesCache, set_profilesCache } from '../core/state.js';
|
||||
import { apiKey, _profilesCache, set_profilesCache, _profilesLoading, set_profilesLoading } from '../core/state.js';
|
||||
import { fetchWithAuth, escapeHtml } from '../core/api.js';
|
||||
import { t } from '../core/i18n.js';
|
||||
import { showToast, showConfirm } from '../core/ui.js';
|
||||
import { showToast, showConfirm, setTabRefreshing } from '../core/ui.js';
|
||||
import { Modal } from '../core/modal.js';
|
||||
import { CardSection } from '../core/card-sections.js';
|
||||
import { updateTabBadge } from './tabs.js';
|
||||
@@ -41,8 +41,11 @@ document.addEventListener('server:profile_state_changed', () => {
|
||||
});
|
||||
|
||||
export async function loadProfiles() {
|
||||
if (_profilesLoading) return;
|
||||
set_profilesLoading(true);
|
||||
const container = document.getElementById('profiles-content');
|
||||
if (!container) return;
|
||||
if (!container) { set_profilesLoading(false); return; }
|
||||
setTabRefreshing('profiles-content', true);
|
||||
|
||||
try {
|
||||
const [profilesResp, targetsResp] = await Promise.all([
|
||||
@@ -67,6 +70,9 @@ export async function loadProfiles() {
|
||||
if (error.isAuth) return;
|
||||
console.error('Failed to load profiles:', error);
|
||||
container.innerHTML = `<p class="error-message">${error.message}</p>`;
|
||||
} finally {
|
||||
set_profilesLoading(false);
|
||||
setTabRefreshing('profiles-content', false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user