From 329b94cbab3d6d3dd4cef30bceed251c77032a9e Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Sun, 27 Apr 2025 20:12:33 -0600 Subject: validate timezones --- client/src/BidsPage.jsx | 85 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 client/src/BidsPage.jsx (limited to 'client') diff --git a/client/src/BidsPage.jsx b/client/src/BidsPage.jsx new file mode 100644 index 0000000..c6392b5 --- /dev/null +++ b/client/src/BidsPage.jsx @@ -0,0 +1,85 @@ +import React, { useEffect, useState } from 'react'; +import { Table, Typography, Spin, Message, Card } from '@arco-design/web-react'; +import '@arco-design/web-react/dist/css/arco.css'; +import API_BASE_URL from './config'; + +const columns = [ + { + title: 'Timestamp', + dataIndex: 'timestamp', + render: (val) => new Date(val).toLocaleString(), + }, + { + title: 'Quantity (MW)', + dataIndex: 'quantity', + render: (val) => val.toFixed(2), + }, + { + title: 'Price ($/MWh)', + dataIndex: 'price', + render: (val) => `$${val.toFixed(2)}`, + }, + { + title: 'Status', + dataIndex: 'status', + render: (val) => { + let color = 'gray'; + if (val === 'Success') color = 'green'; + else if (val === 'Fail') color = 'red'; + else if (val === 'Submitted') color = 'blue'; + return {val}; + } + }, + { + title: 'PnL', + dataIndex: 'pnl', + render: (val) => { + if (val === null) return 'N/A'; + const color = val >= 0 ? 'green' : 'red'; + return {val.toFixed(2)}; + } + } +]; + +function BidsPage() { + const [bids, setBids] = useState([]); + const [loading, setLoading] = useState(true); + + useEffect(() => { + fetch(`${API_BASE_URL}/bids/`) + .then((res) => { + if (!res.ok) throw new Error('Failed to fetch bids'); + return res.json(); + }) + .then((json) => setBids(json)) + .catch((err) => { + console.error(err); + Message.error('Failed to load bids.'); + }) + .finally(() => setLoading(false)); + }, []); + + return ( +
+ Your Submitted Bids + + {loading ? ( + + ) : ( + + )} + + + ); +} + +export default BidsPage; -- cgit v1.2.3