From f159b20c87e599ae67b47d6cb43049e3fd1fe54a Mon Sep 17 00:00:00 2001 From: Celes Renata Date: Wed, 29 Apr 2026 17:29:26 +0000 Subject: [PATCH] feat: show document title and link in competitive signals panel Replace raw UUID with a linked document title in both the collapsed row (using the empty space on the right) and the expanded detail view. Uses useDocument hook to fetch the title, falls back to truncated UUID while loading. Clicking the link navigates to the document detail page. --- frontend/src/pages/CompanyDetail.tsx | 142 ++++++++++++++++----------- 1 file changed, 85 insertions(+), 57 deletions(-) diff --git a/frontend/src/pages/CompanyDetail.tsx b/frontend/src/pages/CompanyDetail.tsx index d00059d..70ce5c6 100644 --- a/frontend/src/pages/CompanyDetail.tsx +++ b/frontend/src/pages/CompanyDetail.tsx @@ -1,4 +1,4 @@ -import { useParams, useNavigate } from '@tanstack/react-router'; +import { useParams, useNavigate, Link } from '@tanstack/react-router'; import { useState } from 'react'; import { useCompany, @@ -14,6 +14,7 @@ import { useTrends, useTrendHistory, useMarketPrices, + useDocument, } from '../api/hooks'; import { StatusBadge, ConfidenceBar, LoadingSpinner, Card } from '../components/ui'; import { DataTable, type Column } from '../components/DataTable'; @@ -444,62 +445,7 @@ function CompetitiveSignalsPanel({ signals }: { signals: CompetitiveSignal[] }) ) : (
{signals.map((s) => ( -
-
setExpandedId(expandedId === s.id ? null : s.id)} - > -
- COMPETITIVE - {s.source_ticker} - - - -
-
- - {new Date(s.computed_at).toLocaleDateString()} -
-
- {expandedId === s.id && ( - -
-
-
Source Ticker
-
{s.source_ticker}
-
-
-
Target Ticker
-
{s.target_ticker}
-
-
-
Catalyst Type
-
{s.catalyst_type}
-
-
-
Pattern Confidence
-
-
-
-
Signal Strength
-
-
-
-
Relationship Strength
-
-
-
-
Source Document
-
{s.source_document_id}
-
-
-
Computed At
-
{new Date(s.computed_at).toLocaleString()}
-
-
-
- )} -
+ setExpandedId(expandedId === s.id ? null : s.id)} /> ))}
)} @@ -507,6 +453,88 @@ function CompetitiveSignalsPanel({ signals }: { signals: CompetitiveSignal[] }) ); } +function SignalRow({ signal: s, expanded, onToggle }: { signal: CompetitiveSignal; expanded: boolean; onToggle: () => void }) { + const { data: doc } = useDocument(s.source_document_id); + const docLabel = doc?.title ?? `doc:${s.source_document_id.slice(0, 8)}…`; + + return ( +
+
+
+ COMPETITIVE + {s.source_ticker} + + + +
+
+ e.stopPropagation()} + title={doc?.title ?? s.source_document_id} + > + {docLabel} + + + {new Date(s.computed_at).toLocaleDateString()} +
+
+ {expanded && ( + +
+
+
Source Ticker
+
{s.source_ticker}
+
+
+
Target Ticker
+
{s.target_ticker}
+
+
+
Catalyst Type
+
{s.catalyst_type}
+
+
+
Pattern Confidence
+
+
+
+
Signal Strength
+
+
+
+
Relationship Strength
+
+
+
+
Source Document
+
+ e.stopPropagation()} + > + {docLabel} + +
+
+
+
Computed At
+
{new Date(s.computed_at).toLocaleString()}
+
+
+
+ )} +
+ ); +} + function DecisionsPanel({ decisions }: { decisions: CorporateDecision[] }) { return (