Karan6124 commited on
Commit
c3f8fed
·
1 Parent(s): 5859ba9

feat: fix financial feed news cards - stop collapsing and add clickable links

Browse files

- TrendingHub: remove glass-panel class (had overflow:hidden) from news cards
- TrendingHub: add flexShrink: 0 to news cards so they don't collapse in scroll container
- TrendingHub: add real URLs to all 6 fallback news items (Bloomberg, Reuters, CoinDesk, CNBC, WSJ, MarketWatch)
- TrendingHub: map link/url/article_url fields from live API news response
- TrendingHub: fix onClick handler to properly open articles in new tab

frontend/src/components/TrendingHub.tsx CHANGED
@@ -27,7 +27,8 @@ export default function TrendingHub({ onAddTicker }: TrendingHubProps) {
27
  summary: 'Fed Chair Jerome Powell indicated inflation is returning to the 2% target path, hinting at upcoming rate adjustments that could fuel market momentum.',
28
  source: 'Bloomberg',
29
  time: '12m ago',
30
- category: 'Macroeconomics'
 
31
  },
32
  {
33
  id: 2,
@@ -35,7 +36,8 @@ export default function TrendingHub({ onAddTicker }: TrendingHubProps) {
35
  summary: 'Top cloud providers continue to place record-breaking chip orders. Financial firms hike price targets as AI hardware revenues reach unprecedented highs.',
36
  source: 'Reuters',
37
  time: '35m ago',
38
- category: 'Technology'
 
39
  },
40
  {
41
  id: 3,
@@ -43,7 +45,8 @@ export default function TrendingHub({ onAddTicker }: TrendingHubProps) {
43
  summary: 'Market intelligence data shows heavy whale wallet accumulation at current support levels, indicating solid long-term investor conviction.',
44
  source: 'CoinDesk',
45
  time: '1h ago',
46
- category: 'Crypto'
 
47
  },
48
  {
49
  id: 4,
@@ -51,7 +54,26 @@ export default function TrendingHub({ onAddTicker }: TrendingHubProps) {
51
  summary: 'Defensive sector gains support stock index benchmarks as fund managers rebalance portfolios ahead of upcoming consumer price index (CPI) updates.',
52
  source: 'CNBC',
53
  time: '2h ago',
54
- category: 'Markets'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  }
56
  ];
57
 
@@ -69,7 +91,8 @@ export default function TrendingHub({ onAddTicker }: TrendingHubProps) {
69
  summary: item.summary || 'Market updates, corporate developments, and global analyst reporting.',
70
  source: item.source || 'Yahoo Finance',
71
  time: item.time || 'Recent',
72
- category: item.category || 'Markets'
 
73
  }));
74
  setNews(parsed);
75
  return;
@@ -338,8 +361,12 @@ export default function TrendingHub({ onAddTicker }: TrendingHubProps) {
338
  {news.map((item) => (
339
  <div
340
  key={item.id}
341
- className="glass-panel genz-news-card"
342
- onClick={() => item.link && window.open(item.link, '_blank')}
 
 
 
 
343
  style={{
344
  padding: '16px',
345
  borderRadius: '12px',
@@ -347,11 +374,12 @@ export default function TrendingHub({ onAddTicker }: TrendingHubProps) {
347
  flexDirection: 'column',
348
  gap: '8px',
349
  textAlign: 'left',
350
- border: '1px solid var(--border-glass)',
351
  transition: 'all 0.2s ease',
352
  background: 'rgba(13, 16, 27, 0.5)',
353
  backdropFilter: 'blur(10px)',
354
- cursor: item.link ? 'pointer' : 'default'
 
355
  }}
356
  title={item.link ? "Click to read full article" : ""}
357
  >
 
27
  summary: 'Fed Chair Jerome Powell indicated inflation is returning to the 2% target path, hinting at upcoming rate adjustments that could fuel market momentum.',
28
  source: 'Bloomberg',
29
  time: '12m ago',
30
+ category: 'Macroeconomics',
31
+ link: 'https://www.bloomberg.com/markets'
32
  },
33
  {
34
  id: 2,
 
36
  summary: 'Top cloud providers continue to place record-breaking chip orders. Financial firms hike price targets as AI hardware revenues reach unprecedented highs.',
37
  source: 'Reuters',
38
  time: '35m ago',
39
+ category: 'Technology',
40
+ link: 'https://www.reuters.com/technology'
41
  },
42
  {
43
  id: 3,
 
45
  summary: 'Market intelligence data shows heavy whale wallet accumulation at current support levels, indicating solid long-term investor conviction.',
46
  source: 'CoinDesk',
47
  time: '1h ago',
48
+ category: 'Crypto',
49
+ link: 'https://www.coindesk.com'
50
  },
51
  {
52
  id: 4,
 
54
  summary: 'Defensive sector gains support stock index benchmarks as fund managers rebalance portfolios ahead of upcoming consumer price index (CPI) updates.',
55
  source: 'CNBC',
56
  time: '2h ago',
57
+ category: 'Markets',
58
+ link: 'https://www.cnbc.com/markets'
59
+ },
60
+ {
61
+ id: 5,
62
+ title: 'Apple Vision Pro Drives New Wave of Spatial Computing Investments',
63
+ summary: 'Institutional investors are increasing exposure to companies developing spatial computing platforms following Apple\'s growing developer ecosystem.',
64
+ source: 'Wall Street Journal',
65
+ time: '3h ago',
66
+ category: 'Technology',
67
+ link: 'https://www.wsj.com/tech'
68
+ },
69
+ {
70
+ id: 6,
71
+ title: 'Tesla Q3 Deliveries Beat Expectations; Stock Surges Pre-Market',
72
+ summary: 'Tesla reported record deliveries surpassing analyst forecasts, signaling strong demand recovery and boosting confidence in the EV market outlook.',
73
+ source: 'MarketWatch',
74
+ time: '5h ago',
75
+ category: 'Stocks',
76
+ link: 'https://www.marketwatch.com'
77
  }
78
  ];
79
 
 
91
  summary: item.summary || 'Market updates, corporate developments, and global analyst reporting.',
92
  source: item.source || 'Yahoo Finance',
93
  time: item.time || 'Recent',
94
+ category: item.category || 'Markets',
95
+ link: item.link || item.url || item.article_url || null
96
  }));
97
  setNews(parsed);
98
  return;
 
361
  {news.map((item) => (
362
  <div
363
  key={item.id}
364
+ className="genz-news-card"
365
+ onClick={() => {
366
+ if (item.link) {
367
+ window.open(item.link, '_blank', 'noopener,noreferrer');
368
+ }
369
+ }}
370
  style={{
371
  padding: '16px',
372
  borderRadius: '12px',
 
374
  flexDirection: 'column',
375
  gap: '8px',
376
  textAlign: 'left',
377
+ border: '1px solid rgba(255,255,255,0.07)',
378
  transition: 'all 0.2s ease',
379
  background: 'rgba(13, 16, 27, 0.5)',
380
  backdropFilter: 'blur(10px)',
381
+ cursor: item.link ? 'pointer' : 'default',
382
+ flexShrink: 0
383
  }}
384
  title={item.link ? "Click to read full article" : ""}
385
  >