From 0699e690a6feede0364cc27163e73a3de1e8838b Mon Sep 17 00:00:00 2001 From: pietro-maximoff Date: Thu, 28 Sep 2023 11:00:35 +0200 Subject: [PATCH] chore: add loading data --- .../CloseWithDepositLoanFrame.tsx | 1 + .../CloseWithSwapLoanFrame.tsx | 1 + .../CollateralSurplusHistoryFrame.tsx | 1 + .../DepositCollateralLoanFrame.tsx | 1 + .../LiquidationLoanFrame.tsx | 1 + .../NewLoanFrame/NewLoanHistoryFrame.tsx | 1 + .../RolloverLoanHistoryFrame.tsx | 1 + .../TransactionHistoryFrame.tsx | 1 + .../MyntConversionsHistoryFrame.tsx | 1 + .../ZeroConversionsHistoryFrame.tsx | 1 + .../LendingHistoryFrame.tsx | 1 + .../StabilityPoolHistoryFrame.tsx | 1 + .../FundingHistoryFrame.tsx | 1 + .../RedemptionsHistoryFrame.tsx | 1 + .../RewardsEarnedHistory.tsx | 1 + .../StabilityPoolRewards.tsx | 1 + .../StabilityPoolSubsidies.tsx | 1 + .../VestingRewards/VestingRewards.tsx | 1 + .../StakingDelegateChanges.tsx | 1 + .../StakingExtendedDuration.tsx | 1 + .../StakingHistory/StakingHistory.tsx | 1 + .../StakingWithdraws/StakingWithdraws.tsx | 1 + .../VestingDelegateChanges.tsx | 1 + .../BorrowAssetsTable/BorrowAssetsTable.tsx | 1 + .../OpenLoansTable/OpenLoansTable.tsx | 1 + .../components/LendFrame/LendFrame.tsx | 1 + .../StabilityPool/StabilityPool.tsx | 1 + .../components/Staking/Staking.tsx | 1 + .../components/Vesting/Vesting.tsx | 1 + .../components/StakesFrame/StakesFrame.tsx | 1 + .../VestingStakesFrame/VestingStakesFrame.tsx | 1 + .../frontend/src/locales/en/translations.json | 3 ++- .../ui/src/2_molecules/Table/Table.types.ts | 1 + .../components/TableDesktop/TableDesktop.tsx | 21 +++++++------------ .../components/TableMobile/TableMobile.tsx | 11 ++++------ 35 files changed, 46 insertions(+), 21 deletions(-) diff --git a/apps/frontend/src/app/3_organisms/BorrowHistory/components/CloseWithDepositLoanFrame/CloseWithDepositLoanFrame.tsx b/apps/frontend/src/app/3_organisms/BorrowHistory/components/CloseWithDepositLoanFrame/CloseWithDepositLoanFrame.tsx index 522f12325..d55210126 100644 --- a/apps/frontend/src/app/3_organisms/BorrowHistory/components/CloseWithDepositLoanFrame/CloseWithDepositLoanFrame.tsx +++ b/apps/frontend/src/app/3_organisms/BorrowHistory/components/CloseWithDepositLoanFrame/CloseWithDepositLoanFrame.tsx @@ -186,6 +186,7 @@ export const CloseWithDepositLoanFrame: FC = ({ isLoading={loading} className="bg-gray-80 text-gray-10 lg:px-6 lg:py-4" noData={t(translations.common.tables.noData)} + loadingData={t(translations.common.tables.loading)} dataAttribute="close-with-deposits-table" /> = ({ children }) => { isLoading={loading} className="bg-gray-80 text-gray-10 lg:px-6 lg:py-4" noData={t(translations.common.tables.noData)} + loadingData={t(translations.common.tables.loading)} dataAttribute="close-with-swaps-table" /> = ({ isLoading={loading} className="bg-gray-80 text-gray-10 lg:px-6 lg:py-4" noData={t(translations.common.tables.noData)} + loadingData={t(translations.common.tables.loading)} dataAttribute="surplus-withdrawals-table" /> = ({ isLoading={loading} className="bg-gray-80 text-gray-10 lg:px-6 lg:py-4" noData={t(translations.common.tables.noData)} + loadingData={t(translations.common.tables.loading)} dataAttribute="deposit-collaterals-table" /> = ({ children }) => { isLoading={loading} className="bg-gray-80 text-gray-10 lg:px-6 lg:py-4" noData={t(translations.common.tables.noData)} + loadingData={t(translations.common.tables.loading)} dataAttribute="close-with-deposits-table" /> = ({ children }) => { isLoading={loading} className="bg-gray-80 text-gray-10 lg:px-6 lg:py-4" noData={t(translations.common.tables.noData)} + loadingData={t(translations.common.tables.loading)} dataAttribute="new-loans-table" /> = ({ isLoading={loading} className="bg-gray-80 text-gray-10 lg:px-6 lg:py-4" noData={t(translations.common.tables.noData)} + loadingData={t(translations.common.tables.loading)} dataAttribute="rollover-loans-table" /> = ({ isLoading={loading} className="bg-gray-80 text-gray-10 lg:px-6 lg:py-4" noData={noDataLabel} + loadingData={t(translations.common.tables.loading)} dataAttribute="transaction-history-table" /> = ({ isLoading={loading} className="bg-gray-80 text-gray-10 lg:px-6 lg:py-4" noData={t(translations.common.tables.noData)} + loadingData={t(translations.common.tables.loading)} dataAttribute="mynt-conversions-history-table" /> } diff --git a/apps/frontend/src/app/3_organisms/ConversionsHistoryFrame/components/ZeroConversionsHistoryFrame/ZeroConversionsHistoryFrame.tsx b/apps/frontend/src/app/3_organisms/ConversionsHistoryFrame/components/ZeroConversionsHistoryFrame/ZeroConversionsHistoryFrame.tsx index 2b4549e5e..ffa3bdd42 100644 --- a/apps/frontend/src/app/3_organisms/ConversionsHistoryFrame/components/ZeroConversionsHistoryFrame/ZeroConversionsHistoryFrame.tsx +++ b/apps/frontend/src/app/3_organisms/ConversionsHistoryFrame/components/ZeroConversionsHistoryFrame/ZeroConversionsHistoryFrame.tsx @@ -130,6 +130,7 @@ export const ZeroConversionsHistoryFrame: React.FC = ({ isLoading={loading} className="bg-gray-80 text-gray-10 lg:px-6 lg:py-4" noData={t(translations.common.tables.noData)} + loadingData={t(translations.common.tables.loading)} dataAttribute="zero-conversions-history-table" /> } diff --git a/apps/frontend/src/app/3_organisms/EarnHistoryFrame/components/LendingHistoryFrame/LendingHistoryFrame.tsx b/apps/frontend/src/app/3_organisms/EarnHistoryFrame/components/LendingHistoryFrame/LendingHistoryFrame.tsx index c312dae54..bd902a009 100644 --- a/apps/frontend/src/app/3_organisms/EarnHistoryFrame/components/LendingHistoryFrame/LendingHistoryFrame.tsx +++ b/apps/frontend/src/app/3_organisms/EarnHistoryFrame/components/LendingHistoryFrame/LendingHistoryFrame.tsx @@ -134,6 +134,7 @@ export const LendingHistoryFrame: FC = ({ children }) => { isLoading={loading} className="bg-gray-80 text-gray-10 lg:px-6 lg:py-4" noData={t(translations.common.tables.noData)} + loadingData={t(translations.common.tables.loading)} dataAttribute="earn-history-table" /> } diff --git a/apps/frontend/src/app/3_organisms/EarnHistoryFrame/components/StabilityPoolHistoryFrame/StabilityPoolHistoryFrame.tsx b/apps/frontend/src/app/3_organisms/EarnHistoryFrame/components/StabilityPoolHistoryFrame/StabilityPoolHistoryFrame.tsx index fa77a7378..0f1c9f8c9 100644 --- a/apps/frontend/src/app/3_organisms/EarnHistoryFrame/components/StabilityPoolHistoryFrame/StabilityPoolHistoryFrame.tsx +++ b/apps/frontend/src/app/3_organisms/EarnHistoryFrame/components/StabilityPoolHistoryFrame/StabilityPoolHistoryFrame.tsx @@ -344,6 +344,7 @@ export const StabilityPoolHistoryFrame: FC = ({ isLoading={loading} className="bg-gray-80 text-gray-10 lg:px-6 lg:py-4" noData={noDataLabel} + loadingData={t(translations.common.tables.loading)} dataAttribute="stability-pool-history-table" /> { isLoading={loading} className="bg-gray-80 text-gray-10 lg:px-6 lg:py-4" noData={t(translations.common.tables.noData)} + loadingData={t(translations.common.tables.loading)} dataAttribute="funding-history-table" /> { isLoading={loading} className="bg-gray-80 text-gray-10 lg:px-6 lg:py-4" noData={t(translations.common.tables.noData)} + loadingData={t(translations.common.tables.loading)} dataAttribute="redemption-history-table" /> = ({ isLoading={loading} className="bg-gray-80 text-gray-10 lg:px-6 lg:py-4" noData={t(translations.common.tables.noData)} + loadingData={t(translations.common.tables.loading)} dataAttribute="subsidy-history-reward-table" /> = ({ isLoading={loading} className="bg-gray-80 text-gray-10 lg:px-6 lg:py-4" noData={t(translations.common.tables.noData)} + loadingData={t(translations.common.tables.loading)} dataAttribute="reward-history-table" /> = ({ isLoading={loading} className="bg-gray-80 text-gray-10 lg:px-6 lg:py-4" noData={t(translations.common.tables.noData)} + loadingData={t(translations.common.tables.loading)} dataAttribute="subsidy-history-reward-table" /> = ({ isLoading={loading} className="bg-gray-80 text-gray-10 lg:px-6 lg:py-4" noData={t(translations.common.tables.noData)} + loadingData={t(translations.common.tables.loading)} dataAttribute="vesting-reward-history-table" /> = ({ isLoading={loading} className="bg-gray-80 text-gray-10 lg:px-6 lg:py-4" noData={t(translations.common.tables.noData)} + loadingData={t(translations.common.tables.loading)} dataAttribute="staking-delegate-change-history-table" /> = ({ isLoading={loading} className="bg-gray-80 text-gray-10 lg:px-6 lg:py-4" noData={t(translations.common.tables.noData)} + loadingData={t(translations.common.tables.loading)} dataAttribute="staking-extended-duration-history-table" /> = ({ isLoading={loading} className="bg-gray-80 text-gray-10 lg:px-6 lg:py-4" noData={t(translations.common.tables.noData)} + loadingData={t(translations.common.tables.loading)} dataAttribute="staking-history-table" /> = ({ isLoading={loading} className="bg-gray-80 text-gray-10 lg:px-6 lg:py-4" noData={t(translations.common.tables.noData)} + loadingData={t(translations.common.tables.loading)} dataAttribute="staking-withdrawns-history-table" /> = ({ isLoading={loading} className="bg-gray-80 text-gray-10 lg:px-6 lg:py-4" noData={t(translations.common.tables.noData)} + loadingData={t(translations.common.tables.loading)} dataAttribute="staking-delegate-change-history-table" /> ( rowTitle={generateRowTitle} className="text-gray-10 lg:px-6 lg:py-4 text-xs" noData={t(translations.common.tables.noData)} + loadingData={t(translations.common.tables.loading)} dataAttribute="borrow-assets-table" /> diff --git a/apps/frontend/src/app/5_pages/BorrowPage/components/OpenLoansTable/OpenLoansTable.tsx b/apps/frontend/src/app/5_pages/BorrowPage/components/OpenLoansTable/OpenLoansTable.tsx index b437d7928..6d07b7588 100644 --- a/apps/frontend/src/app/5_pages/BorrowPage/components/OpenLoansTable/OpenLoansTable.tsx +++ b/apps/frontend/src/app/5_pages/BorrowPage/components/OpenLoansTable/OpenLoansTable.tsx @@ -29,6 +29,7 @@ export const OpenLoansTable: FC = ({ loans, loading }) => ( rowTitle={generateRowTitle} className="text-gray-10 lg:px-6 lg:py-4 text-xs" noData={t(translations.common.tables.noData)} + loadingData={t(translations.common.tables.loading)} isLoading={loading} dataAttribute="borrow-assets-table" /> diff --git a/apps/frontend/src/app/5_pages/LendPage/components/LendFrame/LendFrame.tsx b/apps/frontend/src/app/5_pages/LendPage/components/LendFrame/LendFrame.tsx index e0223c78b..4bb9a46a0 100644 --- a/apps/frontend/src/app/5_pages/LendPage/components/LendFrame/LendFrame.tsx +++ b/apps/frontend/src/app/5_pages/LendPage/components/LendFrame/LendFrame.tsx @@ -28,6 +28,7 @@ export const LendFrame: FC = () => { rowTitle={generateRowTitle} className="text-gray-10 lg:px-6 lg:py-4 text-xs" noData={t(translations.common.tables.noData)} + loadingData={t(translations.common.tables.loading)} dataAttribute="lend-frame-table" expandedContent={pool => } expandedClassNames="border border-gray-70 border-t-0" diff --git a/apps/frontend/src/app/5_pages/RewardsPage/components/StabilityPool/StabilityPool.tsx b/apps/frontend/src/app/5_pages/RewardsPage/components/StabilityPool/StabilityPool.tsx index 71021027b..e39cd9126 100644 --- a/apps/frontend/src/app/5_pages/RewardsPage/components/StabilityPool/StabilityPool.tsx +++ b/apps/frontend/src/app/5_pages/RewardsPage/components/StabilityPool/StabilityPool.tsx @@ -225,6 +225,7 @@ export const StabilityPool: FC = () => { : t(translations.rewardPage.stabilityPool.notConnected)} } + loadingData={t(translations.common.tables.loading)} rowTitle={row => (
diff --git a/apps/frontend/src/app/5_pages/RewardsPage/components/Staking/Staking.tsx b/apps/frontend/src/app/5_pages/RewardsPage/components/Staking/Staking.tsx index c0fb74274..81b11454f 100644 --- a/apps/frontend/src/app/5_pages/RewardsPage/components/Staking/Staking.tsx +++ b/apps/frontend/src/app/5_pages/RewardsPage/components/Staking/Staking.tsx @@ -98,6 +98,7 @@ export const Staking: FC = () => { : t(translations.rewardPage.stabilityPool.notConnected)} } + loadingData={t(translations.common.tables.loading)} rowTitle={row => (
{row.type} diff --git a/apps/frontend/src/app/5_pages/RewardsPage/components/Vesting/Vesting.tsx b/apps/frontend/src/app/5_pages/RewardsPage/components/Vesting/Vesting.tsx index 87dabe352..c3bfce17e 100644 --- a/apps/frontend/src/app/5_pages/RewardsPage/components/Vesting/Vesting.tsx +++ b/apps/frontend/src/app/5_pages/RewardsPage/components/Vesting/Vesting.tsx @@ -53,6 +53,7 @@ export const Vesting: FC = () => { : t(translations.rewardPage.vesting.table.notConnected)} } + loadingData={t(translations.common.tables.loading)} isLoading={loading} dataAttribute="funding-history-table" rowTitle={generateRowTitle} diff --git a/apps/frontend/src/app/5_pages/StakePage/components/StakesFrame/StakesFrame.tsx b/apps/frontend/src/app/5_pages/StakePage/components/StakesFrame/StakesFrame.tsx index ed532de7b..507eadbdb 100644 --- a/apps/frontend/src/app/5_pages/StakePage/components/StakesFrame/StakesFrame.tsx +++ b/apps/frontend/src/app/5_pages/StakePage/components/StakesFrame/StakesFrame.tsx @@ -75,6 +75,7 @@ export const StakesFrame: FC = () => { : t(translations.stakePage.table.notConnected)} } + loadingData={t(translations.common.tables.loading)} dataAttribute="stakes-table" /> {account && ( diff --git a/apps/frontend/src/app/5_pages/StakePage/components/VestingStakesFrame/VestingStakesFrame.tsx b/apps/frontend/src/app/5_pages/StakePage/components/VestingStakesFrame/VestingStakesFrame.tsx index 18c9da219..9feb9deaa 100644 --- a/apps/frontend/src/app/5_pages/StakePage/components/VestingStakesFrame/VestingStakesFrame.tsx +++ b/apps/frontend/src/app/5_pages/StakePage/components/VestingStakesFrame/VestingStakesFrame.tsx @@ -73,6 +73,7 @@ export const VestingStakesFrame: FC = () => { : t(translations.stakePage.table.notConnected)} } + loadingData={t(translations.common.tables.loading)} dataAttribute="vesting-stakes-table" /> {account && ( diff --git a/apps/frontend/src/locales/en/translations.json b/apps/frontend/src/locales/en/translations.json index 36e10da50..1725b248f 100644 --- a/apps/frontend/src/locales/en/translations.json +++ b/apps/frontend/src/locales/en/translations.json @@ -34,7 +34,8 @@ "noDataToExport": "No data to export" }, "noData": "No data available", - "noDataWithFilters": "No data with the current filters" + "noDataWithFilters": "No data with the current filters", + "loading": "Loading data..." }, "max": "max", "amount": "Amount", diff --git a/packages/ui/src/2_molecules/Table/Table.types.ts b/packages/ui/src/2_molecules/Table/Table.types.ts index e77f0bb88..57306daa9 100644 --- a/packages/ui/src/2_molecules/Table/Table.types.ts +++ b/packages/ui/src/2_molecules/Table/Table.types.ts @@ -23,6 +23,7 @@ export type TableProps = { rowKey?: (row: RowType) => number | string; rowTitle?: (row: RowType) => ReactNode; noData?: ReactNode; + loadingData?: ReactNode; onRowClick?: (row: RowType) => void; dataAttribute?: string; isClickable?: boolean; diff --git a/packages/ui/src/2_molecules/Table/components/TableDesktop/TableDesktop.tsx b/packages/ui/src/2_molecules/Table/components/TableDesktop/TableDesktop.tsx index c519e65d8..c8d77033a 100644 --- a/packages/ui/src/2_molecules/Table/components/TableDesktop/TableDesktop.tsx +++ b/packages/ui/src/2_molecules/Table/components/TableDesktop/TableDesktop.tsx @@ -24,6 +24,7 @@ export const TableDesktop = ({ rows, rowKey, noData, + loadingData, onRowClick, dataAttribute, isClickable, @@ -143,19 +144,13 @@ export const TableDesktop = ({ ))} - {isLoading ? ( - - - Loading data… - - - ) : ( - - - {noData ? noData : 'No data'} - - - )} + + + {isLoading + ? loadingData || 'Loading data…' + : noData || 'No data'} + + )} diff --git a/packages/ui/src/2_molecules/Table/components/TableMobile/TableMobile.tsx b/packages/ui/src/2_molecules/Table/components/TableMobile/TableMobile.tsx index 02617fe3a..42da80666 100644 --- a/packages/ui/src/2_molecules/Table/components/TableMobile/TableMobile.tsx +++ b/packages/ui/src/2_molecules/Table/components/TableMobile/TableMobile.tsx @@ -14,6 +14,7 @@ export const TableMobile = ({ onRowClick, dataAttribute, noData, + loadingData, isLoading, className, expandedContent, @@ -36,13 +37,9 @@ export const TableMobile = ({ ))} {(!rows || rows.length === 0) && ( - <> - {isLoading ? ( -
Loading data…
- ) : ( -
{noData ? noData : 'No data'}
- )} - +
+ {isLoading ? loadingData || 'Loading data…' : noData || 'No data'} +
)}
);