Skip to content

Commit

Permalink
fix long decimal issue (#479)
Browse files Browse the repository at this point in the history
Co-authored-by: xieqian <[email protected]>
  • Loading branch information
aidai524 and xieqian authored Feb 27, 2024
1 parent cba0a31 commit 333f0d2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/pages/Orderly/components/OrderBook/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,9 @@ function groupOrdersByPrecision({

export function getDecimalPlaceByNumber(precision: number) {
const str = precision.toString();

if (str.indexOf('e-') > -1) {
return +str.split('e-')[1];
}
if (str.indexOf('.') === -1) return 0;
else return str.split('.')[1].length;
}
Expand Down
4 changes: 3 additions & 1 deletion src/pages/Orderly/components/TableWithTabs/Table.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,9 @@ function Table({
</div>
{/*mobile view*/}
<div className="w-full md:hidden lg:hidden">
{!loading && <div className={'flex justify-end mb-2'}>{mobileHeader}</div>}
{!loading && (
<div className={'flex justify-end mb-2'}>{mobileHeader}</div>
)}
{accountId && validContract() && loading ? (
<div className="w-full relative mt-10 mb-4 px-5 gap-4">
<div className="text-center">
Expand Down
19 changes: 15 additions & 4 deletions src/pages/Orderly/orderly/constantWjsx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ export const usePortableOrderlyTable = ({
pageSize={filteredPaginateData?.records_per_page}
page={filteredPaginateData?.current_page}
/>
)
);

const ordersTableFilterNode = (
<div className={'flex gap-2 items-center px-5 pb-5'}>
Expand Down Expand Up @@ -301,7 +301,7 @@ export const usePortableOrderlyTable = ({
marketList={marketList}
openTrades={openTrades}
>
<div className="" style={{ height: '9px', width: '9px', }}>
<div className="" style={{ height: '9px', width: '9px' }}>
<CircularProgressbar
styles={buildStyles({
pathColor: order?.side === 'BUY' ? '#62C340' : '#FF6A8E',
Expand Down Expand Up @@ -454,7 +454,15 @@ export const usePortableOrderlyTable = ({
marketList={marketList}
openTrades={openTrades}
>
<div style={{ height: '8px', width: '8px', position: 'absolute', right: '2px', top: '2px', }}>
<div
style={{
height: '8px',
width: '8px',
position: 'absolute',
right: '2px',
top: '2px',
}}
>
<CircularProgressbar
styles={buildStyles({
pathColor: order?.side === 'BUY' ? '#62C340' : '#FF6A8E',
Expand Down Expand Up @@ -650,7 +658,10 @@ export const usePortableOrderlyTable = ({
</thead>
<tbody className=" block overflow-auto flex-col px-3">
{rows.map(({ tokenMeta, near, available }: any) => (
<tr className="table-fixed grid grid-cols-6 gap-4 lg:border-t border-white border-opacity-10 text-white" key={tokenMeta?.id}>
<tr
className="table-fixed grid grid-cols-6 gap-4 lg:border-t border-white border-opacity-10 text-white"
key={tokenMeta?.id}
>
<td className="col-span-2 flex py-2 relative">
<div className="flex items-center">
<img
Expand Down

0 comments on commit 333f0d2

Please sign in to comment.