-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'development' of ssh://github.com/multiversx/mx-explorer…
…-dapp into staking-v4-redesign-step-2
- Loading branch information
Showing
48 changed files
with
1,134 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
79 changes: 79 additions & 0 deletions
79
src/components/Filters/TransactionsFilters/TransactionInPoolTypeFilter.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; | ||
import classNames from 'classnames'; | ||
import { Anchor, Dropdown } from 'react-bootstrap'; | ||
import { useSearchParams } from 'react-router-dom'; | ||
|
||
import { faFilter } from 'icons/regular'; | ||
import { faFilter as faFilterSolid } from 'icons/solid'; | ||
import { TransactionInPoolTypeEnum } from 'types'; | ||
|
||
export const TransactionInPoolTypeFilter = ({ | ||
text, | ||
hideFilters | ||
}: { | ||
text: React.ReactNode; | ||
hideFilters?: boolean; | ||
}) => { | ||
const [searchParams, setSearchParams] = useSearchParams(); | ||
const { type, page, size, ...rest } = Object.fromEntries(searchParams); | ||
|
||
const typeLink = (type: TransactionInPoolTypeEnum) => { | ||
const nextUrlParams = { | ||
...rest, | ||
...(type ? { type } : {}) | ||
}; | ||
|
||
setSearchParams(nextUrlParams); | ||
}; | ||
|
||
if (hideFilters) { | ||
return text; | ||
} | ||
|
||
return ( | ||
<div | ||
className={classNames({ | ||
'text-primary-100': type !== undefined | ||
})} | ||
> | ||
{text} | ||
<Dropdown | ||
className='d-inline-flex' | ||
onSelect={(eventKey: any) => { | ||
return typeLink(eventKey ?? ''); | ||
}} | ||
> | ||
<Dropdown.Toggle | ||
className='btn-link-unstyled side-action cursor-pointer' | ||
variant='link' | ||
> | ||
<FontAwesomeIcon | ||
icon={type !== undefined ? faFilterSolid : faFilter} | ||
className={type !== undefined ? 'text-primary' : ''} | ||
/> | ||
</Dropdown.Toggle> | ||
<Dropdown.Menu> | ||
<Dropdown.Item as={Anchor} className='text-neutral-400' eventKey=''> | ||
All | ||
</Dropdown.Item> | ||
{Object.keys(TransactionInPoolTypeEnum).map( | ||
(transactionType, key) => { | ||
return ( | ||
<Dropdown.Item | ||
as={Anchor} | ||
eventKey={transactionType} | ||
className={`dropdown-item text-cyan-400 ${ | ||
type === transactionType ? 'active' : '' | ||
}`} | ||
key={key} | ||
> | ||
{transactionType} | ||
</Dropdown.Item> | ||
); | ||
} | ||
)} | ||
</Dropdown.Menu> | ||
</Dropdown> | ||
</div> | ||
); | ||
}; |
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...e/components/TransactionsFilters/index.ts → ...ents/Filters/TransactionsFilters/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
export * from './AgeColumnFilters'; | ||
export * from './FromColumnFilters'; | ||
export * from './MethodColumnFilters'; | ||
export * from './MethodList'; | ||
export * from './ShardColumnFilters'; | ||
export * from './StatusColumnFilters'; | ||
export * from './ToColumnFilters'; | ||
export * from './TransactionInPoolTypeFilter'; | ||
export * from './ValueColumnFilters'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
122 changes: 122 additions & 0 deletions
122
src/components/TransactionsInPoolTable/TransactionsInPoolTable.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
import { ELLIPSIS } from 'appConstants'; | ||
import { | ||
Pager, | ||
PageSize, | ||
TableWrapper, | ||
Loader, | ||
PageState, | ||
PulsatingLed | ||
} from 'components'; | ||
import { useGetTransactionInPoolFilters } from 'hooks'; | ||
import { faCode, faExchangeAlt } from 'icons/regular'; | ||
import { TransactionInPoolType, TransactionFiltersEnum } from 'types'; | ||
|
||
import { TransactionsInPoolHeader, TransactionInPoolRow } from './components'; | ||
|
||
export interface TransactionsInPoolTableUIType { | ||
transactionsInPool: TransactionInPoolType[]; | ||
totalTransactionsInPool: number | typeof ELLIPSIS; | ||
title?: React.ReactNode; | ||
dataChanged?: boolean; | ||
isDataReady?: boolean; | ||
inactiveFilters?: TransactionFiltersEnum[]; | ||
} | ||
|
||
const ColSpanWrapper = ({ children }: { children: React.ReactNode }) => ( | ||
<tr> | ||
<td colSpan={7}>{children}</td> | ||
</tr> | ||
); | ||
|
||
export const TransactionsInPoolTable = ({ | ||
transactionsInPool, | ||
totalTransactionsInPool, | ||
title = ( | ||
<h5 data-testid='title' className='table-title d-flex align-items-center'> | ||
Live Transactions In Pool <PulsatingLed className='ms-2 mt-1' /> | ||
</h5> | ||
), | ||
dataChanged = false, | ||
isDataReady, | ||
inactiveFilters | ||
}: TransactionsInPoolTableUIType) => { | ||
const { type } = useGetTransactionInPoolFilters(); | ||
return ( | ||
<div className='transactions-table transactions-in-pool-table'> | ||
<div className='card'> | ||
<div className='card-header'> | ||
<div className='card-header-item table-card-header d-flex justify-content-between align-items-center flex-wrap gap-3'> | ||
{title} | ||
<Pager | ||
total={totalTransactionsInPool} | ||
show={transactionsInPool.length > 0} | ||
className='d-flex ms-auto me-auto me-sm-0' | ||
/> | ||
</div> | ||
</div> | ||
|
||
<div className='card-body'> | ||
<TableWrapper dataChanged={dataChanged}> | ||
<table | ||
className='table trim-size-sm mb-0' | ||
data-testid='transactionsTable' | ||
> | ||
<TransactionsInPoolHeader inactiveFilters={inactiveFilters} /> | ||
<tbody> | ||
{isDataReady === undefined && ( | ||
<ColSpanWrapper> | ||
<Loader /> | ||
</ColSpanWrapper> | ||
)} | ||
{isDataReady === false && ( | ||
<ColSpanWrapper> | ||
<PageState | ||
icon={faExchangeAlt} | ||
title={`No ${type ? `${type} ` : ''}Transactions in Pool`} | ||
className='py-spacer my-auto' | ||
/> | ||
</ColSpanWrapper> | ||
)} | ||
|
||
{isDataReady === true && ( | ||
<> | ||
{transactionsInPool.length > 0 ? ( | ||
<> | ||
{transactionsInPool.map((transactionInPool, key) => ( | ||
<TransactionInPoolRow | ||
transaction={transactionInPool} | ||
key={`${transactionInPool.txHash}-${key}`} | ||
/> | ||
))} | ||
</> | ||
) : ( | ||
<> | ||
<ColSpanWrapper> | ||
<PageState | ||
icon={faCode} | ||
title={`No ${ | ||
type ? `${type} ` : '' | ||
}Transactions in Pool`} | ||
className='py-spacer my-auto' | ||
/> | ||
</ColSpanWrapper> | ||
</> | ||
)} | ||
</> | ||
)} | ||
</tbody> | ||
</table> | ||
</TableWrapper> | ||
</div> | ||
|
||
<div className='card-footer table-footer'> | ||
<PageSize /> | ||
<Pager | ||
total={totalTransactionsInPool} | ||
show={transactionsInPool.length > 0} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; |
Oops, something went wrong.