Skip to content

Commit

Permalink
Fix format and add date header
Browse files Browse the repository at this point in the history
  • Loading branch information
kattylucy committed Jan 14, 2025
1 parent bebd123 commit 0681269
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions centrifuge-app/src/components/Report/Orders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,17 @@ import { convertCSV } from './utils'
const noop = (v: any) => v

const Orders = ({ pool }: { pool: Pool }) => {
const { setCsvData } = useContext(ReportContext)
const { setCsvData, setStartDate } = useContext(ReportContext)
const orders = usePoolOrdersByPoolId(pool.id)

useEffect(() => {
if (!orders?.length) return
const dateStrings = orders?.map((order) => order.closedAt).filter(Boolean)
const oldestTimestamp = Math.min(...dateStrings.map((date) => new Date(date).getTime()))
const oldestDate = new Date(oldestTimestamp).toISOString().split('T')[0]
setStartDate(oldestDate)
}, [])

Check warning on line 25 in centrifuge-app/src/components/Report/Orders.tsx

View workflow job for this annotation

GitHub Actions / build-app

React Hook useEffect has missing dependencies: 'orders' and 'setStartDate'. Either include them or remove the dependency array

Check warning on line 25 in centrifuge-app/src/components/Report/Orders.tsx

View workflow job for this annotation

GitHub Actions / ff-prod / build-app

React Hook useEffect has missing dependencies: 'orders' and 'setStartDate'. Either include them or remove the dependency array

const columnsConfig = [
{
align: 'left',
Expand All @@ -34,13 +42,13 @@ const Orders = ({ pool }: { pool: Pool }) => {
align: 'left',
header: 'NAV',
sortable: true,
formatter: (v: any) => (v ? formatBalance(v) : '-'),
formatter: (v: any) => (v ? formatBalance(v, pool.currency.symbol) : '-'),
},
{
align: 'left',
header: 'Nav per share',
sortable: true,
formatter: (v: any) => (v ? formatBalance(v, undefined, 5, 5) : '-'),
formatter: (v: any) => (v ? formatBalance(v, pool.currency.symbol, 6, 6) : '-'),
},
{
align: 'left',
Expand Down

0 comments on commit 0681269

Please sign in to comment.