feat(v13-e): manifeste UX preview centrale (racine) + page /manifeste preserve standalone

This commit is contained in:
Jules Neny
2026-05-11 20:08:20 +02:00
parent 8e7125b426
commit b4f6d63f33
6 changed files with 292 additions and 56 deletions

View File

@@ -168,7 +168,9 @@ import PreviewArticle from '../vue/PreviewArticle.vue';
}
};
window.addEventListener('journal-item-click', () => {
// V1.2-P : ouverture preview article via journal-item-click
// V1.3-E : ouverture preview unifiee via preview-open (article OU manifeste)
const openPreview = () => {
applyPreviewState(true);
// Scroll vers la preview apres mount
requestAnimationFrame(() => {
@@ -178,7 +180,9 @@ import PreviewArticle from '../vue/PreviewArticle.vue';
grid.scrollTo({ top: Math.max(0, previewTop - 8), behavior: 'smooth' });
}
});
});
};
window.addEventListener('journal-item-click', openPreview);
window.addEventListener('preview-open', openPreview);
window.addEventListener('preview-close', () => {
applyPreviewState(false);
});

View File

@@ -96,9 +96,10 @@ const categories = [
</button>
</div>
<!-- Bouton Manifeste -->
<!-- Bouton Manifeste (V1.3-E : sur "/" -> preview centrale, ailleurs -> page complete) -->
<a
href="/manifeste"
data-manifeste-link
class="block mt-3 px-4 py-2 bg-neutral-900 text-white font-bold text-sm text-center rounded-lg hover:bg-neutral-700 transition-colors"
style="font-family:'Courier New',Courier,monospace;"
>
@@ -289,4 +290,17 @@ const categories = [
if (platformFilters['politique']) {
dispatchPlatform(platformFilters['politique']);
}
// V1.3-E : intercept clics liens Manifeste -> preview centrale (uniquement sur racine /)
// Tagger les liens [data-manifeste-link] et router vers event 'preview-open' si on est sur /.
// Sinon : laisser la navigation native vers /manifeste.
document.querySelectorAll<HTMLAnchorElement>('a[data-manifeste-link]').forEach((el) => {
el.addEventListener('click', (e) => {
if (window.location.pathname === '/') {
e.preventDefault();
window.dispatchEvent(new CustomEvent('preview-open', { detail: { type: 'manifeste' } }));
}
// sinon : navigation normale vers /manifeste (fallback SEO + no-JS)
});
});
</script>

View File

@@ -7,7 +7,7 @@
<!-- ZONE GAUCHE : liens nav -->
<nav class="flex gap-4 text-xs justify-center md:justify-start">
<a href="/manifeste" class="opacity-60 hover:opacity-100 transition-opacity">Manifeste</a>
<a href="/manifeste" data-manifeste-link class="opacity-60 hover:opacity-100 transition-opacity">Manifeste</a>
<a href="/a-propos" class="opacity-60 hover:opacity-100 transition-opacity">A propos</a>
<a href="/mentions-legales" class="opacity-60 hover:opacity-100 transition-opacity">Mentions legales</a>
</nav>
@@ -125,4 +125,16 @@
msg.textContent = 'erreur reseau - reessaie plus tard';
}
});
// V1.3-E : intercept clics liens Manifeste depuis le footer -> preview centrale sur racine.
// Sur /a-propos, /mentions-legales, /manifeste lui-meme : navigation normale.
document.querySelectorAll<HTMLAnchorElement>('a[data-manifeste-link]').forEach((el) => {
el.addEventListener('click', (e) => {
if (window.location.pathname === '/') {
e.preventDefault();
window.dispatchEvent(new CustomEvent('preview-open', { detail: { type: 'manifeste' } }));
}
// sinon : navigation normale vers /manifeste
});
});
</script>