3 Commits

Author SHA1 Message Date
Jules Neny
4a29a9592a Merge branch 'feat/v11-dg' into feat/page-cerveau-v1 2026-05-11 15:15:36 +02:00
Jules Neny
79004573f1 feat(v11-dg): mobile header page active + hamburger top-right + poignee carte-o + polish css
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-11 15:14:48 +02:00
Jules Neny
d8d3af28a0 feat(v11-c): carte-o rendering refonte niveau/nature/statut + contextmenu positionne
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-11 15:13:46 +02:00
11 changed files with 348 additions and 250 deletions

View File

@@ -6,9 +6,9 @@ import ChatbotV2 from '../vue/ChatbotV2.vue';
import IframeCarteAEP from './IframeCarteAEP.astro';
import ScrollArticles from './ScrollArticles.astro';
---
<div class="h-full grid grid-rows-2 gap-2 p-2">
<div id="col-centre-grid" class="h-full grid grid-rows-2 gap-2 p-2">
<!-- HAUT 50% : tabs Carte O / Chatbot -->
<section class="border border-neutral-200 rounded flex flex-col overflow-hidden bg-white">
<section id="col-centre-haut" class="border border-neutral-200 rounded flex flex-col overflow-hidden bg-white">
<nav role="tablist" aria-label="Vues centrales" class="flex border-b border-neutral-200 px-1 pt-1">
<button
type="button"
@@ -56,6 +56,16 @@ import ScrollArticles from './ScrollArticles.astro';
</div>
</section>
<!-- Poignee repli zone HAUT - mobile only -->
<button
id="col-centre-poignee"
type="button"
aria-label="Replier ou deployer la Carte O"
class="md:hidden flex items-center justify-center h-6 bg-neutral-100 border-y border-neutral-200 cursor-pointer w-full -mt-2 -mb-2 hover:bg-neutral-200 transition-colors"
>
<span class="block w-8 h-0.5 bg-neutral-400 rounded-full"></span>
</button>
<!-- BAS 50% : iframe carte AEP + scroll articles Substack (PC4) -->
<section class="border border-neutral-200 rounded overflow-y-auto bg-white">
<div class="h-full min-h-[60vh] md:min-h-[400px]">
@@ -66,6 +76,39 @@ import ScrollArticles from './ScrollArticles.astro';
</div>
<script>
// Poignee repli zone HAUT (mobile only, D.3)
const grid = document.getElementById('col-centre-grid');
const haut = document.getElementById('col-centre-haut');
const poignee = document.getElementById('col-centre-poignee');
const applyRepliState = (replie: boolean) => {
if (!grid || !haut) return;
if (replie) {
grid.classList.remove('grid-rows-2');
grid.style.gridTemplateRows = '0fr 1fr';
haut.style.overflow = 'hidden';
haut.style.minHeight = '0';
poignee?.setAttribute('aria-label', 'Deployer la Carte O');
} else {
grid.classList.add('grid-rows-2');
grid.style.gridTemplateRows = '';
haut.style.overflow = '';
haut.style.minHeight = '';
poignee?.setAttribute('aria-label', 'Replier la Carte O');
}
};
// Etat initial depuis sessionStorage
const savedRepli = sessionStorage.getItem('tf-haut-replie');
applyRepliState(savedRepli === 'true');
poignee?.addEventListener('click', () => {
const current = sessionStorage.getItem('tf-haut-replie') === 'true';
const next = !current;
sessionStorage.setItem('tf-haut-replie', String(next));
applyRepliState(next);
});
// Tabs toggle.
const tabs = document.querySelectorAll<HTMLButtonElement>('[data-tab]');
const panels = document.querySelectorAll<HTMLElement>('[data-tab-panel]');

View File

@@ -5,7 +5,7 @@
<button
id="hamburger-trigger"
type="button"
class="fixed top-4 left-4 z-50 p-3 bg-white/95 border border-neutral-200 rounded-lg shadow-md hover:bg-white transition-colors md:top-6 md:left-6"
class="fixed top-4 right-4 z-50 p-3 bg-white/95 border border-neutral-200 rounded-lg shadow-md hover:bg-white transition-colors md:top-6 md:right-6"
aria-label="Ouvrir le menu"
aria-expanded="false"
aria-controls="hamburger-drawer"

