Skip to content

Commit

Permalink
Animate validators as they render (#790)
Browse files Browse the repository at this point in the history
  • Loading branch information
jessepinho authored Mar 18, 2024
1 parent 7cdd167 commit 9d59fa1
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 12 deletions.
3 changes: 2 additions & 1 deletion apps/minifront/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
"test": "vitest run"
},
"dependencies": {
"@penumbra-zone/bech32": "workspace:*",
"@penumbra-zone/client": "workspace:*",
"@penumbra-zone/constants": "workspace:*",
"@penumbra-zone/crypto-web": "workspace:*",
"@penumbra-zone/getters": "workspace:*",
"@penumbra-zone/bech32": "workspace:*",
"@penumbra-zone/perspective": "workspace:*",
"@penumbra-zone/transport-dom": "workspace:*",
"@penumbra-zone/types": "workspace:*",
Expand All @@ -25,6 +25,7 @@
"@tanstack/react-query": "^5.26.3",
"bignumber.js": "^9.1.2",
"date-fns": "^3.4.0",
"framer-motion": "^11.0.14",
"immer": "^10.0.4",
"lodash": "^4.17.21",
"react": "^18.2.0",
Expand Down
30 changes: 19 additions & 11 deletions apps/minifront/src/components/staking/account/delegations.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { AnimatePresence, motion } from 'framer-motion';
import { AllSlices } from '../../../state';
import { DelegationValueView } from './delegation-value-view';
import { ValueView } from '@buf/penumbra-zone_penumbra.bufbuild_es/penumbra/core/asset/v1/asset_pb';
Expand All @@ -23,17 +24,24 @@ export const Delegations = () => {

return (
<div className='mt-8 flex flex-col gap-8'>
{delegations.map(delegation => (
<DelegationValueView
key={bech32IdentityKey(getIdentityKeyFromValueView(delegation))}
valueView={delegation}
unstakedTokens={unstakedTokens}
votingPowerAsIntegerPercentage={getVotingPowerAsIntegerPercentage(
votingPowerByValidatorInfo,
delegation,
)}
/>
))}
<AnimatePresence>
{delegations.map(delegation => (
<motion.div
key={bech32IdentityKey(getIdentityKeyFromValueView(delegation))}
layout
className='bg-charcoal'
>
<DelegationValueView
valueView={delegation}
unstakedTokens={unstakedTokens}
votingPowerAsIntegerPercentage={getVotingPowerAsIntegerPercentage(
votingPowerByValidatorInfo,
delegation,
)}
/>
</motion.div>
))}
</AnimatePresence>
</div>
);
};
22 changes: 22 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 9d59fa1

Please sign in to comment.