Karan6124 commited on
Commit
c21164f
·
1 Parent(s): 37a92a2

fix: prevent news cards without links from redirecting to dashboard home

Browse files

- Update TrendingHub.tsx to set href fallback to undefined instead of '#'
- Add onClick preventDefault wrapper when item.link is missing
- Only apply target='_blank' when a valid link exists

frontend/src/components/TrendingHub.tsx CHANGED
@@ -361,10 +361,11 @@ export default function TrendingHub({ onAddTicker }: TrendingHubProps) {
361
  {news.map((item) => (
362
  <a
363
  key={item.id}
364
- href={item.link || '#'}
365
- target="_blank"
366
  rel="noopener noreferrer"
367
  className="genz-news-card"
 
368
  style={{
369
  padding: '16px',
370
  borderRadius: '12px',
@@ -376,7 +377,7 @@ export default function TrendingHub({ onAddTicker }: TrendingHubProps) {
376
  transition: 'all 0.2s ease',
377
  background: 'rgba(13, 16, 27, 0.5)',
378
  backdropFilter: 'blur(10px)',
379
- cursor: 'pointer',
380
  flexShrink: 0,
381
  textDecoration: 'none',
382
  color: 'inherit'
 
361
  {news.map((item) => (
362
  <a
363
  key={item.id}
364
+ href={item.link || undefined}
365
+ target={item.link ? '_blank' : undefined}
366
  rel="noopener noreferrer"
367
  className="genz-news-card"
368
+ onClick={(e) => { if (!item.link) e.preventDefault(); }}
369
  style={{
370
  padding: '16px',
371
  borderRadius: '12px',
 
377
  transition: 'all 0.2s ease',
378
  background: 'rgba(13, 16, 27, 0.5)',
379
  backdropFilter: 'blur(10px)',
380
+ cursor: item.link ? 'pointer' : 'default',
381
  flexShrink: 0,
382
  textDecoration: 'none',
383
  color: 'inherit'