View File

@@ -0,0 +1,71 @@
---
// MobileTabBar - indicateur de colonne active sur mobile (V1.1-D.1)
// Ecoute l'event "swipe-position-change" emis par SwipeContainer.vue
// Affiche : Journal | Carte | Insta - colonne active surlignee
---
<nav
id="mobile-tab-bar"
aria-label="Navigation colonnes"
class="fixed top-0 left-0 right-0 z-30 h-11 bg-white border-b border-neutral-200 flex items-stretch justify-around md:hidden"
>
<button
type="button"
data-tab-index="0"
class="mobile-tab flex-1 text-sm px-2 border-b-2 transition-colors"
aria-label="Aller au journal"
>
Journal
</button>
<button
type="button"
data-tab-index="1"
class="mobile-tab flex-1 text-sm px-2 border-b-2 transition-colors"
aria-label="Aller à la carte"
>
Carte
</button>
<button
type="button"
data-tab-index="2"
class="mobile-tab flex-1 text-sm px-2 border-b-2 transition-colors"
aria-label="Aller à Instagram"
>
Insta
</button>
</nav>
<script>
const tabs = document.querySelectorAll<HTMLButtonElement>('.mobile-tab');
function setActive(pos: number) {
tabs.forEach((tab, i) => {
const active = i === pos;
tab.classList.toggle('text-neutral-900', active);
tab.classList.toggle('font-medium', active);
tab.classList.toggle('border-neutral-900', active);
tab.classList.toggle('text-neutral-400', !active);
tab.classList.toggle('border-transparent', !active);
});
}
// Etat initial depuis sessionStorage (cle utilisee par SwipeContainer.vue)
const saved = sessionStorage.getItem('pc-position');
const initial = saved !== null && !Number.isNaN(Number(saved)) ? Number(saved) : 1;
setActive(initial);
// Ecoute les changements de position emis par SwipeContainer.vue
document.addEventListener('swipe-position-change', (e: Event) => {
const detail = (e as CustomEvent<{ pos: number }>).detail;
if (detail && typeof detail.pos === 'number') {
setActive(detail.pos);
}
});
// Les boutons de la tab bar declenchent un scroll via un event custom
tabs.forEach((tab) => {
tab.addEventListener('click', () => {
const idx = Number(tab.dataset.tabIndex);
document.dispatchEvent(new CustomEvent('mobile-tab-scroll', { detail: { pos: idx } }));
});
});
</script>

View File

