Skip to content

Commit

Permalink
feat: vote help changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alter-eggo committed Jan 19, 2025
1 parent a73c470 commit deafb7f
Show file tree
Hide file tree
Showing 16 changed files with 385 additions and 26 deletions.
3 changes: 3 additions & 0 deletions apps/frontend-v3/app/(app)/debug/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ export default function Debug() {
<Link as={NextLink} href="/debug/permit2-allowance">
Permit2 allowance
</Link>
<Link as={NextLink} href="/debug/toast">
Toast
</Link>
</VStack>
</FadeInOnView>
)
Expand Down
43 changes: 43 additions & 0 deletions apps/frontend-v3/app/(app)/debug/toast/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
'use client'

import { Button, useToast, VStack } from '@chakra-ui/react'
import { useDisclosure } from '@chakra-ui/hooks'
import { StaticToast, StaticToastRenderProps } from '@repo/lib/shared/components/toasts/StaticToast'
import { useCurrentDate } from '@repo/lib/shared/hooks/date.hooks'
import { Toast } from '@repo/lib/shared/components/toasts/Toast'

function ToastRender({ id, title, isClosable, onClose }: StaticToastRenderProps) {
return <Toast id={id} isClosable={isClosable} onClose={onClose} title={title} />
}

const start = Date.now()

