"use client"; import clsx from "clsx"; import { useSelectedLayoutSegment } from "next/navigation"; import { type HTMLProps } from "react"; import { VPN_BLOCKED_SEGMENT } from "../../config/isomorphic"; import { StateType as ApiStateType, useApi } from "../../hooks/use-api"; import { CopyButton } from "../CopyButton"; import { TruncatedKey } from "../TruncatedKey"; export const CurrentStakeAccount = ({ className, ...props }: HTMLProps) => { const segment = useSelectedLayoutSegment(); const isBlocked = segment === VPN_BLOCKED_SEGMENT; const api = useApi(); return api.type === ApiStateType.Loaded && !isBlocked ? (
Stake account:
{api.account}
) : // eslint-disable-next-line unicorn/no-null null; };