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

(improvements) Columns width adjustments #805

Merged
merged 32 commits into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d825d44
Merge pull request #799 from bitfinexcom/staging
prdn Apr 3, 2024
d4a4321
Merge pull request #802 from bitfinexcom/staging
prdn Apr 5, 2024
8f66735
Revert "Revert "(improvements) Tables responsiveness""
alexstotsky Apr 5, 2024
f8ab01b
Implement onColumnWidthChanged handler
alexstotsky Apr 5, 2024
a3e90a1
Fix setColumnsWidth action payload handling
alexstotsky Apr 5, 2024
bf78086
Update calculated widths with chnaged values
alexstotsky Apr 7, 2024
48f60d6
Update default widths with calculted ones
alexstotsky Apr 7, 2024
d1e8d15
Adjust min columns width
alexstotsky Apr 7, 2024
909db4a
Lint fix
alexstotsky Apr 8, 2024
0c00466
Improve calculated withs handling, update constants
alexstotsky Apr 8, 2024
ee4baeb
Implement custom width handling flow
alexstotsky Apr 8, 2024
47c3065
Add customCols width getter
alexstotsky Apr 8, 2024
b16a84e
Fix setColumnsWidth action payload providing
alexstotsky Apr 8, 2024
d7067bb
Implement customColsWidths availability check
alexstotsky Apr 8, 2024
26470cd
Add cols width getter default
alexstotsky Apr 8, 2024
24ef9ea
Implement custom cols widths reset flow
alexstotsky Apr 8, 2024
779b2bf
Actualized keys&descriptions
alexstotsky Apr 8, 2024
7dc569b
Update reset to defaults label
alexstotsky Apr 8, 2024
a25695f
Cleanup
alexstotsky Apr 8, 2024
71ded58
Update query constants
alexstotsky Apr 8, 2024
1033afd
Provide summary by asset query type
alexstotsky Apr 8, 2024
83b338c
Actualize columns constants
alexstotsky Apr 8, 2024
de17e4a
Update app summary cols getters
alexstotsky Apr 8, 2024
510e841
Actualize summary by asset cols config
alexstotsky Apr 8, 2024
12bb2f7
Make columns resizing adjustable
alexstotsky Apr 8, 2024
47fbcd9
Prevent resising for small acc summary sections
alexstotsky Apr 8, 2024
e749a27
Show reset cols width only for resizable ones
alexstotsky Apr 8, 2024
631dd15
Actualize wallets tables configs
alexstotsky Apr 8, 2024
b3f1a8f
Improve concentration risk data table configuration
alexstotsky Apr 8, 2024
20f789a
Enhance cilumns widthchnaging flow
alexstotsky Apr 10, 2024
9d9315e
Lint fix
alexstotsky Apr 10, 2024
4f87814
Update reset width option description
alexstotsky Apr 12, 2024
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
1 change: 1 addition & 0 deletions public/locales/en/translations.json
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@
"customerInfo": "Customer Info",
"date": "Date",
"days": "Days",
"defaultWidth": "Reset Column Widths",
"deselectionHint": "Cmd/Ctrl + click to deselect",
"description": "Description",
"destination": "Destination",
Expand Down
1 change: 1 addition & 0 deletions src/components/AccountSummary/AccountSummary.derivFees.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const AccountSummaryDerivFees = ({
<DataTable
numRows={1}
tableColumns={columns}
enableColumnResizing={false}
/>
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const AccountSummaryFeeTierVolume = ({
<DataTable
numRows={1}
tableColumns={columns}
enableColumnResizing={false}
/>
</div>
)
Expand Down
1 change: 1 addition & 0 deletions src/components/AccountSummary/AccountSummary.fees.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ const AccountSummaryFees = ({
<DataTable
numRows={1}
tableColumns={columns}
enableColumnResizing={false}
/>
</div>
)
Expand Down
1 change: 0 additions & 1 deletion src/components/AccountSummary/AccountSummary.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ class AccountSummary extends PureComponent {
/>
</>
)}
<br />
<PaidFees
t={t}
isNoData={isNoData}
Expand Down
14 changes: 11 additions & 3 deletions src/components/AccountSummary/AccountSummary.leo.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,27 @@ const AccountSummaryLeo = ({
<DataTable
numRows={1}
tableColumns={columns}
enableColumnResizing={false}
/>
</div>
)
}

AccountSummaryLeo.propTypes = {
data: PropTypes.shape({
leoLev: PropTypes.number.isRequired,
leoAmountAvg: PropTypes.number.isRequired,
}).isRequired,
leoLev: PropTypes.number,
leoAmountAvg: PropTypes.number,
}),
t: PropTypes.func.isRequired,
isNoData: PropTypes.bool.isRequired,
isLoading: PropTypes.bool.isRequired,
}

AccountSummaryLeo.defaultProps = {
data: PropTypes.shape({
leoLev: 0,
leoAmountAvg: 0,
}),
}

export default memo(AccountSummaryLeo)
1 change: 1 addition & 0 deletions src/components/AccountSummary/AccountSummary.paidFees.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ const AccountSummaryPaidFees = ({
<div>{t(title)}</div>
<DataTable
tableColumns={columns}
enableColumnResizing={false}
numRows={isLoading ? 1 : formattedData.length}
/>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/components/AccountSummary/AccountSummary.volume.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const AccountSummaryVolume = ({
<div>{t('accountsummary.30dVolume')}</div>
<DataTable
tableColumns={columns}
enableColumnResizing={false}
numRows={isLoading ? 1 : data.length}
/>
</div>
Expand Down
21 changes: 16 additions & 5 deletions src/components/AccountSummary/_AccountSummary.scss
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
.section-account-summary {
&-data {
width: 100%;
display: flex;
flex-wrap: wrap;
flex-direction: row;
align-items: flex-end;
justify-content: flex-start;
justify-content: space-between;

&-item {
width: fit-content;
max-width: calc(100vw - 20px);
margin-right: 20px;
width: 49%;
min-width: 400px;
margin-bottom: 35px;

.collapsed-table {
Expand Down Expand Up @@ -49,6 +50,16 @@
}
}

@media screen and (max-width: 1210px) {
.section-account-summary {
&-data {
&-item {
width: 100%;
}
}
}
}

@media screen and (max-width: 768px) {
.section-account-summary {
&-data {
Expand All @@ -63,8 +74,8 @@
&-item {
width: 100%;
margin-right: 0;
min-width: inherit;
}
}
}
}

10 changes: 8 additions & 2 deletions src/components/AppSummary/AppSummary.byAsset.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@ import {
getSummaryByAssetEntries,
} from 'state/summaryByAsset/selectors'
import { getTimezone } from 'state/base/selectors'
import queryConstants from 'state/query/constants'
import { getColumnsWidth } from 'state/columns/selectors'
import { getTimeRange, getTimeFrame } from 'state/timeRange/selectors'
import { getIsSyncRequired, getIsFirstSyncing } from 'state/sync/selectors'

import SummaryFilters from './AppSummary.filters'
import { getAssetColumns } from './AppSummary.columns'
import { prepareSummaryByAssetData } from './AppSummary.helpers'

const TYPE = queryConstants.SUMMARY_BY_ASSET

const AppSummaryByAsset = () => {
const { t } = useTranslation()
const dispatch = useDispatch()
Expand All @@ -37,6 +41,7 @@ const AppSummaryByAsset = () => {
const { start, end } = useSelector(getTimeFrame)
const minimumBalance = useSelector(getMinimumBalance)
const useMinimumBalance = useSelector(getUseMinBalance)
const columnsWidth = useSelector((state) => getColumnsWidth(state, TYPE))
const isLoading = isFirstSync || (!dataReceived && pageLoading)
const isNoData = dataReceived && isEmpty(entries)
const tableClasses = classNames('summary-by-asset-table', {
Expand All @@ -60,9 +65,9 @@ const AppSummaryByAsset = () => {

const columns = useMemo(
() => getAssetColumns({
preparedData, t, isLoading, isNoData,
preparedData, t, isLoading, isNoData, columnsWidth,
}),
[preparedData, t, isLoading, isNoData],
[preparedData, t, isLoading, isNoData, columnsWidth],
)

return (
Expand All @@ -80,6 +85,7 @@ const AppSummaryByAsset = () => {
<SummaryFilters />
</div>
<DataTable
section={TYPE}
defaultRowHeight={73}
tableColumns={columns}
className={tableClasses}
Expand Down
20 changes: 13 additions & 7 deletions src/components/AppSummary/AppSummary.columns.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ import { Cell } from '@blueprintjs/table'

import { fixedFloat } from 'ui/utils'
import LoadingPlaceholder from 'ui/LoadingPlaceholder'
import { getCellLoader, getCellNoData, getTooltipContent } from 'utils/columns'
import {
getCellLoader,
getCellNoData,
getColumnWidth,
getTooltipContent,
} from 'utils/columns'

import {
getIsTotal,
Expand Down Expand Up @@ -99,12 +104,13 @@ export const getAssetColumns = ({
isNoData,
isLoading,
preparedData,
columnsWidth,
}) => [
{
id: 'currency',
className: 'align-left',
name: 'summary.by_asset.currency',
width: 110,
width: getColumnWidth('currency', columnsWidth),
renderer: (rowIndex) => {
if (isLoading) return getCellLoader(22, 80)
if (isNoData) return getCellNoData(t('column.noResults'))
Expand Down Expand Up @@ -137,7 +143,7 @@ export const getAssetColumns = ({
{
id: 'balance',
name: 'summary.by_asset.balance',
width: 178,
width: getColumnWidth('balance', columnsWidth),
renderer: (rowIndex) => {
if (isLoading) return getCellLoader(22, 80)
if (isNoData) return getCellNoData()
Expand Down Expand Up @@ -173,7 +179,7 @@ export const getAssetColumns = ({
{
id: 'balanceChange',
name: 'summary.by_asset.balance_change',
width: 178,
width: getColumnWidth('balanceChange', columnsWidth),
renderer: (rowIndex) => {
if (isLoading) return getCellLoader(22, 80)
if (isNoData) return getCellNoData()
Expand Down Expand Up @@ -213,7 +219,7 @@ export const getAssetColumns = ({
{
id: 'volume',
name: 'summary.by_asset.volume',
width: 178,
width: getColumnWidth('volume', columnsWidth),
renderer: (rowIndex) => {
if (isLoading) return getCellLoader(22, 80)
if (isNoData) return getCellNoData()
Expand Down Expand Up @@ -249,7 +255,7 @@ export const getAssetColumns = ({
{
id: 'tradingFees',
name: 'summary.by_asset.trading_fees',
width: 178,
width: getColumnWidth('tradingFees', columnsWidth),
renderer: (rowIndex) => {
if (isLoading) return getCellLoader(22, 80)
if (isNoData) return getCellNoData()
Expand Down Expand Up @@ -280,7 +286,7 @@ export const getAssetColumns = ({
{
id: 'marginFundingPayment',
name: 'summary.by_asset.fund_earnings',
width: 178,
width: getColumnWidth('marginFundingPayment', columnsWidth),
renderer: (rowIndex) => {
if (isLoading) return getCellLoader(22, 80)
if (isNoData) return getCellNoData()
Expand Down
2 changes: 1 addition & 1 deletion src/components/AppSummary/AppSummary.value.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ const AccountSummaryValue = () => {
</div>
)}
<Chart
aspect={1.5}
height={375}
data={chartData}
showLegend={false}
dataKeys={presentCurrencies}
Expand Down
38 changes: 27 additions & 11 deletions src/components/AppSummary/_AppSummary.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
&-data-row {
display: flex;
flex-wrap: wrap;
max-width: 1000px;
max-width: 100%;
min-height: 441px;
align-items: flex-start;
justify-content: space-between;
Expand All @@ -29,14 +29,14 @@
&-title-row {
display: flex;
min-height: 35px;
max-width: 1000px;
max-width: 100%;
align-items: center;
justify-content: space-between;
}

&-item {
width: 48%;
max-width: 460px;
min-width: 300px;
min-height: 270px;

&-title {
Expand Down Expand Up @@ -150,7 +150,7 @@

.app-summary-item-title--row {
display: flex;
max-width: 1000px;
max-width: 100%;
position: relative;
align-items: center;
justify-content: space-between;
Expand Down Expand Up @@ -348,15 +348,15 @@
.loading-container {
display: flex;
min-height: 300px;
max-width: 1000px;
max-width: 100%;

.loading {
margin: auto;
}
}

.no-data {
max-width: 1000px;
max-width: 100%;
min-height: 300px;

&-wrapper {
Expand All @@ -366,8 +366,8 @@
}

.chart-item {
width: 50%;
max-width: 500px;
width: 48%;
margin-right: 15px;

.app-summary-item-sub-title {
margin-bottom: 11px;
Expand Down Expand Up @@ -464,25 +464,41 @@
}
}

@media screen and (max-width: 547px) {
@media screen and (max-width: 1020px) {
.app-summary {
&-data-row {
display: flex;
flex-direction: column;
margin-bottom: 0;
}

&-item {
width: 100%;
margin-bottom: 30px;
}

.chart-item {
width: 100%;
margin-right: 0;
}
}
}

@media screen and (max-width: 855px) {
.app-summary {
&-item {
.line-chart {
width:107%;
}
}
}
}

@media screen and (max-width: 400px) {
@media screen and (max-width: 450px) {
.app-summary {
&-item {
.line-chart {
width:120%;
width:115%;
}
}
}
Expand Down
13 changes: 8 additions & 5 deletions src/components/ConcentrationRisk/ConcentrationRisk.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class ConcentrationRisk extends PureComponent {
let showContent
if (isNoData) {
showContent = (
<div className='data-table-wrapper'>
<div className='concentration-risk-data-table'>
<DataTable
section={TYPE}
isNoData={isNoData}
Expand All @@ -156,10 +156,13 @@ class ConcentrationRisk extends PureComponent {
} else {
showContent = (
<div className='concentration-risk-data'>
<DataTable
tableColumns={tableColumns}
numRows={isLoading ? 5 : tableData.length}
/>
<div className='concentration-risk-data-table'>
<DataTable
tableColumns={tableColumns}
enableColumnResizing={false}
numRows={isLoading ? 5 : tableData.length}
/>
</div>
<div className='concentration-risk-data-chart'>
<PieChart data={chartData} />
</div>
Expand Down
Loading