Fix hydration error by handling time display on client-side and add stop-loss/take-profit to trading system

This commit is contained in:
mindesbunister
2025-07-13 01:46:34 +02:00
parent 71f7cd9084
commit 0fa687d1d7
2 changed files with 26 additions and 3 deletions

View File

@@ -15,6 +15,16 @@ interface Trade {
export default function TradingHistory() {
const [trades, setTrades] = useState<Trade[]>([])
const [loading, setLoading] = useState(true)
const [isClient, setIsClient] = useState(false)
useEffect(() => {
setIsClient(true)
}, [])
const formatTime = (dateString: string) => {
if (!isClient) return '--:--:--'
return new Date(dateString).toLocaleTimeString()
}
useEffect(() => {
async function fetchTrades() {
@@ -146,7 +156,7 @@ export default function TradingHistory() {
</span>
</td>
<td className="py-4 px-4 text-right text-xs text-gray-400">
{new Date(trade.executedAt).toLocaleTimeString()}
{formatTime(trade.executedAt)}
</td>
</tr>
))}