From a489e614c5a4fdbd79a3d097dcc907d2522140a8 Mon Sep 17 00:00:00 2001 From: admin-valentin Date: Wed, 26 Aug 2026 19:12:26 +0000 Subject: [PATCH] =?UTF-8?q?feat(FE):=20Money=20Raise=20Hub=20=E2=80=94=20t?= =?UTF-8?q?emplate-uri,=20standarde,=20protocoale,=20roadmap-uri,=20legal,?= =?UTF-8?q?=20metrici?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/dashboard/money-raise/page.tsx | 211 +++++++++++++++++++++++++ 1 file changed, 211 insertions(+) create mode 100644 src/app/dashboard/money-raise/page.tsx diff --git a/src/app/dashboard/money-raise/page.tsx b/src/app/dashboard/money-raise/page.tsx new file mode 100644 index 0000000..0352791 --- /dev/null +++ b/src/app/dashboard/money-raise/page.tsx @@ -0,0 +1,211 @@ +'use client'; + +import { useState } from 'react'; +import { useQuery, useMutation } from '@tanstack/react-query'; +import { apiFetch } from '../../../lib/api'; +import { useSession } from '../../../components/session-provider'; + +interface KbEntry { + title: string; category: string; subcategory: string; + region: string; stage: string; content: string; format: string; tags: string; +} + +const CATEGORIES = [ + { key: 'all', label: 'Tot', icon: '🗂️' }, + { key: 'template', label: 'Template-uri', icon: '📋' }, + { key: 'standard', label: 'Standarde', icon: '📜' }, + { key: 'protocol', label: 'Protocoale', icon: '🔄' }, + { key: 'roadmap', label: 'Roadmap-uri', icon: '🗺️' }, + { key: 'investor', label: 'Investitori', icon: '🏦' }, + { key: 'legal', label: 'Legal', icon: '⚖️' }, + { key: 'metric', label: 'Metrici', icon: '📊' }, +]; + +const STAGES = ['all','pre_seed','seed','series_a','series_b','growth']; +const REGIONS = ['all','global','eu','dach','uk','us','ro']; + +export default function MoneyRaisePage() { + const { activeTenant } = useSession(); + const tenantId = activeTenant?.tenantId ?? ''; + const [cat, setCat] = useState('all'); + const [stage, setStage] = useState('all'); + const [region, setRegion] = useState('all'); + const [search, setSearch] = useState(''); + const [selected, setSelected] = useState(null); + const [aiQ, setAiQ] = useState(''); + const [aiReply, setAiReply] = useState(''); + + // Query money_raise knowledge base via IntelligenceService + const kbQuery = useMutation({ + mutationFn: (params: { queryKey: string; params: Record }) => + apiFetch<{ data: KbEntry[]; rows: number; error?: string }>('/v1/intelligence/query', { + tenantId, method: 'POST', body: params, + }), + }); + + // AI Ask about fundraising + const aiAsk = useMutation({ + mutationFn: (question: string) => + apiFetch<{ reply: string }>('/v1/ai/ask', { + tenantId, method: 'POST', + body: { + messages: [{ role: 'user', content: question }], + context: JSON.stringify({ context: 'money_raise_hub', tenantId }), + }, + }), + onSuccess: (d) => setAiReply(d.reply), + }); + + // Load entries on first render + const { data: allEntries = [], isLoading } = useQuery({ + queryKey: ['mr-kb', tenantId], + queryFn: () => apiFetch<{ data: KbEntry[] }>('/v1/intelligence/query', { + tenantId, method: 'POST', + body: { queryKey: 'money_raise_all' }, + }).then(r => r.data ?? []), + enabled: Boolean(tenantId), + staleTime: 300_000, + }); + + const filtered = allEntries.filter(e => { + if (cat !== 'all' && e.category !== cat) return false; + if (stage !== 'all' && e.stage !== stage && e.stage !== 'all') return false; + if (region !== 'all' && e.region !== region && e.region !== 'global') return false; + if (search && !e.title.toLowerCase().includes(search.toLowerCase()) && + !e.content.toLowerCase().includes(search.toLowerCase())) return false; + return true; + }); + + function stageLabel(s: string) { + return s.replace('_', ' ').replace(/\b\w/g, c => c.toUpperCase()); + } + + return ( +
+
+
+

Money Raise Hub

+

+ Template-uri · Standarde · Protocoale · Roadmap-uri · Legal · Global +

+
+
+

{allEntries.length}

+

resurse indexate

+
+
+ + {/* AI Assistant */} +
+

✦ Întreabă AI-ul despre fundraising

+
+ setAiQ(e.target.value)} + onKeyDown={e => e.key === 'Enter' && aiQ.trim() && aiAsk.mutate(aiQ)} + placeholder="ex: Cum negociez lichidation preference? Ce documente trebuie pentru Series A?" + className="flex-1 rounded-lg border bg-background px-3 py-2 text-sm text-ink focus:outline-none focus:ring-2 focus:ring-ring" /> + +
+ {aiReply && ( +
+

{aiReply}

+ +
+ )} +
+ + {/* Setup notice if no data */} + {allEntries.length === 0 && !isLoading && ( +
+

ClickHouse: money_raise.knowledge_base nu există încă

+

Rulează pe supersrv:

+ + cd ~/; git clone [forgejo]/ceo-api && bash ceo-api/money-raise/ingest.sh + +

+ Apoi adaugă în IntelligenceService query-ul money_raise_all. +

+
+ )} + + {/* Filters */} +
+
+ {CATEGORIES.map(c => ( + + ))} +
+
+ {STAGES.map(s => ( + + ))} + {REGIONS.map(r => ( + + ))} +
+ setSearch(e.target.value)} + placeholder="Caută în titlu sau conținut…" + className="w-full rounded-lg border bg-background px-3 py-2 text-sm text-ink focus:outline-none focus:ring-2 focus:ring-ring" /> +
+ +
+ {/* List */} +
+ {isLoading ? ( +

Se încarcă…

+ ) : filtered.length === 0 ? ( +

Niciun rezultat.

+ ) : filtered.map((e, i) => ( + + ))} +
+ + {/* Detail */} + {selected && ( +
+
+

{selected.title}

+ +
+
+ {selected.category} + {selected.subcategory} + {selected.region} + {stageLabel(selected.stage)} +
+
+ {selected.content} +
+
+ )} +
+
+ ); +}