export default function Page() {
const { isOpen, onOpen, onClose } = useDisclosure()
const now = Number(useCurrentDate(100))

const showToast = useToast()

return (
<VStack width="full">
<StaticToast
isClosable
isOpen={isOpen}
onClose={onClose}
title={`Toast Text (${((now - start) / 1000).toFixed(1)})`}
>
{ToastRender}
</StaticToast>

<Button onClick={isOpen ? onClose : onOpen}>
{isOpen ? 'Close Static Toast' : 'Open Static Toast'}
</Button>

<Button
onClick={() => showToast({ title: 'Basic toast', render: props => <Toast {...props} /> })}
>
Show basic toast
</Button>
</VStack>
)
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 14 additions & 6 deletions packages/lib/modules/pool/PoolList/PoolListTokenPills.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@ function WeightedTokenPills({
tokens,
chain,
iconSize = 24,
nameSize,
...badgeProps
}: { tokens: PoolToken[]; chain: GqlChain; iconSize?: number } & BadgeProps) {
}: { tokens: PoolToken[]; chain: GqlChain; iconSize?: number; nameSize?: string } & BadgeProps) {
return (
<Wrap spacing="xs">
{tokens.map(token => {
Expand Down Expand Up @@ -75,7 +76,7 @@ function WeightedTokenPills({
/>
<HStack gap={['xs', '1.5']}>
{tokens.length < 5 && (
<Text fontWeight="bold" noOfLines={1}>
<Text fontWeight="bold" noOfLines={1} size={nameSize}>
{token.symbol}
</Text>
)}
Expand All @@ -91,7 +92,7 @@ function WeightedTokenPills({
nestedTokens={token.nestedPool.tokens}
/>
<HStack gap={['xs', '1.5']}>
<Text fontWeight="bold" noOfLines={1}>
<Text fontWeight="bold" noOfLines={1} size={nameSize}>
{token.name}
</Text>
<Text fontSize="xs">{fNum('weight', token.weight || '')}</Text>
Expand All @@ -110,8 +111,14 @@ function StableTokenPills({
tokens,
chain,
iconSize = 24,
nameSize,
...badgeProps
}: { tokens: PoolToken[]; chain: GqlChain; iconSize?: number } & BadgeProps) {
}: {
tokens: PoolToken[]
chain: GqlChain
iconSize?: number
nameSize?: string
} & BadgeProps) {
const isFirstToken = (index: number) => index === 0
const zIndices = Array.from({ length: tokens.length }, (_, index) => index).reverse()

Expand Down Expand Up @@ -144,7 +151,7 @@ function StableTokenPills({
size={iconSize}
/>
{tokens.length < 5 && (
<Text fontWeight="bold" noOfLines={1}>
<Text fontWeight="bold" noOfLines={1} size={nameSize}>
{token.symbol}
</Text>
)}
Expand All @@ -157,7 +164,7 @@ function StableTokenPills({
iconSize={iconSize}
nestedTokens={token.nestedPool.tokens}
/>
<Text fontWeight="bold" noOfLines={1}>
<Text fontWeight="bold" noOfLines={1} size={nameSize}>
{token.name}
</Text>
</>
Expand All @@ -173,6 +180,7 @@ function StableTokenPills({
type VotingListTokenPillsProps = {
vote: VotingPoolWithData
iconSize?: number
nameSize?: string
} & BadgeProps
export function VotingListTokenPills({ vote, ...props }: VotingListTokenPillsProps) {
const tokens = vote.tokens.map(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export type StepType =
| 'stakeLst'
| 'unstakeLst'
| 'withdrawLst'
| 'voteForManyGauges'

export type TxActionId =
| 'SignBatchRelayer'
Expand Down
65 changes: 65 additions & 0 deletions packages/lib/modules/vebal/vote/my-votes/MyVotesHintModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
'use client'

import { SuccessOverlay } from '@repo/lib/shared/components/modals/SuccessOverlay'
import {
Modal,
ModalContent,
ModalCloseButton,
ModalBody,
Box,
ModalHeader,
VStack,
Image,
} from '@chakra-ui/react'
import { UseDisclosureProps } from '@chakra-ui/hooks'

// eslint-disable-next-line @typescript-eslint/no-empty-function
export function MyVotesHintModal({ isOpen = false, onClose = () => {} }: UseDisclosureProps) {
return (
<Modal isCentered isOpen={isOpen} onClose={onClose} size="lg">
<SuccessOverlay />
<ModalContent>
<ModalHeader>How it works</ModalHeader>
<ModalCloseButton />
<ModalBody pb="lg">
<VStack gap="lg">
<Image
alt="How it works"
objectFit="cover"
rounded="md"
shadow="md"
src="/images/votes/how-it-works-bg.png"
/>
<Box as="ul" color="font.primary" listStylePosition="outside" pl="lg">
<li>
Your vote directs liquidity mining emissions for the future periods starting next
Thursday at 0:00 UTC.
</li>
<li>
There are vote incentives offered by 3rd parties (also known as bribes). If you vote
on pools with bribes, you can claim these bribes on third party platforms like
Hidden Hand and Paladin.
</li>
<li>
You can vote on multiple pools in a single transaction. Simply add multiple pools to
your vote list.
</li>
<li>
Votes are timelocked for 10 days. If you vote now, no edits can be made until 8
September 2024.
</li>
<li>
Voting power is set at the time of a vote. If you get more veBAL later, resubmit
your vote to use your increased power.
</li>
<li>
After you get veBAL, it can be synced to supported L2 networks to boost BAL
liquidity incentives on eligible pools.
</li>
</Box>
</VStack>
</ModalBody>
</ModalContent>
</Modal>
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -1013,4 +1013,4 @@ export const LiquidityGaugeV5Abi = [
},
],
},
]
] as const
13 changes: 11 additions & 2 deletions packages/lib/shared/components/icons/AlertIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
/* eslint-disable max-len */
export function AlertIcon() {
import { SVGProps } from 'react'

export function AlertIcon(props: SVGProps<SVGSVGElement>) {
return (
<svg fill="none" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg">
<svg
fill="none"
height="24"
viewBox="0 0 24 24"
width="24"
xmlns="http://www.w3.org/2000/svg"
{...props}
>
<path
d="M10.7409 3.8602L2.27095 18.0002C2.09632 18.3026 2.00392 18.6455 2.00294 18.9947C2.00196 19.3439 2.09244 19.6873 2.26538 19.9907C2.43831 20.2941 2.68767 20.547 2.98866 20.7241C3.28964 20.9012 3.63175 20.9964 3.98095 21.0002H20.9209C21.2701 20.9964 21.6123 20.9012 21.9132 20.7241C22.2142 20.547 22.4636 20.2941 22.6365 19.9907C22.8095 19.6873 22.8999 19.3439 22.899 18.9947C22.898 18.6455 22.8056 18.3026 22.6309 18.0002L14.1609 3.8602C13.9827 3.56631 13.7317 3.32332 13.4321 3.15469C13.1326 2.98605 12.7947 2.89746 12.4509 2.89746C12.1072 2.89746 11.7693 2.98605 11.4698 3.15469C11.1702 3.32332 10.9192 3.56631 10.7409 3.8602Z"
stroke="currentColor"
Expand Down
96 changes: 96 additions & 0 deletions packages/lib/shared/components/icons/BatteryChargeIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import { SVGProps } from 'react'

interface Props extends SVGProps<SVGSVGElement> {
percentage: number
}

export function BatteryChargeIcon({ percentage, ...props }: Props) {
const colors = {
1: '#F48975',
2: '#FDBA74',
3: '#25E2A4',
4: '#25E2A4',
}

function getCount() {
if (percentage >= 90) {
return 4
}
if (percentage >= 75) {
return 3
}
if (percentage >= 50) {
return 2
}
return 1
}

const count = getCount()

return (
<svg
color={colors[count]}
fill="none"
height="28"
viewBox="0 0 28 28"
width="28"
xmlns="http://www.w3.org/2000/svg"
{...props}
>
<g clipPath="url(#clip0_620_3003)">
<path
d="M7.0013 8.16406H19.8346C20.4535 8.16406 21.047 8.4099 21.4845 8.84748C21.9221 9.28506 22.168 9.87856 22.168 10.4974V11.0807C22.168 11.2354 22.2294 11.3838 22.3388 11.4932C22.4482 11.6026 22.5966 11.6641 22.7513 11.6641C22.906 11.6641 23.0544 11.7255 23.1638 11.8349C23.2732 11.9443 23.3346 12.0927 23.3346 12.2474V15.7474C23.3346 15.9021 23.2732 16.0505 23.1638 16.1599C23.0544 16.2693 22.906 16.3307 22.7513 16.3307C22.5966 16.3307 22.4482 16.3922 22.3388 16.5016C22.2294 16.611 22.168 16.7594 22.168 16.9141V17.4974C22.168 18.1162 21.9221 18.7097 21.4845 19.1473C21.047 19.5849 20.4535 19.8307 19.8346 19.8307H7.0013C6.38246 19.8307 5.78897 19.5849 5.35139 19.1473C4.9138 18.7097 4.66797 18.1162 4.66797 17.4974V10.4974C4.66797 9.87856 4.9138 9.28506 5.35139 8.84748C5.78897 8.4099 6.38246 8.16406 7.0013 8.16406Z"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>

{count > 0 && (
<path
d="M8.16797 11.6641V16.3307"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
)}

{count > 1 && (
<path
d="M11.668 11.6641V16.3307"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
)}

{count > 2 && (
<path
d="M15.168 11.6641V16.3307"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
)}

{count > 3 && (
<path
d="M18.668 11.6641V16.3307"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.5"
/>
)}
</g>
<defs>
<clipPath id="clip0_620_3003">
<rect fill="white" height="28" rx="14" width="28" />
</clipPath>
</defs>
</svg>
)
}
50 changes: 50 additions & 0 deletions packages/lib/shared/components/icons/MagicStickIcon.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { SVGProps } from 'react'

export function MagicStickIcon(props: SVGProps<SVGSVGElement>) {
return (
<svg
fill="none"
height="16"
viewBox="0 0 16 16"
width="16"
xmlns="http://www.w3.org/2000/svg"
{...props}
>
<g clipPath="url(#clip0_339_6358)">
<path
d="M4 14L14 4L12 2L2 12L4 14Z"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.33333"
/>
<path
d="M10 4L12 6"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.33333"
/>
<path
d="M5.9974 2C5.9974 2.35362 6.13787 2.69276 6.38792 2.94281C6.63797 3.19286 6.97711 3.33333 7.33073 3.33333C6.97711 3.33333 6.63797 3.47381 6.38792 3.72386C6.13787 3.97391 5.9974 4.31304 5.9974 4.66667C5.9974 4.31304 5.85692 3.97391 5.60687 3.72386C5.35682 3.47381 5.01768 3.33333 4.66406 3.33333C5.01768 3.33333 5.35682 3.19286 5.60687 2.94281C5.85692 2.69276 5.9974 2.35362 5.9974 2Z"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.33333"
/>
<path
d="M12.6654 8.66797C12.6654 9.02159 12.8058 9.36073 13.0559 9.61078C13.3059 9.86083 13.6451 10.0013 13.9987 10.0013C13.6451 10.0013 13.3059 10.1418 13.0559 10.3918C12.8058 10.6419 12.6654 10.981 12.6654 11.3346C12.6654 10.981 12.5249 10.6419 12.2748 10.3918C12.0248 10.1418 11.6857 10.0013 11.332 10.0013C11.6857 10.0013 12.0248 9.86083 12.2748 9.61078C12.5249 9.36073 12.6654 9.02159 12.6654 8.66797Z"
stroke="currentColor"
strokeLinecap="round"
strokeLinejoin="round"
strokeWidth="1.33333"
/>
</g>
<defs>
<clipPath id="clip0_339_6358">
<rect fill="white" height="16" width="16" />
</clipPath>
</defs>
</svg>
)
}
Loading

0 comments on commit deafb7f

Please sign in to comment.