Skip to content

Commit

Permalink
Merge pull request #85 from multiversx/staking-v4-redesign-step-2
Browse files Browse the repository at this point in the history
Staking V4 Redesign: Step 2
  • Loading branch information
radumojic authored May 20, 2024
2 parents e50be35 + 790964a commit 30cbbae
Show file tree
Hide file tree
Showing 142 changed files with 3,916 additions and 2,195 deletions.
2 changes: 1 addition & 1 deletion cypress/e2e/Validators/Validators.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe('Validators', () => {
'Name',
'Shard',
'Version',
'Ignored Signatures',
'X Sign.',
'Status',
'Rating',
'Nonce'
Expand Down
2 changes: 1 addition & 1 deletion src/appConstants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const LOW_LIQUIDITY_DISPLAY_TRESHOLD = 1_000_000;
export const LOW_LIQUIDITY_MARKET_CAP_DISPLAY_TRESHOLD = 10_000_000;

export const AUCTION_LIST_MAX_NODES = 3000;
export const AUCTION_LIST_EXPAND_ROW_POSITION = 3;
export const AUCTION_LIST_QUALIFIED_MIN_DISPLAY_ROW_COUNT = 10;
export const AUCTION_LIST_MIN_DISPLAY_ROW_COUNT = 6;

export const LEGACY_DELEGATION_NODES_IDENTITY = 'multiversx';
Expand Down
15 changes: 15 additions & 0 deletions src/assets/scss/_bootstrap-overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,21 @@
--#{$prefix}btn-hover-bg: var(--#{$prefix}black);
--#{$prefix}btn-active-bg: var(--#{$prefix}black);
}

.btn-dark-980 {
--#{$prefix}btn-color: var(--#{$prefix}neutral-600);
--#{$prefix}btn-bg: var(--#{$prefix}neutral-980);
--#{$prefix}btn-border-color: transparent;
--#{$prefix}btn-hover-border-color: transparent;
--#{$prefix}btn-focus-box-shadow: none;

--#{$prefix}btn-hover-color: var(--#{$prefix}primary);
--#{$prefix}btn-hover-bg: var(--#{$prefix}black);

--#{$prefix}btn-active-color: var(--#{$prefix}primary);
--#{$prefix}btn-active-bg: var(--#{$prefix}black);
--#{$prefix}btn-active-border-color: transparent;
}
.form-select,
.form-control {
background-color: var(--#{$prefix}neutral-800);
Expand Down
40 changes: 39 additions & 1 deletion src/assets/scss/_shared-styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,24 @@
border-bottom-right-radius: $input-border-radius-lg !important;
}
}
&.input-group-search {
width: auto;
.form-control {
border: 1px solid var(--neutral-800);
border-radius: 0.5rem;
font-size: 1rem;
line-height: 1;
padding: 0.625rem 1rem;
background-color: var(--neutral-850);
border-top-right-radius: 0.5rem !important;
border-bottom-right-radius: 0.5rem !important;
}
.input-group-text {
top: 1px;
bottom: 1px;
background-color: var(--neutral-850);
}
}
&.input-group-sm {
.form-control {
border-top-right-radius: $input-border-radius-sm !important;
Expand Down Expand Up @@ -127,6 +145,8 @@
}
}
th {
color: var(--neutral-300);
font-family: var(--font-headings-regular);
&.percentage-column {
width: 12rem;
}
Expand Down Expand Up @@ -203,7 +223,7 @@

.truncate-item-lg {
@extend .text-truncate;
max-width: 13rem;
max-width: 11rem;
}

.truncate-item-xl {
Expand Down Expand Up @@ -390,6 +410,12 @@ div.side-icon {
margin-bottom: 0 !important;
}

.search-md {
@include media-breakpoint-up(xl) {
max-width: 16rem;
}
}

.search-sm {
@include media-breakpoint-up(xl) {
max-width: 11rem;
Expand Down Expand Up @@ -520,3 +546,15 @@ img.loading {
outline-offset: 1px;
}
}

.dropdown-toggle {
&.no-toggle {
&:after {
display: none;
}
}
}

.btn-general-filter {
--btn-padding-x: 0.725rem;
}
7 changes: 5 additions & 2 deletions src/assets/scss/common/_color-palette.scss
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ $main-colors: map-merge-multiple(
$blues,
$violets,
$purples,
$primarys
$primarys,
$cyans
);
$main-colors-rgb: map-loop($main-colors, to-rgb, '$value');

Expand All @@ -52,7 +53,9 @@ $helper-colors: map-merge-multiple(
$primarys,
$reds,
$greens,
$oranges
$oranges,
$blues,
$cyans
);
$helper-colors-rgb: map-loop($theme-colors, to-rgb, '$value');

Expand Down
1 change: 1 addition & 0 deletions src/assets/scss/common/_theme-helpers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ a > .cursor-context {
padding-top: 1rem;
padding-bottom: 1rem;
border-bottom-width: 0;
vertical-align: middle;
&:first-of-type {
padding-left: 1rem;
border-top-left-radius: 0.5rem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ $neutral-650: #4a4a4a;
$neutral-700: #404040;
$neutral-750: #2e2e2e;
$neutral-800: #262626;
$neutral-850: #212121;
$neutral-900: #171717;
$neutral-950: #121212;
$neutral-980: #0a0a0a;

$stone-50: #fafaf9;
$stone-100: #f5f5f4;
Expand Down Expand Up @@ -295,8 +297,10 @@ $neutrals: (
'neutral-700': $neutral-700,
'neutral-750': $neutral-750,
'neutral-800': $neutral-800,
'neutral-850': $neutral-850,
'neutral-900': $neutral-900,
'neutral-950': $neutral-950
'neutral-950': $neutral-950,
'neutral-980': $neutral-980
);

$stones: (
Expand Down
4 changes: 3 additions & 1 deletion src/assets/scss/components/_components.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@
@import '../../../components/Marquee/marquee.styles.scss';
@import '../../../components/MultilayerPercentage/multilayerPercentage.styles.scss';
@import '../../../components/NftPreview/nftPreview.styles.scss';
@import '../../../components/Nodes/AuctionListTable/auctionListTables.styles.scss';
@import '../../../components/NodesTable/nodesTable.styles.scss';
@import '../../../components/Nodes/NodesTableHero/nodesTableHero.styles.scss';
@import '../../../components/Nodes/AuctionListCards/auctionListCards.styles.scss';
@import '../../../components/NotificationsBar/notificationsBar.styles.scss';
@import '../../../components/Pager/pager.styles.scss';
@import '../../../components/PageState/components/IconState/iconState.styles.scss';
Expand All @@ -29,6 +30,7 @@
@import '../../../components/SharedIdentity/IdentityCard/identityCard.styles.scss';
@import '../../../components/SharedIdentity/IdentitySummary/identitySummary.styles.scss';
@import '../../../components/SocialIcons/socialIcons.styles.scss';
@import '../../../components/TableFiltersHead/tableFiltersHead.styles.scss';
@import '../../../components/TransactionAction/transactionAction.styles.scss';
@import '../../../components/TransactionsTable/transactionsTable.styles.scss';
@import '../../../components/Trim/trim.styles.scss';
Expand Down
1 change: 1 addition & 0 deletions src/assets/scss/elements/_buttons.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.btn-tab {
--#{$prefix}btn-font-family: var(--#{$prefix}font-headings-regular);
--#{$prefix}btn-font-size: 1rem;
--#{$prefix}btn-font-weight: 400;
--#{$prefix}btn-line-height: 1;
--#{$prefix}btn-border-width: 1px;
Expand Down
80 changes: 80 additions & 0 deletions src/components/Filters/ShardFilter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import classNames from 'classnames';
import { Dropdown, Anchor } from 'react-bootstrap';
import { useSelector } from 'react-redux';
import { useSearchParams } from 'react-router-dom';

import { ShardSpan } from 'components';
import { useFetchShards } from 'hooks';
import { faFilter } from 'icons/regular';
import { faFilter as faFilterSolid } from 'icons/solid';
import { shardsSelector } from 'redux/selectors';
import { TableFilterUIType } from 'types';

export const ShardFilter = ({ text, hideFilters }: TableFilterUIType) => {
const shards = useSelector(shardsSelector);

const [searchParams, setSearchParams] = useSearchParams();
const { shard, page, size, ...rest } = Object.fromEntries(searchParams);

useFetchShards();

const setShardfilter = (shard: string) => {
const nextUrlParams = {
...rest,
...(shard ? { shard } : {})
};

setSearchParams(nextUrlParams);
};

if (hideFilters) {
return text;
}

return (
<div
className={classNames({
'text-primary-100': shard !== undefined
})}
>
{text}
<Dropdown
className='d-inline-flex'
onSelect={(eventKey: any) => {
return setShardfilter(eventKey ?? '');
}}
>
<Dropdown.Toggle
className='btn-link-unstyled side-action cursor-pointer'
variant='link'
>
<FontAwesomeIcon
icon={shard !== undefined ? faFilterSolid : faFilter}
className={shard !== undefined ? 'text-primary' : ''}
/>
</Dropdown.Toggle>

<Dropdown.Menu>
<Dropdown.Item as={Anchor} eventKey=''>
All
</Dropdown.Item>
{shards.map((entry, i) => {
return (
<Dropdown.Item
as={Anchor}
className={`dropdown-item ${
shard === entry.shard.toString() ? 'active' : ''
}`}
eventKey={entry.shard}
key={entry.shard + i}
>
<ShardSpan shard={entry.shard} />
</Dropdown.Item>
);
})}
</Dropdown.Menu>
</Dropdown>
</div>
);
};
103 changes: 103 additions & 0 deletions src/components/Filters/TableSearch.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import React, { useState, useEffect } from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import classNames from 'classnames';
import { useSearchParams } from 'react-router-dom';

import { ELLIPSIS } from 'appConstants';
import { formatBigNumber, getStringPlural } from 'helpers';
import { useGetSearch } from 'hooks';
import { faSearch, faTimes } from 'icons/regular';
import { WithClassnameType } from 'types';

export interface TableSearchUIType extends WithClassnameType {
name?: string;
searchValue?: string | number;
placeholderText?: string;
}

export const TableSearch = ({
name = 'search',
searchValue,
placeholderText,
className
}: TableSearchUIType) => {
const [searchParams, setSearchParams] = useSearchParams();
const { search } = useGetSearch();

const [inputValue, setInputValue] = useState<string>(search ?? '');
const [placeholderAddonText, setPlaceholderAddonText] = useState('');

const changeSearchValue: React.ChangeEventHandler<HTMLInputElement> = (e) => {
setInputValue(e.target.value);
};

const updateSearchValue = (searchValue: string) => {
const { search, page, size, ...rest } = Object.fromEntries(searchParams);
const nextUrlParams = {
...rest,
...(searchValue ? { search: searchValue } : {})
};

setSearchParams(nextUrlParams);
};

useEffect(() => {
const searchPlaceholder =
searchValue && searchValue !== ELLIPSIS
? getStringPlural(searchValue, { string: placeholderText })
: '';
const placeholderAddonText = search
? ''
: `${
searchValue && searchValue !== ELLIPSIS
? `${formatBigNumber({ value: searchValue })} `
: ''
}${searchPlaceholder}`;

setPlaceholderAddonText(placeholderAddonText);
}, [searchValue]);

return (
<div
role='search'
className={classNames(
'search-md input-group input-group-search input-group-seamless',
className
)}
>
<input
type='text'
className='form-control'
value={inputValue || ''}
onChange={changeSearchValue}
onKeyDown={(keyEvent: React.KeyboardEvent) => {
if (keyEvent.key === 'Enter') {
updateSearchValue(inputValue);
}
}}
placeholder={`Search ${placeholderAddonText}`}
name={name}
data-testid={name}
/>

{inputValue ? (
<button
type='reset'
className='input-group-text'
onClick={() => {
updateSearchValue('');
setInputValue('');
setPlaceholderAddonText('');
}}
data-testid='resetSearch'
>
<FontAwesomeIcon icon={faTimes} />
</button>
) : (
<button type='submit' className='input-group-text'>
<FontAwesomeIcon icon={faSearch} />
</button>
)}
</div>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const AgeColumnFilters = ({
>
<div
className='d-inline-block side-action cursor-pointer'
data-testid='StatusFilterButton'
data-testid='ageColumnFilter'
>
<FontAwesomeIcon
icon={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const FromColumnFilters = ({
>
<div
className='d-inline-block side-action cursor-pointer'
data-testid='StatusFilterButton'
data-testid='fromColumnFilter'
>
<FontAwesomeIcon
icon={sender !== undefined ? faFilterSolid : faFilter}
Expand Down
Loading

0 comments on commit 30cbbae

Please sign in to comment.