- Create Economist SubmissionTracking package correctly: * mainArticle = full blog post content * coverLetter = 216-word SIR— letter * Links to blog post via blogPostId - Archive 'Letter to The Economist' from blog posts (it's the cover letter) - Fix date display on article cards (use published_at) - Target publication already displaying via blue badge Database changes: - Make blogPostId optional in SubmissionTracking model - Economist package ID: 68fa85ae49d4900e7f2ecd83 - Le Monde package ID: 68fa2abd2e6acd5691932150 Next: Enhanced modal with tabs, validation, export 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
78 lines
2 KiB
JavaScript
78 lines
2 KiB
JavaScript
/**
|
|
* Page Transitions
|
|
* Tractatus Framework - Phase 3: Page Transitions
|
|
*
|
|
* Provides smooth fade transitions between pages for better UX
|
|
*/
|
|
|
|
class PageTransitions {
|
|
constructor() {
|
|
this.transitionDuration = 300; // milliseconds
|
|
this.init();
|
|
}
|
|
|
|
init() {
|
|
// Add fade-in class to body on page load
|
|
document.body.classList.add('page-fade-in');
|
|
|
|
// Attach click handlers to internal links
|
|
this.attachLinkHandlers();
|
|
|
|
console.log('[PageTransitions] Initialized');
|
|
}
|
|
|
|
attachLinkHandlers() {
|
|
// Get all internal links (href starts with / or is relative)
|
|
const links = document.querySelectorAll('a[href^="/"], a[href^="./"], a[href^="../"]');
|
|
|
|
links.forEach(link => {
|
|
// Skip if link has target="_blank" or download attribute
|
|
if (link.getAttribute('target') === '_blank' || link.hasAttribute('download')) {
|
|
return;
|
|
}
|
|
|
|
link.addEventListener('click', (e) => {
|
|
// Allow Ctrl/Cmd+click to open in new tab
|
|
if (e.ctrlKey || e.metaKey || e.shiftKey) {
|
|
return;
|
|
}
|
|
|
|
// Skip if link has hash (same-page navigation)
|
|
const href = link.getAttribute('href');
|
|
if (href && href.startsWith('#')) {
|
|
return;
|
|
}
|
|
|
|
e.preventDefault();
|
|
this.transitionToPage(link.href);
|
|
});
|
|
});
|
|
|
|
console.log(`[PageTransitions] Attached handlers to ${links.length} links`);
|
|
}
|
|
|
|
transitionToPage(url) {
|
|
// Remove fade-in, add fade-out
|
|
document.body.classList.remove('page-fade-in');
|
|
document.body.classList.add('page-fade-out');
|
|
|
|
// Navigate after fade-out completes
|
|
setTimeout(() => {
|
|
window.location.href = url;
|
|
}, this.transitionDuration);
|
|
}
|
|
}
|
|
|
|
// Initialize on DOM ready
|
|
if (document.readyState === 'loading') {
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
new PageTransitions();
|
|
});
|
|
} else {
|
|
new PageTransitions();
|
|
}
|
|
|
|
// Export for module systems
|
|
if (typeof module !== 'undefined' && module.exports) {
|
|
module.exports = PageTransitions;
|
|
}
|