From 37787895d56888ab44362252f21fb05c05e97250 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Sun, 27 Apr 2025 22:44:20 -0600 Subject: reorganize --- client/src/BidsPage.jsx | 182 ------------------------------------------------ 1 file changed, 182 deletions(-) delete mode 100644 client/src/BidsPage.jsx (limited to 'client/src/BidsPage.jsx') diff --git a/client/src/BidsPage.jsx b/client/src/BidsPage.jsx deleted file mode 100644 index e0c4128..0000000 --- a/client/src/BidsPage.jsx +++ /dev/null @@ -1,182 +0,0 @@ -import React, { useEffect, useState } from 'react'; -import { Table, Typography, Spin, Message, Card, Empty, Badge } from '@arco-design/web-react'; -import { IconArrowRise, IconArrowFall } from '@arco-design/web-react/icon'; -import '@arco-design/web-react/dist/css/arco.css'; -import API_BASE_URL from './config'; - -const columns = (bids) => [ - { - title: 'Timestamp', - dataIndex: 'timestamp', - sorter: (a, b) => new Date(a.timestamp) - new Date(b.timestamp), - render: (val) => new Date(val).toLocaleString(), - width: 180, - }, - { - title: 'Quantity (MW)', - dataIndex: 'quantity', - sorter: (a, b) => a.quantity - b.quantity, - render: (val) => val.toFixed(2), - width: 180, - }, - { - title: 'Price ($/MWh)', - dataIndex: 'price', - sorter: (a, b) => a.price - b.price, - render: (val) => `$${val.toFixed(2)}`, - width: 180, - }, - { - title: 'Status', - dataIndex: 'status', - sorter: (a, b) => a.status.localeCompare(b.status), - filters: [ - { text: 'Submitted', value: 'Submitted' }, - { text: 'Success', value: 'Success' }, - { text: 'Fail', value: 'Fail' }, - ], - onFilter: (value, record) => record.status === value, - render: (val) => ( - - ), - width: 180, - }, - { - title: 'PnL', - dataIndex: 'pnl', - sorter: (a, b) => (a.pnl || 0) - (b.pnl || 0), - render: (val) => { - if (val === null) return 'N/A'; - const isProfit = val >= 0; - const color = isProfit ? 'green' : 'red'; - return ( - - {isProfit ? : } - {val.toFixed(2)} - - ); - }, - width: 180, - }, - { - title: 'Market', - dataIndex: 'market', - sorter: (a, b) => a.market.localeCompare(b.market), - filters: [ - { text: 'ISONE', value: 'ISONE' }, - { text: 'NYISO', value: 'NYISO' }, - { text: 'MISO', value: 'MISO' }, - ], - onFilter: (value, record) => record.market === value, - render: (val) => val, - width: 180, - }, -]; - -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 ? ( -
- -
- ) : bids.length === 0 ? ( -
- -
- ) : ( -
- 'table-row-hover'} - /> - - )} - - - - - ); -} - -export default BidsPage; -- cgit v1.2.3