Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(staking): add publisher account designation buttons #1892

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions apps/staking/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,23 @@ export const unstakeIntegrityStaking = async (
);
};

export const reassignPublisherAccount = async (
_client: PythStakingClient,
_stakeAccount: PublicKey,
_targetAccount: PublicKey,
): Promise<void> => {
await new Promise((resolve) => setTimeout(resolve, MOCK_DELAY));
throw new NotImplementedError();
};

export const optPublisherOut = async (
_client: PythStakingClient,
_stakeAccount: PublicKey,
): Promise<void> => {
await new Promise((resolve) => setTimeout(resolve, MOCK_DELAY));
throw new NotImplementedError();
};
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fyi on these two new api methods @keyvankhademi


export const getUpcomingEpoch = (): Date => {
const d = new Date();
d.setUTCDate(d.getUTCDate() + ((5 + 7 - d.getUTCDay()) % 7 || 7));
Expand Down
5 changes: 4 additions & 1 deletion apps/staking/src/components/Button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Link } from "../Link";

type VariantProps = {
variant?: "secondary" | undefined;
size?: "small" | "nopad" | undefined;
size?: "small" | "nopad" | "noshrink" | undefined;
};

type ButtonProps = Omit<ComponentProps<typeof ReactAriaButton>, "isDisabled"> &
Expand Down Expand Up @@ -77,6 +77,9 @@ const sizeClassName = (size: VariantProps["size"]) => {
case "nopad": {
return "px-0 py-0";
}
case "noshrink": {
return "px-8 py-2";
}
case undefined: {
return "px-2 sm:px-4 md:px-8 py-2";
}
Expand Down
21 changes: 18 additions & 3 deletions apps/staking/src/components/ModalDialog/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { XMarkIcon } from "@heroicons/react/24/outline";
import clsx from "clsx";
import type { ComponentProps, ReactNode } from "react";
import { Dialog, Heading, Modal, ModalOverlay } from "react-aria-components";

Expand All @@ -14,8 +15,9 @@ type ModalDialogProps = Omit<
"children"
> & {
closeDisabled?: boolean | undefined;
closeButtonText?: string;
title: ReactNode | ReactNode[];
description?: string;
description?: ReactNode;
children?:
| ((options: DialogRenderProps) => ReactNode | ReactNode[])
| ReactNode
Expand All @@ -25,6 +27,7 @@ type ModalDialogProps = Omit<

export const ModalDialog = ({
closeDisabled,
closeButtonText,
children,
title,
description,
Expand All @@ -37,7 +40,7 @@ export const ModalDialog = ({
{...props}
>
<Modal className="data-[entering]:duration-500 data-[exiting]:duration-300 data-[entering]:animate-in data-[exiting]:animate-out data-[entering]:zoom-in-90 data-[exiting]:zoom-out-110">
<Dialog className="relative border border-neutral-600/50 bg-[#100E21] px-6 pb-8 pt-12 focus:outline-none sm:px-10 sm:pb-12">
<Dialog className="relative mx-8 border border-neutral-600/50 bg-[#100E21] px-6 pb-8 pt-12 focus:outline-none sm:px-10 sm:pb-12">
{(options) => (
<>
<Button
Expand All @@ -48,13 +51,25 @@ export const ModalDialog = ({
>
<XMarkIcon className="size-6" />
</Button>
<Heading className="text-3xl font-light leading-6" slot="title">
<Heading
className={clsx("text-3xl font-light leading-6", {
"mb-10": description === undefined,
})}
slot="title"
>
{title}
</Heading>
{description && (
<p className="mb-10 mt-2 max-w-96 opacity-60">{description}</p>
)}
{typeof children === "function" ? children(options) : children}
{closeButtonText !== undefined && (
<div className="mt-14 flex flex-row justify-end">
<Button size="noshrink" onPress={options.close}>
{closeButtonText}
</Button>
</div>
)}
</>
)}
</Dialog>
Expand Down
Loading
Loading