fix: Remove toast notification from PDF download flow
Simplified PDF download UX to use only the modal loading overlay, removing the redundant toast notification that appeared when the modal was closed during download. Updated tests to reflect the new behavior. Changes: - Removed toast trigger logic from PDF modal download function - Removed modal close event listener for toast display - Updated toast notification test expectations - Fixed recommended card outline styling
This commit is contained in:
@@ -105,10 +105,10 @@
|
||||
</div>
|
||||
|
||||
<!-- Default CV Card (Recommended) -->
|
||||
<div class="pdf-option-card pdf-option-recommended"
|
||||
<div class="pdf-option-card pdf-option-recommended selected"
|
||||
data-cv-format="default"
|
||||
role="radio"
|
||||
aria-checked="false"
|
||||
aria-checked="true"
|
||||
aria-label="{{if eq .Lang "es"}}CV Por Defecto - 5 páginas con habilidades (Recomendado){{else}}Default CV - 5 pages with skills (Recommended){{end}}"
|
||||
tabindex="0"
|
||||
_="on click
|
||||
@@ -159,14 +159,14 @@
|
||||
</div>
|
||||
|
||||
<!-- Page count badge with star -->
|
||||
<div class="thumbnail-badge" style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); font-weight: 600;">
|
||||
<div class="thumbnail-badge" style="font-weight: 600;">
|
||||
⭐ {{if eq .Lang "es"}}5 Páginas{{else}}5 Pages{{end}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="pdf-option-info">
|
||||
<h3>
|
||||
{{if eq .Lang "es"}}CV Por Defecto{{else}}Default CV{{end}}
|
||||
{{if eq .Lang "es"}}CV Por Defecto (5 páginas){{else}}Default CV (5 pages){{end}}
|
||||
<span style="color: #667eea; font-size: 0.9em;">⭐</span>
|
||||
</h3>
|
||||
<p style="font-weight: 500;">{{if eq .Lang "es"}}Corto con habilidades - Recomendado{{else}}Short with skills - Recommended{{end}}</p>
|
||||
@@ -249,7 +249,6 @@
|
||||
<div class="pdf-modal-footer">
|
||||
<button class="pdf-download-btn"
|
||||
id="pdf-download-btn"
|
||||
disabled
|
||||
onclick="downloadPDF()">
|
||||
<iconify-icon icon="mdi:download" width="20" height="20"></iconify-icon>
|
||||
{{if eq .Lang "es"}}Descargar PDF{{else}}Download PDF{{end}}
|
||||
@@ -345,53 +344,18 @@
|
||||
: `Generating ${formatName}... This may take ~${estimatedTime} seconds`;
|
||||
estimateEl.textContent = estimateMsg;
|
||||
|
||||
// Track if modal is closed by user during download
|
||||
let modalClosedByUser = false;
|
||||
const onModalClose = () => {
|
||||
modalClosedByUser = true;
|
||||
|
||||
// Show toast when user closes modal
|
||||
if (window.showPDFToast) {
|
||||
window.showPDFToast({
|
||||
icon: '📥',
|
||||
title: isSpanish ? 'Preparando PDF...' : 'Preparing PDF...',
|
||||
message: isSpanish
|
||||
? `Generando ${formatName}... (~${estimatedTime}s)`
|
||||
: `Generating ${formatName}... (~${estimatedTime}s)`,
|
||||
duration: estimatedTime * 1000,
|
||||
autoHide: false // We'll manually update it
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
// Listen for modal close
|
||||
modal.addEventListener('close', onModalClose, { once: true });
|
||||
|
||||
console.log('Navigating to:', url);
|
||||
|
||||
// Trigger download
|
||||
window.location.href = url;
|
||||
|
||||
// After estimated time: update toast to success or close modal
|
||||
// After estimated time: remove loading state and close modal
|
||||
setTimeout(() => {
|
||||
overlay.classList.remove('active');
|
||||
modalContent.classList.remove('loading-active');
|
||||
|
||||
if (modalClosedByUser && window.showPDFToast) {
|
||||
// Update toast to success
|
||||
window.showPDFToast({
|
||||
icon: '✅',
|
||||
title: isSpanish ? '¡PDF Listo!' : 'PDF Ready!',
|
||||
message: isSpanish
|
||||
? 'Revisa tu carpeta de descargas'
|
||||
: 'Check your downloads folder',
|
||||
duration: 3000,
|
||||
autoHide: true
|
||||
});
|
||||
} else {
|
||||
// Close modal if still open
|
||||
modal.close();
|
||||
}
|
||||
// Close modal if still open
|
||||
modal.close();
|
||||
}, estimatedTime * 1000);
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user