mirror of
https://github.com/hanzoai/shadcn.git
synced 2026-11-03 03:18:52 +00:00
- Fix gray/zinc alias confusion (gray→neutral, zinc→zen) - Consolidate duplicate gray color definition - Add finance components to ui/ directory - Clean up documentation structure - Remove test artifacts and backup files The color aliases were incorrectly mapped: Before: gray→zen, zinc→neutral (wrong) After: gray→neutral, zinc→zen (correct) This ensures Hanzo's branded 'zen' color properly maps to zinc while gray correctly references the standard neutral palette. Verified: - Production build: 544 pages ✓ - All tests passing: 219/219 ✓ - Visual verification: /colors page working ✓ - Code review: Approved ✓ Ready for deployment to ui.hanzo.ai
56 lines
1.5 KiB
TypeScript
56 lines
1.5 KiB
TypeScript
"use client"
|
|
|
|
import { memo, useEffect, useRef } from "react"
|
|
|
|
function NewsTimeline() {
|
|
const container = useRef<HTMLDivElement>(null)
|
|
|
|
useEffect(() => {
|
|
if (!container.current) return
|
|
|
|
// Check if widget is already initialized using data attribute
|
|
if (container.current.dataset.initialized === "true") {
|
|
return // Widget already initialized, skip
|
|
}
|
|
|
|
// Mark as initialized before adding script
|
|
container.current.dataset.initialized = "true"
|
|
|
|
const script = document.createElement("script")
|
|
script.src =
|
|
"https://s3.tradingview.com/external-embedding/embed-widget-timeline.js"
|
|
script.type = "text/javascript"
|
|
script.async = true
|
|
script.innerHTML = JSON.stringify({
|
|
displayMode: "regular",
|
|
feedMode: "all_symbols",
|
|
colorTheme: "dark",
|
|
isTransparent: false,
|
|
locale: "en",
|
|
width: "100%",
|
|
height: 550,
|
|
})
|
|
|
|
container.current.appendChild(script)
|
|
|
|
// Cleanup function
|
|
return () => {
|
|
if (container.current) {
|
|
// Remove initialization flag on unmount
|
|
delete container.current.dataset.initialized
|
|
// Remove all scripts
|
|
const scripts = container.current.querySelectorAll("script")
|
|
scripts.forEach((s) => s.remove())
|
|
}
|
|
}
|
|
}, [])
|
|
|
|
return (
|
|
<div className="tradingview-widget-container w-full" ref={container}>
|
|
<div className="tradingview-widget-container__widget"></div>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default memo(NewsTimeline)
|