From 0a100802f20b2631b93e155d89fe005152c5336e Mon Sep 17 00:00:00 2001 From: Reckless_Satoshi Date: Sun, 2 Oct 2022 13:54:45 -0700 Subject: [PATCH] Add bond size to order book --- api/serializers.py | 1 + frontend/src/components/BookTable.tsx | 23 ++++++++++++++++++++++- frontend/src/models/Order.model.ts | 1 + 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/api/serializers.py b/api/serializers.py index 494f17ab..0f714e2d 100644 --- a/api/serializers.py +++ b/api/serializers.py @@ -54,6 +54,7 @@ class ListOrderSerializer(serializers.ModelSerializer): "maker", "taker", "escrow_duration", + "bond_size" ) diff --git a/frontend/src/components/BookTable.tsx b/frontend/src/components/BookTable.tsx index 206289b2..7fd8bca1 100644 --- a/frontend/src/components/BookTable.tsx +++ b/frontend/src/components/BookTable.tsx @@ -457,6 +457,19 @@ const BookTable = ({ }; }; + const bondObj = function (width: number, hide: boolean) { + return { + hide, + field: 'bond_size', + headerName: t('Bond'), + type: 'number', + width: width * fontSize, + renderCell: (params:any) => { + return
{`${Number(params.row.bond_size)}%`}
; + }, + }; + }; + const columnSpecs = { amount: { priority: 1, @@ -546,8 +559,16 @@ const BookTable = ({ object: typeObj, }, }, - id: { + bond: { priority: 11, + order: 10, + normal: { + width: 4.2, + object: bondObj, + }, + }, + id: { + priority: 12, order: 12, normal: { width: 4.8, diff --git a/frontend/src/models/Order.model.ts b/frontend/src/models/Order.model.ts index e1acff7f..67313f04 100644 --- a/frontend/src/models/Order.model.ts +++ b/frontend/src/models/Order.model.ts @@ -15,6 +15,7 @@ export interface Order { satoshis: number; satoshis_now: number; bondless_taker: boolean; + bond_size: number; maker: number; escrow_duration: number; maker_nick: string;