@@ -10,6 +10,11 @@ interface CarteNode {
id: string
label: string
family: string
niveau?: number
nature?: 'essai' | 'projet'
statut?: 'gestation' | 'edite'
resume?: string | null
radius?: number
intention?: string
slug?: string
theme?: string
@@ -36,7 +41,7 @@ const props = withDefaults(defineProps<{
})
const emit = defineEmits<{
'node-click': [node: CarteNode]
'node-click': [payload: { node: CarteNode; x: number; y: number }]
}>()
// Refs
@@ -59,8 +64,32 @@ let zoomBehavior: d3.ZoomBehavior<SVGSVGElement, unknown> | null = null
const isMobile = computed(() => width.value < 600)
const nodeRadius = computed(() => isMobile.value ? 10 : 14)
function colorFor(family: string): string {
return props.familyColors[family] || '#9ca3af'
function colorFor(d: SimNode): string {
if (d.nature === 'projet') return '#b45309'
if (d.niveau === 0) return '#1d4ed8'
if (d.niveau === 1) return '#2563eb'
if (d.niveau === 2) return '#60a5fa'
return props.familyColors[d.family] || '#9ca3af'
}
function getRadius(d: SimNode): number {
return d.radius ?? nodeRadius.value
}
function strokeFor(d: SimNode): string {
return d.statut === 'edite' ? '#0f172a' : '#94a3b8'
}
function strokeWidthFor(d: SimNode): number {
return d.statut === 'edite' ? 2.5 : 1
}
function labelWeightFor(d: SimNode): string {
return d.statut === 'edite' ? 'bold' : 'normal'
}
function labelColorFor(d: SimNode): string {
return d.statut === 'edite' ? '#0f172a' : '#6b7280'
}
function truncate(str: string, max: number): string {
@@ -136,7 +165,6 @@ function render() {
const simNodes = buildSimNodes()
const simLinks = buildSimLinks(simNodes)
const r = nodeRadius.value
const fontSize = isMobile.value ? 9 : 11
// Liens
@@ -155,49 +183,55 @@ function render() {
.join('g')
.attr('class', 'node')
.style('cursor', 'pointer')
.on('click', (_event, d) => emit('node-click', d))
.on('mouseover', function () {
.on('click', (_event, d) => emit('node-click', { node: d as CarteNode, x: (d as SimNode).x || 0, y: (d as SimNode).y || 0 }))
.on('mouseover', function (_event, d) {
d3.select(this).select('circle')
.transition().duration(120)
.attr('stroke-width', 2.5)
.attr('stroke-width', strokeWidthFor(d) + 1.5)
})
.on('mouseout', function () {
.on('mouseout', function (_event, d) {
d3.select(this).select('circle')
.transition().duration(120)
.attr('stroke-width', 1.5)
.attr('stroke-width', strokeWidthFor(d))
})
// Cercle (couleur famille)
// Cercle
nodeGroups.append('circle')
.attr('r', r)
.attr('fill', d => colorFor(d.family))
.attr('stroke', '#ffffff')
.attr('stroke-width', 1.5)
.attr('r', d => getRadius(d))
.attr('fill', d => colorFor(d))
.attr('stroke', d => strokeFor(d))
.attr('stroke-width', d => strokeWidthFor(d))
// Label
nodeGroups.append('text')
.attr('text-anchor', 'start')
.attr('dominant-baseline', 'central')
.attr('dx', r + 4)
.attr('dx', d => getRadius(d) + 4)
.attr('font-size', fontSize)
.attr('font-family', 'system-ui, sans-serif')
.attr('fill', '#1f2937')
.attr('font-weight', d => labelWeightFor(d))
.attr('fill', d => labelColorFor(d))
.attr('pointer-events', 'none')
.text(d => truncate(d.label, isMobile.value ? 18 : 30))
// Tooltip <title>
nodeGroups.append('title')
.text(d => `${d.label}\n[${d.family}]\n${truncate(d.intention || '', 200)}`)
.text(d => `${d.label}\n[${d.family}]\n${truncate(d.resume || d.intention || '', 200)}`)
// Simulation force
// Simulation force avec charges differenciees par niveau
simulation = d3.forceSimulation<SimNode, SimLink>(simNodes)
.force('link', d3.forceLink<SimNode, SimLink>(simLinks)
.id(d => d.id)
.distance(80)
.strength(0.35))
.force('charge', d3.forceManyBody<SimNode>().strength(-220))
.force('charge', d3.forceManyBody<SimNode>().strength(d => {
if (d.niveau === 0) return -800
if (d.niveau === 1) return -400
if (d.niveau === 2) return -150
return -220
}))
.force('center', d3.forceCenter(width.value / 2, height.value / 2))
.force('collide', d3.forceCollide<SimNode>().radius(r + 6))
.force('collide', d3.forceCollide<SimNode>().radius(d => getRadius(d) + 6))
.alphaDecay(0.03)
.on('tick', tick)

View File

@@ -0,0 +1,119 @@
<script setup lang="ts">
import { computed, onMounted, onUnmounted } from 'vue'
interface CarteNode {
id: string
label: string
family?: string
nature?: 'essai' | 'projet'
statut?: 'gestation' | 'edite'
resume?: string | null
intention?: string
}
const props = defineProps<{
node: CarteNode | null
x: number
y: number
}>()
const emit = defineEmits<{ close: [] }>()
function onKeydown(e: KeyboardEvent) {
if (e.key === 'Escape' && props.node) emit('close')
}
function onClickOutside(e: MouseEvent) {
const el = document.getElementById('carte-o-context-menu')
if (el && !el.contains(e.target as Node)) emit('close')
}
onMounted(() => {
window.addEventListener('keydown', onKeydown)
setTimeout(() => window.addEventListener('click', onClickOutside), 50)
})
onUnmounted(() => {
window.removeEventListener('keydown', onKeydown)
window.removeEventListener('click', onClickOutside)
})
const naturLabel = computed(() => props.node?.nature === 'projet' ? 'Projet archi' : 'Essai politique')
const naturColor = computed(() => props.node?.nature === 'projet' ? '#b45309' : '#1d4ed8')
const texte = computed(() => props.node?.resume || props.node?.intention || 'En cours d\'ecriture.')
</script>
<template>
<div
v-if="node"
id="carte-o-context-menu"
class="context-menu"
:style="{ left: x + 'px', top: y + 'px' }"
role="dialog"
:aria-label="node.label"
>
<button class="close-btn" type="button" @click="emit('close')" aria-label="Fermer">x</button>
<span class="nature-badge" :style="{ backgroundColor: naturColor }">{{ naturLabel }}</span>
<h3 class="title" :style="{ fontWeight: node.statut === 'edite' ? 'bold' : 'normal' }">
{{ node.label }}
</h3>
<p class="resume">{{ texte }}</p>
<p v-if="node.statut === 'edite'" class="edite-badge">publie</p>
</div>
</template>
<style scoped>
.context-menu {
position: absolute;
z-index: 1000;
background: #ffffff;
border: 1px solid #e5e7eb;
border-radius: 8px;
padding: 12px 14px;
width: 220px;
box-shadow: 0 4px 16px rgba(0,0,0,0.12);
font-size: 13px;
}
.close-btn {
position: absolute;
top: 6px;
right: 8px;
background: none;
border: none;
cursor: pointer;
color: #9ca3af;
font-size: 14px;
line-height: 1;
padding: 2px 4px;
}
.close-btn:hover { color: #374151; }
.nature-badge {
display: inline-block;
padding: 2px 7px;
border-radius: 4px;
font-size: 10px;
font-weight: 600;
color: #fff;
letter-spacing: 0.04em;
text-transform: uppercase;
margin-bottom: 6px;
font-family: 'Courier New', Courier, monospace;
}
.title {
font-size: 14px;
color: #1f2937;
margin: 4px 0 6px 0;
line-height: 1.3;
}
.resume {
font-size: 12px;
color: #4b5563;
line-height: 1.5;
margin: 0;
}
.edite-badge {
margin-top: 8px;
font-size: 10px;
color: #059669;
font-family: 'Courier New', Courier, monospace;
font-weight: 600;
}
</style>

View File

@@ -1,215 +0,0 @@
<script setup lang="ts">
// Modal récap intention pour Carte O.
// Click node -> emit('node-click', n) -> selectedNode.value = n -> ce modal s'affiche.
// Esc + click backdrop ferment.
import { onMounted, onUnmounted, watch } from 'vue'
interface CarteNode {
id: string
label: string
family: string
intention?: string
slug?: string
theme?: string
}
const props = defineProps<{
node: CarteNode | null
familyColors?: Record<string, string>
}>()
const emit = defineEmits<{
close: []
}>()
function onKeydown(e: KeyboardEvent) {
if (e.key === 'Escape' && props.node) emit('close')
}
onMounted(() => window.addEventListener('keydown', onKeydown))
onUnmounted(() => window.removeEventListener('keydown', onKeydown))
watch(() => props.node, (n) => {
if (n) {
document.body.style.overflow = 'hidden'
} else {
document.body.style.overflow = ''
}
})
function colorFor(family: string): string {
return props.familyColors?.[family] || '#9ca3af'
}
</script>
<template>
<Teleport to="body">
<Transition name="modal">
<div
v-if="node"
class="modal-backdrop"
role="dialog"
aria-modal="true"
:aria-labelledby="`carte-o-modal-title`"
@click.self="emit('close')"
>
<div class="modal-card">
<button
type="button"
class="close-btn"
aria-label="Fermer"
@click="emit('close')"
>×</button>
<div class="family-badge" :style="{ backgroundColor: colorFor(node.family) }">
{{ node.family }}
</div>
<h2 id="carte-o-modal-title" class="title">
{{ node.label }}
</h2>
<p v-if="node.intention" class="intention">
{{ node.intention }}
</p>
<p v-else class="intention placeholder">
Pas d'intention extraite. Ouvrez la fiche pour le contenu complet.
</p>
<div v-if="node.theme" class="theme">
Thème : <strong>{{ node.theme }}</strong>
</div>
<a
v-if="node.slug"
:href="`/thematiques/${node.slug}`"
class="cta-link"
>
Lire la fiche
</a>
</div>
</div>
</Transition>
</Teleport>
</template>
<style scoped>
.modal-backdrop {
position: fixed;
inset: 0;
z-index: 9999;
background: rgba(0, 0, 0, 0.45);
display: flex;
align-items: center;
justify-content: center;
padding: 1rem;
backdrop-filter: blur(2px);
}
.modal-card {
position: relative;
background: #ffffff;
border-radius: 14px;
max-width: 32rem;
width: 100%;
padding: 1.75rem;
box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.35);
}
.close-btn {
position: absolute;
top: 0.5rem;
right: 0.5rem;
width: 32px;
height: 32px;
border: none;
background: transparent;
font-size: 24px;
line-height: 1;
color: #9ca3af;
cursor: pointer;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.close-btn:hover {
background: #f3f4f6;
color: #374151;
}
.family-badge {
display: inline-block;
padding: 0.2rem 0.6rem;
border-radius: 999px;
font-size: 0.7rem;
font-weight: 600;
letter-spacing: 0.05em;
text-transform: uppercase;
color: #fff;
margin-bottom: 0.65rem;
}
.title {
font-size: 1.4rem;
font-weight: 600;
color: #1f2937;
margin: 0 0 0.85rem 0;
line-height: 1.3;
}
.intention {
color: #4b5563;
line-height: 1.55;
margin: 0 0 1rem 0;
font-size: 0.95rem;
}
.intention.placeholder {
font-style: italic;
color: #9ca3af;
}
.theme {
font-size: 0.85rem;
color: #6b7280;
margin-bottom: 1.25rem;
}
.cta-link {
display: inline-block;
padding: 0.55rem 1.1rem;
background: #1f2937;
color: #fff;
border-radius: 8px;
text-decoration: none;
font-size: 0.9rem;
font-weight: 500;
transition: background 0.15s;
}
.cta-link:hover {
background: #111827;
}
.modal-enter-active,
.modal-leave-active {
transition: opacity 0.2s ease;
}
.modal-enter-active .modal-card,
.modal-leave-active .modal-card {
transition: transform 0.2s ease;
}
.modal-enter-from,
.modal-leave-to {
opacity: 0;
}
.modal-enter-from .modal-card,
.modal-leave-to .modal-card {
transform: scale(0.96);
}
</style>

View File

@@ -1,14 +1,16 @@
<script setup lang="ts">
// Wrapper Carte O : fetch /data/carte-o.json + state modal.
// Vue island Astro hydratée client:visible.
import { ref, onMounted, computed } from 'vue'
import CarteO from './CarteO.vue'
import CarteOModal from './CarteOModal.vue'
import CarteOContextMenu from './CarteOContextMenu.vue'
interface CarteNode {
id: string
label: string
family: string
niveau?: number
nature?: 'essai' | 'projet'
statut?: 'gestation' | 'edite'
resume?: string | null
intention?: string
slug?: string
theme?: string
@@ -39,6 +41,8 @@ const props = withDefaults(defineProps<{
const data = ref<CarteData | null>(null)
const error = ref<string | null>(null)
const selectedNode = ref<CarteNode | null>(null)
const contextX = ref(0)
const contextY = ref(0)
const isMobileScreen = ref(false)
const familyColors = computed(() =>
@@ -51,6 +55,12 @@ const familyColors = computed(() =>
}
)
function onNodeClick(payload: { node: CarteNode; x: number; y: number }) {
selectedNode.value = payload.node
contextX.value = payload.x
contextY.value = payload.y
}
onMounted(async () => {
isMobileScreen.value = window.innerWidth < 768
try {
@@ -62,7 +72,6 @@ onMounted(async () => {
error.value = e?.message || 'Erreur de chargement'
}
// Update mobile flag on resize.
window.addEventListener('resize', () => {
isMobileScreen.value = window.innerWidth < 768
})
@@ -87,13 +96,13 @@ onMounted(async () => {
</svg>
</div>
<p class="msg">
Carte O optimisée desktop. Retournez sur grand écran pour explorer la mindmap interactive.
Carte O optimisee desktop. Retournez sur grand ecran pour explorer la mindmap interactive.
</p>
</div>
<!-- Loading state -->
<div v-else-if="!data && !error" class="state">
<span>Chargement de la Carte O</span>
<span>Chargement de la Carte O...</span>
</div>
<!-- Error state -->
@@ -107,11 +116,12 @@ onMounted(async () => {
:nodes="data.nodes"
:edges="data.edges"
:family-colors="familyColors"
@node-click="selectedNode = $event"
@node-click="onNodeClick"
/>
<CarteOModal
<CarteOContextMenu
:node="selectedNode"
:family-colors="familyColors"
:x="contextX"
:y="contextY"
@close="selectedNode = null"
/>
</template>

View File

@@ -22,12 +22,17 @@ const resetFade = () => {
}, 3000);
};
const emitPositionChange = (pos: number) => {
document.dispatchEvent(new CustomEvent('swipe-position-change', { detail: { pos } }));
};
onMounted(() => {
if (!emblaApi.value) return;
emblaApi.value.on('select', () => {
if (!emblaApi.value) return;
selectedIndex.value = emblaApi.value.selectedScrollSnap();
sessionStorage.setItem('pc-position', String(selectedIndex.value));
emitPositionChange(selectedIndex.value);
resetFade();
});
const saved = sessionStorage.getItem('pc-position');
@@ -35,6 +40,13 @@ onMounted(() => {
const idx = Number(saved);
if (!Number.isNaN(idx)) emblaApi.value.scrollTo(idx, false);
}
// Ecoute les clics de la MobileTabBar
document.addEventListener('mobile-tab-scroll', (e: Event) => {
const detail = (e as CustomEvent<{ pos: number }>).detail;
if (detail && typeof detail.pos === 'number') {
emblaApi.value?.scrollTo(detail.pos);
}
});
resetFade();
});

View File

@@ -9,7 +9,7 @@ interface Props {
const {
title = 'trans-former.fr',
description = 'Page-cerveau : journal, mindmap AEP, Insta',
description = "Architecture d'ecologie politique - journal, carte conceptuelle, manifeste",
} = Astro.props;
---
<!doctype html>

View File

@@ -7,10 +7,12 @@ import ColCentre from '../components/astro/ColCentre.astro';
import ColInsta from '../components/astro/ColInsta.astro';
import SwipeContainer from '../components/vue/SwipeContainer.vue';
import HamburgerMenu from '../components/astro/HamburgerMenu.astro';
import MobileTabBar from '../components/astro/MobileTabBar.astro';
import PopupOnboarding from '../components/astro/PopupOnboarding.astro';
---
<BaseLayout title="trans-former.fr">
<HamburgerMenu />
<MobileTabBar />
<PopupOnboarding />
<!-- Desktop : grid 3 colonnes -->
@@ -20,8 +22,8 @@ import PopupOnboarding from '../components/astro/PopupOnboarding.astro';
<aside class="border-l border-neutral-200 overflow-y-auto"><ColInsta /></aside>
</div>
<!-- Mobile : SwipeContainer Vue island -->
<div class="md:hidden h-screen overflow-hidden">
<!-- Mobile : SwipeContainer Vue island - decale de 44px pour la tabbar -->
<div class="md:hidden overflow-hidden" style="height: calc(100dvh - 44px); margin-top: 44px;">
<SwipeContainer client:load>
<ColJournal slot="left" />
<ColCentre slot="center" />

View File

@@ -1 +1,23 @@
@import "tailwindcss";
/* Typographie monospace - labels editoriaux (V1.1-G.1) */
.font-mono-editorial,
.hashtag-label,
.nature-badge,
.carte-o-label {
font-family: 'Courier New', Courier, monospace;
}
/* Corps de texte pages statiques (V1.1-G.2) */
.prose-page {
font-size: 1.0625rem;
line-height: 1.75;
color: #374151;
max-width: 65ch;
}
.prose-page h1, .prose-page h2, .prose-page h3 {
color: #111827;
font-weight: 600;
line-height: 1.3;
}