import { ArrowLongDownIcon } from "@heroicons/react/24/outline"; import { epochToDate } from "@pythnetwork/staking-sdk"; import clsx from "clsx"; import type { HTMLAttributes, ReactNode, ComponentProps } from "react"; import { DialogTrigger } from "react-aria-components"; import { Button } from "../Button"; import { Date } from "../Date"; import { ModalDialog } from "../ModalDialog"; import { StakingTimeline } from "../StakingTimeline"; import { Tokens } from "../Tokens"; import { TransferButton } from "../TransferButton"; type Props = HTMLAttributes & { name: string; helpDialog: ReactNode; description: ReactNode; tagline: ReactNode; collapseTokenOverview?: boolean | undefined; tokenOverview: TokenOverviewProps; }; export const ProgramSection = ({ name, className, helpDialog, description, tagline, children, tokenOverview, collapseTokenOverview, ...props }: Props) => (

{name}

{tagline}
{helpDialog}
{description}
{collapseTokenOverview && ( )} {children}
); type TokenOverviewProps = Omit, "children"> & { currentEpoch: bigint; warmup: bigint; staked: bigint; cooldown: bigint; cooldown2: bigint; available: bigint; availableToStakeDetails?: ReactNode | ReactNode[] | undefined; } & ( | { stake?: never; stakeDescription?: never } | { stake: ComponentProps["transfer"] | undefined; stakeDescription: string; } ) & ( | { cancelWarmup?: never; cancelWarmupDescription?: never } | { cancelWarmup: | ComponentProps["transfer"] | undefined; cancelWarmupDescription: string; } ) & ( | { unstake?: never; unstakeDescription?: never } | { unstake: ComponentProps["transfer"] | undefined; unstakeDescription: string; } ); const TokenOverview = ({ className, currentEpoch, warmup, staked, cooldown, cooldown2, availableToStakeDetails, stake, stakeDescription, available, cancelWarmup, cancelWarmupDescription, unstake, unstakeDescription, ...props }: TokenOverviewProps) => (
), })} > {available} 0n && { details: (
Staking {epochToDate(currentEpoch + 1n)}
), })} {...(cancelWarmupDescription !== undefined && { actions: ( ), })} > {warmup}
), })} > {staked} {cooldown > 0n && (
{cooldown} end{" "} {epochToDate(currentEpoch + 2n)}
)} {cooldown2 > 0n && (
{cooldown2} end{" "} {epochToDate(currentEpoch + 1n)}
)} } > {cooldown + cooldown2}
); type PositionProps = { name: string; nameClassName?: string | undefined; className?: string | undefined; children: bigint; actions?: ReactNode | ReactNode[]; details?: ReactNode; }; const Position = ({ name, nameClassName, details, className, children, actions, }: PositionProps) => (
{name}
{children}
{details}
{actions &&
{actions}
}
); const Arrow = () => (
);