Skip to content

Commit

Permalink
Animate stake pool list reordering
Browse files Browse the repository at this point in the history
  • Loading branch information
darko-mijic committed Jul 1, 2020
1 parent eda6126 commit ed4ea23
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 25 deletions.
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -213,6 +213,7 @@
"react-custom-scrollbars": "4.2.1",
"react-datetime": "2.16.3",
"react-dom": "16.13.1",
"react-flip-move": "3.0.4",
"react-intl": "2.7.2",
"react-lottie": "1.2.3",
"react-markdown": "4.3.1",
Expand Down
1 change: 1 addition & 0 deletions source/renderer/app/api/api.js
Expand Up @@ -1536,6 +1536,7 @@ export default class AdaApi {
stakePoolsWithMetadata: stakePools.length,
unfilteredStakePools: response,
});
console.log(`Stake pools loaded, stek: ${stake}`);
return stakePools;
} catch (error) {
logger.error('AdaApi::getStakePools error', { error });
Expand Down
Expand Up @@ -6,6 +6,7 @@ import classNames from 'classnames';
import styles from './StakePoolsList.scss';
import StakePool from '../../../domains/StakePool';
import { StakePoolThumbnail } from './StakePoolThumbnail';
import FlipMove from 'react-flip-move';

type Props = {
stakePoolsList: Array<StakePool>,
Expand Down Expand Up @@ -109,30 +110,33 @@ export class StakePoolsList extends Component<Props, State> {

return (
<div className={componentClasses}>
{stakePoolsList.map(stakePool => {
const isHighlighted = this.getIsHighlighted(stakePool.id);
const isSelected = selectedPoolId && stakePool.id === selectedPoolId;

return (
<StakePoolThumbnail
stakePool={stakePool}
key={stakePool.id + stakePool.ranking}
onOpenExternalLink={onOpenExternalLink}
isHighlighted={isHighlighted}
onClose={this.handleClose}
onClick={!highlightOnHover && this.handleOpenThumbnail}
onHover={highlightOnHover && this.handleOpenThumbnail}
onSelect={this.handleSelect}
showWithSelectButton={showWithSelectButton}
currentTheme={currentTheme}
isSelected={isSelected}
showSelected={showSelected}
containerClassName={containerClassName}
numberOfStakePools={numberOfStakePools}
disabledStakePoolId={disabledStakePoolId}
/>
);
})}
<FlipMove>
{stakePoolsList.map(stakePool => {
const isHighlighted = this.getIsHighlighted(stakePool.id);
const isSelected =
selectedPoolId && stakePool.id === selectedPoolId;

return (
<StakePoolThumbnail
stakePool={stakePool}
key={stakePool.id + stakePool.ranking}
onOpenExternalLink={onOpenExternalLink}
isHighlighted={isHighlighted}
onClose={this.handleClose}
onClick={!highlightOnHover && this.handleOpenThumbnail}
onHover={highlightOnHover && this.handleOpenThumbnail}
onSelect={this.handleSelect}
showWithSelectButton={showWithSelectButton}
currentTheme={currentTheme}
isSelected={isSelected}
showSelected={showSelected}
containerClassName={containerClassName}
numberOfStakePools={numberOfStakePools}
disabledStakePoolId={disabledStakePoolId}
/>
);
})}
</FlipMove>
</div>
);
}
Expand Down
@@ -1,4 +1,4 @@
.component {
.component > div {
display: grid;
grid-gap: 10px;
grid-template-columns: repeat(auto-fill, 80px);
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Expand Up @@ -11494,6 +11494,11 @@ react-fast-compare@^3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/react-fast-compare/-/react-fast-compare-3.0.1.tgz#884d339ce1341aad22392e7a88664c71da48600e"

react-flip-move@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/react-flip-move/-/react-flip-move-3.0.4.tgz#261f66101fbc305f9b7b28959c5cf8236413ca74"
integrity sha512-HyUVv9g3t/BS7Yz9HgrtYSWyRNdR2F81nkj+C5iRY675AwlqCLB5JU9mnZWg0cdVz7IM4iquoyZx70vzZv3Z8Q==

react-focus-lock@^2.1.0:
version "2.3.1"
resolved "https://registry.yarnpkg.com/react-focus-lock/-/react-focus-lock-2.3.1.tgz#9d5d85899773609c7eefa4fc54fff6a0f5f2fc47"
Expand Down

0 comments on commit ed4ea23

Please sign in to comment.