Files
cv-site/test-inline-loading.html
T

230 lines
6.9 KiB
HTML
Raw Normal View History

2025-11-16 10:11:58 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Inline Loading - No Blocking Overlay</title>
<script src="https://unpkg.com/htmx.org@1.9.10"></script>
<style>
body {
font-family: system-ui, -apple-system, sans-serif;
max-width: 1200px;
margin: 0 auto;
padding: 2rem;
background: #f5f5f5;
}
h1 {
color: #333;
}
.test-section {
background: white;
border-radius: 8px;
padding: 2rem;
margin: 2rem 0;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.language-buttons {
display: flex;
gap: 1rem;
margin: 1rem 0;
}
button {
padding: 0.5rem 1rem;
background: #3b82f6;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 1rem;
}
button:hover {
background: #2563eb;
}
button.active {
background: #059669;
}
.indicator {
display: inline-block;
width: 16px;
height: 16px;
margin-left: 0.5rem;
vertical-align: middle;
}
.htmx-indicator {
opacity: 0;
transition: opacity 200ms ease-in;
}
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator {
opacity: 1;
}
/* INLINE LOADING STATES - NO BLOCKING OVERLAY */
.cv-page-content-wrapper {
position: relative;
transition: opacity 200ms ease-in-out,
transform 200ms ease-in-out,
filter 200ms ease-in-out;
}
.cv-page-content-wrapper.htmx-swapping {
opacity: 0.5;
transform: scale(0.99);
pointer-events: none;
filter: blur(1px);
}
.cv-page-content-wrapper.htmx-settling {
opacity: 1;
transform: scale(1);
pointer-events: auto;
filter: blur(0);
}
.content-area {
background: #f9fafb;
border: 2px solid #e5e7eb;
border-radius: 4px;
padding: 2rem;
min-height: 300px;
}
.status {
position: fixed;
top: 1rem;
right: 1rem;
background: #059669;
color: white;
padding: 1rem;
border-radius: 4px;
font-weight: bold;
}
.status.error {
background: #dc2626;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
.spinning {
animation: spin 1s linear infinite;
}
.test-info {
background: #dbeafe;
border-left: 4px solid #3b82f6;
padding: 1rem;
margin: 1rem 0;
}
.test-info h3 {
margin-top: 0;
color: #1e40af;
}
.checklist {
list-style: none;
padding-left: 0;
}
.checklist li:before {
content: "✓ ";
color: #059669;
font-weight: bold;
margin-right: 0.5rem;
}
</style>
</head>
<body>
<div class="status">✓ No Blocking Overlay</div>
<h1>Inline Loading States Test</h1>
<div class="test-info">
<h3>What to Observe:</h3>
<ul class="checklist">
<li>NO full-page overlay appears when switching languages</li>
<li>Language button shows inline spinner during request</li>
<li>CV content fades/blurs slightly during swap (inline effect)</li>
<li>Everything else remains accessible (no blocking)</li>
<li>Smooth transition without page blocking</li>
</ul>
</div>
<div class="test-section">
<h2>Language Selector (With Inline Indicators)</h2>
<div class="language-buttons">
<button hx-get="http://localhost:1999/switch-language?lang=en"
hx-target="#language-selector"
hx-swap="outerHTML swap:250ms settle:250ms"
hx-indicator="#lang-indicator-en"
class="active">
English
<span id="lang-indicator-en" class="htmx-indicator indicator spinning"></span>
</button>
<button hx-get="http://localhost:1999/switch-language?lang=es"
hx-target="#language-selector"
hx-swap="outerHTML swap:250ms settle:250ms"
hx-indicator="#lang-indicator-es">
Español
<span id="lang-indicator-es" class="htmx-indicator indicator spinning"></span>
</button>
</div>
<div id="language-selector"></div>
</div>
<div class="test-section">
<h2>CV Content (With Inline Loading States)</h2>
<div id="cv-inner-content-page-1" class="cv-page-content-wrapper">
<div class="content-area">
<h3>CV Content Page 1</h3>
<p>This content will fade and blur slightly during language transitions.</p>
<p><strong>Observe:</strong> No blocking overlay appears - just a subtle inline effect!</p>
<p>You can still scroll and interact with other parts of the page during the transition.</p>
</div>
</div>
</div>
<div class="test-section">
<h2>Additional Scrollable Content</h2>
<p>This section demonstrates that the page remains functional during language transitions.</p>
<p>Try scrolling, clicking around, or interacting with other elements while switching languages.</p>
<div style="height: 200px; background: linear-gradient(to bottom, #dbeafe, #bfdbfe); border-radius: 4px; padding: 1rem;">
<p><strong>Key Improvement:</strong></p>
<ul>
<li>✓ Before: Full-page overlay blocked everything</li>
<li>✓ After: Inline loading states, no blocking</li>
<li>✓ Language buttons show inline spinners</li>
<li>✓ Content areas show subtle blur/fade</li>
<li>✓ Rest of UI remains accessible</li>
</ul>
</div>
</div>
<script>
// Monitor HTMX events for debugging
document.body.addEventListener('htmx:beforeRequest', (e) => {
console.log('✓ HTMX Request Starting:', e.detail.target.id);
});
document.body.addEventListener('htmx:afterSwap', (e) => {
console.log('✓ HTMX Swap Complete:', e.detail.target.id);
});
// NO skeleton loader JavaScript needed!
console.log('✓ Test page loaded - NO blocking overlay code present');
</script>
</body>
</html>