diff --git a/src/components/astro/ColJournal.astro b/src/components/astro/ColJournal.astro index ccbc089..3425e1b 100644 --- a/src/components/astro/ColJournal.astro +++ b/src/components/astro/ColJournal.astro @@ -1,56 +1,101 @@ --- -// ColJournal - colonne gauche : CTA Manifeste + Hashtags accordeon + Journal (PC6) -// 7 hashtags = 7 plateformes (cf delta 15 du PILOTE-PC.md) import JournalList from '../vue/JournalList.vue'; -const hashtags = [ - { tag: '#manifeste', plateforme: 'Blog trans-former.fr', canal: 'ecriture longue' }, - { tag: '#building-public', plateforme: 'LinkedIn', canal: 'journal pro' }, - { tag: '#politique', plateforme: 'Substack', canal: 'pensee AEP' }, - { tag: '#aep-politique', plateforme: 'Insta @aep.politique', canal: 'carrousels manifeste' }, - { tag: '#peinture', plateforme: 'Insta @julesneny', canal: 'art / poesie / Corse' }, - { tag: '#podcast', plateforme: 'Castopod', canal: 'podcast.trans-former.fr' }, - { tag: '#stack', plateforme: 'GitHub', canal: 'open source' }, +const categories = [ + { + id: 'politique', + label: 'Politique', + color: '#1d4ed8', + hashtags: ['#politique', '#aep-politique'], + plateformes: [ + { id: 'instagram', label: '@aep.politique', url: 'https://www.instagram.com/aep.politique/' }, + { id: 'castopod', label: 'Podcast', url: 'https://podcast.trans-former.fr' }, + ], + hasSelector: true, + }, + { + id: 'art', + label: 'Art', + color: '#dc2626', + hashtags: ['#peinture', '#art'], + plateformes: [ + { id: 'instagram', label: '@julesneny', url: 'https://www.instagram.com/julesneny/' }, + ], + hasSelector: false, + }, + { + id: 'outils', + label: 'Outils', + color: '#16a34a', + hashtags: ['#stack', '#building-public'], + plateformes: [ + { id: 'gitea', label: 'Gitea', url: 'https://git.trans-former.fr/jules' }, + ], + hasSelector: false, + }, ]; ---
- - - Lire le manifeste → -
Hashtags - 7 plateformes + 3 categories - +
+ + + + + +
+ +
+ + + + Manifeste - Lire + - +

Journal @@ -63,41 +108,170 @@ const hashtags = [ diff --git a/src/components/vue/JournalList.vue b/src/components/vue/JournalList.vue index 2e3a9f5..f0e342d 100644 --- a/src/components/vue/JournalList.vue +++ b/src/components/vue/JournalList.vue @@ -20,6 +20,7 @@ interface JournalPayload { const items = ref([]) const filters = ref>({}) +const platformFilter = ref(null) const loading = ref(true) const errored = ref(false) const empty = ref(false) @@ -45,9 +46,15 @@ const onFilterChange = (e: Event) => { } } +const onPlatformChange = (e: Event) => { + const ce = e as CustomEvent + platformFilter.value = ce.detail?.platform ?? null +} + onMounted(async () => { loadFilters() window.addEventListener('hashtag-filter-change', onFilterChange as EventListener) + window.addEventListener('platform-filter-change', onPlatformChange as EventListener) try { const res = await fetch(JOURNAL_URL, { cache: 'no-store' }) if (!res.ok) { @@ -67,17 +74,28 @@ onMounted(async () => { onUnmounted(() => { window.removeEventListener('hashtag-filter-change', onFilterChange as EventListener) + window.removeEventListener('platform-filter-change', onPlatformChange as EventListener) }) const visibleItems = computed(() => { - // Tous les filtres faux = aucun affiche ; tous true ou aucune cle = tout afficher const keys = Object.keys(filters.value) - if (keys.length === 0) return items.value - const activeKeys = keys.filter((k) => filters.value[k]) - // Si l'utilisateur a explicitement décoché tous les hashtags, on n'affiche rien - if (activeKeys.length === 0 && keys.some((k) => filters.value[k] === false)) return [] - if (activeKeys.length === 0) return items.value - return items.value.filter((it) => activeKeys.includes(it.hashtag)) + let filtered: JournalItem[] + if (keys.length === 0) { + filtered = items.value + } else { + const activeKeys = keys.filter((k) => filters.value[k]) + if (activeKeys.length === 0 && keys.some((k) => filters.value[k] === false)) { + filtered = [] + } else if (activeKeys.length === 0) { + filtered = items.value + } else { + filtered = items.value.filter((it) => activeKeys.includes(it.hashtag)) + } + } + if (platformFilter.value) { + filtered = filtered.filter((it) => it.platform === platformFilter.value) + } + return filtered }) const formatDate = (iso: string) => {