Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ui improvements #452

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 32 additions & 6 deletions public/css/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -303,16 +303,37 @@ input[type='number'] {
}

.coin-wrapper {
width: 25%;
width: 8.33%;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
padding: 5px;
margin-bottom: 10px;
flex: 25% auto;
flex: 8.33% auto;
}

@media (max-width: 3300px) {
.coin-wrapper {
width: 16.66%;
flex: 16.66% auto;
}
}

@media (max-width: 1650px) {
.coin-wrapper {
width: 25%;
flex: 25% auto;
}
}

@media (max-width: 1200px) {
@media (max-width: 1100px) {
.coin-wrapper {
width: 33.33%;
flex: 33.33% auto;
}
}

@media (max-width: 825px) {
.coin-wrapper {
width: 50%;
flex: 50% auto;
Expand Down Expand Up @@ -447,11 +468,11 @@ input[type='number'] {
}

.coin-info-label {
width: 65%;
width: auto;
}

.coin-info-value {
width: 35%;
width: auto;
}

.coin-info-column-title .coin-info-label {
Expand Down Expand Up @@ -967,6 +988,11 @@ input[type='number'] {
background-color: #272b38;
border-color: #343a40;
}

.pagination .page-item {
min-width: 2rem;
text-align: center;
}
/**
End: Pagination
*/
*/
36 changes: 14 additions & 22 deletions public/js/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,28 +349,19 @@ class App extends React.Component {
disabled={page === 1 || totalPages === 1}
/>
);
[...Array(3).keys()].forEach(index => {
if (page === 1 && index === 0) {
paginationItems.push(
<Pagination.Item
active
key={`pagination-item-${index}`}
onClick={() => this.setPage(page)}>
{page}
</Pagination.Item>
);
} else {
const pageNum = page === 1 ? page + index : page + index - 1;
paginationItems.push(
<Pagination.Item
active={pageNum === page}
disabled={pageNum > totalPages}
key={`pagination-item-${index}`}
onClick={() => this.setPage(pageNum)}>
{pageNum}
</Pagination.Item>
);
}
const maxButtons = 8;
const buttons = Math.min( maxButtons , ~~totalPages );
[...Array(buttons).keys()].forEach(x => {
const pageNum = Math.min( Math.max( x + 1 , page + x + 1 - Math.ceil( buttons / 2 ) ) , totalPages + x + 1 - buttons );
paginationItems.push(
<Pagination.Item
active={pageNum === page}
disabled={pageNum > totalPages}
key={`pagination-item-${x}`}
onClick={() => this.setPage(pageNum)}>
{pageNum}
</Pagination.Item>
);
});
paginationItems.push(
<Pagination.Next
Expand Down Expand Up @@ -421,6 +412,7 @@ class App extends React.Component {
/>
<OrderStats orderStats={orderStats} />
</div>
<Pagination>{paginationItems}</Pagination>
<div className='coin-wrappers'>{coinWrappers}</div>
<Pagination>{paginationItems}</Pagination>
<div className='app-body-footer-wrapper'>
Expand Down
8 changes: 4 additions & 4 deletions public/js/CoinWrapperAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ class CoinWrapperAction extends React.Component {
);
}

const updatedAt = moment.utc(buy.updatedAt, 'YYYY-MM-DDTHH:mm:ss.SSSSSS');
const currentTime = moment.utc();
const updatedAt = moment.utc(buy.updatedAt, 'YYYY-MM-DDTHH:mm:ss.SSSSSS').local();
const currentTime = moment.utc().local();

return (
<div className='coin-info-sub-wrapper'>
<div className='coin-info-column coin-info-column-title border-bottom-0 mb-0 pb-0'>
<div className='coin-info-label w-40'>
<div className='coin-info-label'>
Action -{' '}
<span className='coin-info-value'>
{updatedAt.format('HH:mm:ss')}
Expand Down Expand Up @@ -121,7 +121,7 @@ class CoinWrapperAction extends React.Component {
)}
</div>

<div className='d-flex flex-column align-items-end w-60'>
<div className='d-flex flex-column align-items-end'>
<HightlightChange className='action-label'>
{label}
</HightlightChange>
Expand Down
27 changes: 27 additions & 0 deletions public/js/CoinWrapperBuySignal.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,34 @@ class CoinWrapperBuySignal extends React.Component {
buy: { currentGridTradeIndex, gridTrade }
} = symbolConfiguration;

let hiddenCount = 0;

const buyGridRows = gridTrade.map((grid, i) => {
const modifiedGridTradeIndex = Math.min( Math.max ( currentGridTradeIndex , 5 ) , gridTrade.length - 5 );

function hiddenRow(i) {
return i >= 3 && ( i <= modifiedGridTradeIndex - 3 || i >= modifiedGridTradeIndex + 4 ) && i < gridTrade.length - 1;
}

const isNextHidden = hiddenRow( i + 1 );
const isHidden = isNextHidden || hiddenRow( i );

if ( isHidden === true ) {
hiddenCount++;

return isNextHidden === true ? ('') : (
<React.Fragment key={'coin-wrapper-buy-grid-row-hidden-' + symbol + '-' + (i - 1)}>
<div className='coin-info-column-grid'>
<div className='coin-info-column coin-info-column-price'>
<div className='coin-info-label text-center'>... {hiddenCount} grid trade{hiddenCount === 1 ? '' : 's'} hidden ...</div>
</div>
</div>
</React.Fragment>
);
} else {
hiddenCount = 0;
}

return (
<React.Fragment key={'coin-wrapper-buy-grid-row-' + symbol + '-' + i}>
<div className='coin-info-column-grid'>
Expand Down
27 changes: 27 additions & 0 deletions public/js/CoinWrapperSellSignal.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,34 @@ class CoinWrapperSellSignal extends React.Component {
sell: { currentGridTradeIndex, gridTrade }
} = symbolConfiguration;

let hiddenCount = 0;

const sellGridRows = gridTrade.map((grid, i) => {
const modifiedGridTradeIndex = Math.min( Math.max ( currentGridTradeIndex , 5 ) , gridTrade.length - 5 );

function hiddenRow(i) {
return i >= 3 && ( i <= modifiedGridTradeIndex - 3 || i >= modifiedGridTradeIndex + 4 ) && i < gridTrade.length - 1;
}

const isNextHidden = hiddenRow( i + 1 );
const isHidden = isNextHidden || hiddenRow( i );

if ( isHidden === true ) {
hiddenCount++;

return isNextHidden === true ? ('') : (
<React.Fragment key={'coin-wrapper-buy-grid-row-hidden-' + symbol + '-' + (i - 1)}>
<div className='coin-info-column-grid'>
<div className='coin-info-column coin-info-column-price'>
<div className='coin-info-label text-center'>... {hiddenCount} grid trade{hiddenCount === 1 ? '' : 's'} hidden ...</div>
</div>
</div>
</React.Fragment>
);
} else {
hiddenCount = 0;
}

return (
<React.Fragment key={'coin-wrapper-sell-grid-row-' + symbol + '-' + i}>
<div className='coin-info-column-grid'>
Expand Down
57 changes: 35 additions & 22 deletions public/js/QuoteAssetGridTradeArchiveIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,13 @@ class QuoteAssetGridTradeArchiveIcon extends React.Component {

const totalPages = Math.ceil(stats.trades / limit);
// If total
paginationItems.push(
<Pagination.First
key='first'
disabled={page === 1 || totalPages === 1}
onClick={() => this.setPage(1)}
/>
);
if (page === 1 || totalPages === 1) {
paginationItems.push(
<Pagination.Prev key='pagination-item-prev' disabled />
Expand All @@ -279,28 +286,19 @@ class QuoteAssetGridTradeArchiveIcon extends React.Component {
/>
);
}
[...Array(3).keys()].forEach(x => {
if (page === 1 && x === 0) {
paginationItems.push(
<Pagination.Item
active
key={`pagination-item-${x}`}
onClick={() => this.setPage(page)}>
{page}
</Pagination.Item>
);
} else {
const pageNum = page === 1 ? page + x : page + x - 1;
paginationItems.push(
<Pagination.Item
active={pageNum === page}
disabled={pageNum > totalPages}
key={`pagination-item-${x}`}
onClick={() => this.setPage(pageNum)}>
{pageNum}
</Pagination.Item>
);
}
const maxButtons = 8;
const buttons = Math.min( maxButtons , ~~totalPages );
[...Array(buttons).keys()].forEach(x => {
const pageNum = Math.min( Math.max( x + 1 , page + x + 1 - Math.ceil( buttons / 2 ) ) , totalPages + x + 1 - buttons );
paginationItems.push(
<Pagination.Item
active={pageNum === page}
disabled={pageNum > totalPages}
key={`pagination-item-${x}`}
onClick={() => this.setPage(pageNum)}>
{pageNum}
</Pagination.Item>
);
});
if (page === totalPages || page >= totalPages) {
paginationItems.push(
Expand All @@ -314,6 +312,14 @@ class QuoteAssetGridTradeArchiveIcon extends React.Component {
/>
);
}
const lastPage = totalPages;
paginationItems.push(
<Pagination.Last
key='last'
disabled={page === totalPages || page >= totalPages}
onClick={() => this.setPage(lastPage)}
/>
);

return (
<div className='coin-info-quote-asset-grid-trade-archive-wrapper d-inline-block'>
Expand Down Expand Up @@ -462,6 +468,13 @@ class QuoteAssetGridTradeArchiveIcon extends React.Component {
) : (
<React.Fragment>
<div className='row'>
<div className='d-flex w-100 flex-row justify-content-between px-3 mb-2'>
<Pagination
className='justify-content-center mb-0'
size='sm'>
{paginationItems}
</Pagination>
</div>
<Table striped bordered hover size='sm' responsive>
<thead>
<tr>
Expand Down
57 changes: 35 additions & 22 deletions public/js/SymbolGridTradeArchiveIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,13 @@ class SymbolGridTradeArchiveIcon extends React.Component {

const totalPages = Math.ceil(stats.trades / limit);
// If total
paginationItems.push(
<Pagination.First
key='first'
disabled={page === 1 || totalPages === 1}
onClick={() => this.setPage(1)}
/>
);
if (page === 1 || totalPages === 1) {
paginationItems.push(
<Pagination.Prev key='pagination-item-prev' disabled />
Expand All @@ -281,28 +288,19 @@ class SymbolGridTradeArchiveIcon extends React.Component {
/>
);
}
[...Array(3).keys()].forEach(x => {
if (page === 1 && x === 0) {
paginationItems.push(
<Pagination.Item
active
key={`pagination-item-${x}`}
onClick={() => this.setPage(page)}>
{page}
</Pagination.Item>
);
} else {
const pageNum = page === 1 ? page + x : page + x - 1;
paginationItems.push(
<Pagination.Item
active={pageNum === page}
disabled={pageNum > totalPages}
key={`pagination-item-${x}`}
onClick={() => this.setPage(pageNum)}>
{pageNum}
</Pagination.Item>
);
}
const maxButtons = 8;
const buttons = Math.min( maxButtons , ~~totalPages );
[...Array(buttons).keys()].forEach(x => {
const pageNum = Math.min( Math.max( x + 1 , page + x + 1 - Math.ceil( buttons / 2 ) ) , totalPages + x + 1 - buttons );
paginationItems.push(
<Pagination.Item
active={pageNum === page}
disabled={pageNum > totalPages}
key={`pagination-item-${x}`}
onClick={() => this.setPage(pageNum)}>
{pageNum}
</Pagination.Item>
);
});
if (page === totalPages || page >= totalPages) {
paginationItems.push(
Expand All @@ -316,6 +314,14 @@ class SymbolGridTradeArchiveIcon extends React.Component {
/>
);
}
const lastPage = totalPages;
paginationItems.push(
<Pagination.Last
key='last'
disabled={page === totalPages || page >= totalPages}
onClick={() => this.setPage(lastPage)}
/>
);

return (
<div className='coin-info-symbol-grid-trade-archive-wrapper'>
Expand Down Expand Up @@ -464,6 +470,13 @@ class SymbolGridTradeArchiveIcon extends React.Component {
) : (
<React.Fragment>
<div className='row'>
<div className='d-flex w-100 flex-row justify-content-between px-3 mb-2'>
<Pagination
className='justify-content-center mb-0'
size='sm'>
{paginationItems}
</Pagination>
</div>
<Table striped bordered hover size='sm' responsive>
<thead>
<tr>
Expand Down
Loading