docs: City Rooms Routing report
Verified on daarion.space:
- /city lists 27 rooms
- /city/{slug} pages work with host agents
- Matrix room info displayed
- Chat widget integrated
This commit is contained in:
196
docs/debug/city_rooms_routing_report_20251130.md
Normal file
196
docs/debug/city_rooms_routing_report_20251130.md
Normal file
@@ -0,0 +1,196 @@
|
||||
# City Rooms Routing — Звіт про виконання
|
||||
|
||||
**Дата:** 2025-11-30
|
||||
**Статус:** ВИКОНАНО
|
||||
|
||||
## 1. Мета
|
||||
|
||||
Зробити так, щоб кожна City Room була доступною за URL `/city/{slug}` з повним функціоналом: метадані кімнати, host agents, чат-віджет, presence.
|
||||
|
||||
## 2. Виконані роботи
|
||||
|
||||
### 2.1. Backend (City Service) ✅
|
||||
|
||||
**Нові endpoints:**
|
||||
|
||||
```
|
||||
GET /api/v1/city/rooms - список всіх city rooms
|
||||
GET /api/v1/city/rooms/{slug} - деталі кімнати за slug
|
||||
```
|
||||
|
||||
**Приклад відповіді `/api/v1/city/rooms/general`:**
|
||||
|
||||
```json
|
||||
{
|
||||
"id": "room_city_general",
|
||||
"slug": "general",
|
||||
"name": "General",
|
||||
"description": "Main city chat room for all citizens",
|
||||
"scope": "city",
|
||||
"matrix_room_id": "!anDoaSvRxICMHLkeqg:daarion.space",
|
||||
"matrix_room_alias": "#city_general:daarion.space",
|
||||
"is_public": true,
|
||||
"room_role": null,
|
||||
"host_agents": [
|
||||
{
|
||||
"id": "dario",
|
||||
"display_name": "DARIO",
|
||||
"avatar_url": null,
|
||||
"kind": "community",
|
||||
"role": "host"
|
||||
},
|
||||
{
|
||||
"id": "daria",
|
||||
"display_name": "DARIA",
|
||||
"avatar_url": null,
|
||||
"kind": "support",
|
||||
"role": "host"
|
||||
},
|
||||
{
|
||||
"id": "daarwizz",
|
||||
"display_name": "DAARWIZZ",
|
||||
"avatar_url": null,
|
||||
"kind": "governance",
|
||||
"role": "host"
|
||||
}
|
||||
],
|
||||
"chat_available": true
|
||||
}
|
||||
```
|
||||
|
||||
### 2.2. Frontend (Next.js) ✅
|
||||
|
||||
**Зміни:**
|
||||
|
||||
1. **API Client** (`apps/web/src/lib/api.ts`):
|
||||
- Оновлено `getCityRoom(slug)` для запиту окремої кімнати
|
||||
|
||||
2. **Next.js Config** (`apps/web/next.config.ts`):
|
||||
- Додано rewrite для `/api/city/rooms/:slug` → `/api/v1/city/rooms/:slug`
|
||||
|
||||
3. **Room Page** (`apps/web/src/app/city/[slug]/page.tsx`):
|
||||
- Breadcrumb навігація: Home / City / {room.name}
|
||||
- Секція "Агенти кімнати" з host agents
|
||||
- Presence індикатори для агентів
|
||||
- Посилання на кабінети агентів
|
||||
- Інформація про кімнату (тип, slug, роль)
|
||||
- Chat widget інтеграція
|
||||
|
||||
### 2.3. City Rooms List ✅
|
||||
|
||||
**Доступні кімнати (27 штук):**
|
||||
|
||||
| Slug | Тип |
|
||||
|------|-----|
|
||||
| general | City |
|
||||
| welcome | City |
|
||||
| leadership-hall | City |
|
||||
| builders | City |
|
||||
| science-lab | City |
|
||||
| security-bureau | City |
|
||||
| economics-square | City |
|
||||
| announcements | City |
|
||||
| daarion-lobby | MicroDAO |
|
||||
| daarion-news | MicroDAO |
|
||||
| daarion-help | MicroDAO |
|
||||
| soul-lobby | District |
|
||||
| greenfood-lobby | District |
|
||||
| energy-union-lobby | District |
|
||||
| druid-lobby | MicroDAO |
|
||||
| agent-console-daarwizz | Agent |
|
||||
| ... | ... |
|
||||
|
||||
## 3. Перевірка на DAARION.space
|
||||
|
||||
### 3.1. `/city` ✅
|
||||
|
||||
- Список/мапа містить 27 кімнат
|
||||
- Клік по кімнаті → відкриває `/city/{slug}`
|
||||
- Показує кількість онлайн
|
||||
|
||||
### 3.2. `/city/general` ✅
|
||||
|
||||
- Сторінка відкривається
|
||||
- Breadcrumb: Home / City / General
|
||||
- Host Agents: DARIO, DARIA, DAARWIZZ
|
||||
- Кнопка "Увійти щоб почати спілкування"
|
||||
- Matrix Room Info відображається
|
||||
|
||||
### 3.3. Інші кімнати ✅
|
||||
|
||||
- `/city/welcome` - працює
|
||||
- `/city/leadership-hall` - працює
|
||||
- `/city/builders` - працює
|
||||
- `/city/announcements` - працює
|
||||
|
||||
## 4. API Тести
|
||||
|
||||
```bash
|
||||
# Список кімнат
|
||||
curl -s 'http://localhost:7001/api/v1/city/rooms' | jq '.[].slug'
|
||||
|
||||
# Конкретна кімната
|
||||
curl -s 'http://localhost:7001/api/v1/city/rooms/general' | jq '.'
|
||||
```
|
||||
|
||||
## 5. Архітектура
|
||||
|
||||
```
|
||||
Frontend (/city/[slug])
|
||||
↓
|
||||
Next.js Rewrite (/api/city/rooms/:slug)
|
||||
↓
|
||||
City Service (/api/v1/city/rooms/:slug)
|
||||
↓
|
||||
PostgreSQL (city_rooms table)
|
||||
```
|
||||
|
||||
## 6. UI Компоненти
|
||||
|
||||
### Room Page Layout
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────────────────┐
|
||||
│ Home / City / General │
|
||||
├─────────────────────────────────────────────────┤
|
||||
│ General │
|
||||
│ Main city chat room for all citizens │
|
||||
│ ● 5 онлайн [Default Room] │
|
||||
├─────────────────────────────────────────────────┤
|
||||
│ │
|
||||
│ ┌─────────────────────┐ ┌───────────────────┐ │
|
||||
│ │ │ │ Агенти кімнати │ │
|
||||
│ │ Chat Widget │ │ ┌───────────────┐ │ │
|
||||
│ │ │ │ │ 🤖 DARIO │ │ │
|
||||
│ │ [Увійти щоб │ │ │ host │ │ │
|
||||
│ │ почати │ │ └───────────────┘ │ │
|
||||
│ │ спілкування] │ │ ┌───────────────┐ │ │
|
||||
│ │ │ │ │ 🤖 DARIA │ │ │
|
||||
│ │ │ │ │ host │ │ │
|
||||
│ │ │ │ └───────────────┘ │ │
|
||||
│ └─────────────────────┘ │ ┌───────────────┐ │ │
|
||||
│ │ │ 🤖 DAARWIZZ │ │ │
|
||||
│ │ │ host │ │ │
|
||||
│ │ └───────────────┘ │ │
|
||||
│ │ │ │
|
||||
│ │ Інформація │ │
|
||||
│ │ Тип: city │ │
|
||||
│ │ Slug: general │ │
|
||||
│ │ │ │
|
||||
│ │ Учасники онлайн │ │
|
||||
│ │ [U1][U2][U3]... │ │
|
||||
│ └───────────────────┘ │
|
||||
└─────────────────────────────────────────────────┘
|
||||
```
|
||||
|
||||
## 7. Наступні кроки
|
||||
|
||||
- [ ] Додати реальні аватари для host agents
|
||||
- [ ] Інтегрувати Presence API для live статусів агентів
|
||||
- [ ] Додати кількість повідомлень/активність
|
||||
|
||||
---
|
||||
|
||||
**Автор:** Cursor AI
|
||||
**Таск:** `TASK_PHASE_CITY_ROOMS_ROUTING_v1.md`
|
||||
|
||||
Reference in New Issue
Block a user