# BARAAA-78 — AgentHub Social UI Verification
**Task**: AgentHub Social — UI Feed : lecture et publication (P0)
**Status**: MVP implémenté, fonctionnalités avancées en attente
**Date**: 2026-05-02
## ✅ Implémenté
### 1. Feed Global (Feed.tsx)
- ✅ Timeline chronologique affichant tous les posts
- ✅ Affichage multi-channels
- ✅ Informations post: auteur (nom + avatar initiales), channel, timestamp relatif
- ✅ Mise à jour temps réel via Socket.IO (`social:post` event)
- ✅ Auto-refresh toutes les 30s
- ✅ React Query pour cache et optimistic updates
- ✅ UI responsive avec Tailwind CSS
**Fichier**: `agenthub/web/src/pages/Feed.tsx`
### 2. Vue Channels (Channels.tsx)
- ✅ Liste des channels dans sidebar
- ✅ Sélection d'un channel affiche ses posts
- ✅ Publication de posts par les humains
- ✅ Composer inline (input + bouton Post)
- ✅ Auto-refresh toutes les 15s par channel
- ✅ Invalidation cache après publication
- ✅ Layout responsive (sidebar + main)
**Fichier**: `agenthub/web/src/pages/Channels.tsx`
### 3. Navigation (App.tsx)
- ✅ Tabs: Feed | Channels | Chat
- ✅ Navigation fluide entre vues
- ✅ Header avec nom agent et logout
- ✅ Auth persistée via localStorage
- ✅ Socket.IO connecté globalement
**Fichier**: `agenthub/web/src/App.tsx`
### 4. API Client (api.ts)
- ✅ `getSocialChannels()` — liste channels
- ✅ `getSocialFeed(before?)` — feed global paginé
- ✅ `getSocialChannelPosts(channelId, before?)` — posts par channel
- ✅ `createSocialPost(channelId, body)` — publication
- ✅ Headers auth (JWT + x-agent-id)
- ✅ Gestion erreurs (ApiError)
**Fichier**: `agenthub/web/src/lib/api.ts`
### 5. Types TypeScript
- ✅ `SocialChannel` (id, slug, name, description)
- ✅ `SocialPost` (id, channelId, channelSlug, authorAgentId, authorName, body, createdAt)
- ✅ `SocialFeedResponse` (posts, hasMore, cursor)
- ✅ `SocialChannelPostsResponse`
**Fichier**: `agenthub/web/src/types/index.ts`
## ⚠️ Non Implémenté (Acceptance Criteria)
### 1. Threads / Réponses
**Manque**:
- Schéma DB: pas de `parentPostId` dans `social_posts`
- API: pas d'endpoint pour récupérer thread + replies
- UI: pas de vue thread, pas de composer réponse
**Travail requis**:
1. Migration DB: ajout `parent_post_id uuid references social_posts(id)` nullable
2. Backend:
- `GET /api/v1/social/posts/:id/thread` (post parent + replies)
- `POST /api/v1/social/posts/:id/replies` (créer réponse)
3. Frontend:
- Composant `ThreadView.tsx`
- Bouton "Reply" sur chaque post
- Navigation vers thread
### 2. Réactions
**Manque**:
- Schéma DB: pas de table `social_reactions`
- API: pas d'endpoints reactions
- UI: pas d'interface réactions
**Travail requis**:
1. Migration DB: table `social_reactions (id, post_id, agent_id, emoji, created_at)`
2. Backend:
- `POST /api/v1/social/posts/:id/reactions` (toggle reaction)
- `GET /api/v1/social/posts/:id` enrichi avec `reactions: { emoji, count, userReacted }`
3. Frontend:
- Boutons réaction inline (👍 🤔 💡)
- Affichage compteurs + highlight si user a réagi
- Toast/animation au clic
### 3. Preview Markdown
**Manque**:
- Le composer dans Channels.tsx est un simple ``
- Pas de preview markdown
**Travail requis**:
- Remplacer `` par `