Skip to content

Commit 91739da

Browse files
authored
Merge pull request #1925 from cprussin/mobile-fixes
feat(staking): improve mobile experience
2 parents 98ce859 + de48171 commit 91739da

File tree

8 files changed

+470
-325
lines changed

8 files changed

+470
-325
lines changed

apps/staking/src/components/AccountSummary/index.tsx

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -141,28 +141,23 @@ export const AccountSummary = ({
141141
className="xl:hidden"
142142
/>
143143
)}
144-
{api.type === ApiStateType.Loaded ? (
145-
<DialogTrigger>
146-
<Button variant="secondary" className="xl:hidden">
147-
Claim
148-
</Button>
149-
{availableRewards > 0n ? (
150-
<ClaimDialog
151-
expiringRewards={expiringRewards}
152-
availableRewards={availableRewards}
153-
api={api}
154-
/>
155-
) : (
156-
<ModalDialog title="No Rewards" closeButtonText="Ok">
157-
<p>You have no rewards available to be claimed</p>
158-
</ModalDialog>
159-
)}
160-
</DialogTrigger>
161-
) : (
162-
<Button variant="secondary" isDisabled={true} className="lg:hidden">
144+
<DialogTrigger>
145+
<Button variant="secondary" className="xl:hidden">
163146
Claim
164147
</Button>
165-
)}
148+
{availableRewards === 0n ||
149+
api.type === ApiStateType.LoadedNoStakeAccount ? (
150+
<ModalDialog title="No Rewards" closeButtonText="Ok">
151+
<p>You have no rewards available to be claimed</p>
152+
</ModalDialog>
153+
) : (
154+
<ClaimDialog
155+
expiringRewards={expiringRewards}
156+
availableRewards={availableRewards}
157+
api={api}
158+
/>
159+
)}
160+
</DialogTrigger>
166161
</div>
167162
</div>
168163
<div className="hidden w-auto items-stretch gap-4 xl:flex">

apps/staking/src/components/Button/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const LinkButton = ({
5353

5454
const baseClassName = (props: VariantProps) =>
5555
clsx(
56-
"border border-pythpurple-600 transition duration-100 hover:bg-pythpurple-600/60 focus:outline-none focus-visible:ring-1 focus-visible:ring-pythpurple-400",
56+
"border border-pythpurple-600 text-center transition duration-100 hover:bg-pythpurple-600/60 focus:outline-none focus-visible:ring-1 focus-visible:ring-pythpurple-400",
5757
variantClassName(props.variant),
5858
sizeClassName(props.size),
5959
);

apps/staking/src/components/CopyButton/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export const CopyButton = ({
5252
onPress={copy}
5353
isDisabled={isCopied}
5454
className={clsx(
55-
"group -mt-0.5 rounded-md px-2 py-0.5 align-middle transition hover:bg-white/10 focus:outline-none focus-visible:ring-1 focus-visible:ring-pythpurple-400",
55+
"group -mx-2 -mt-0.5 rounded-md px-2 py-0.5 align-middle transition hover:bg-white/10 focus:outline-none focus-visible:ring-1 focus-visible:ring-pythpurple-400",
5656
className,
5757
)}
5858
{...(isCopied && { "data-is-copied": true })}

apps/staking/src/components/Governance/index.tsx

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,24 @@ export const Governance = ({
2626
helpDialog={<GovernanceGuide />}
2727
tagline="Vote and Influence the Network"
2828
description="Pyth Governance lets the community influence the direction of the Pyth Network by voting on key proposals. By staking tokens, community members can gain a say in decisions that shape the network’s operations and development, ensuring Pyth Network evolves effectively and aligns with DeFi’s needs."
29-
currentEpoch={currentEpoch}
30-
available={availableToStake}
31-
warmup={warmup}
32-
staked={staked}
33-
cooldown={cooldown}
34-
cooldown2={cooldown2}
35-
stake={api.type === ApiStateType.Loaded ? api.stakeGovernance : undefined}
36-
stakeDescription="Stake funds to participate in governance votes"
37-
cancelWarmup={
38-
api.type === ApiStateType.Loaded ? api.cancelWarmupGovernance : undefined
39-
}
40-
cancelWarmupDescription="Cancel staking tokens for governance that are currently in warmup"
41-
unstake={
42-
api.type === ApiStateType.Loaded ? api.unstakeGovernance : undefined
43-
}
44-
unstakeDescription="Unstake tokens from the Governance program"
29+
tokenOverview={{
30+
currentEpoch,
31+
available: availableToStake,
32+
warmup,
33+
staked,
34+
cooldown,
35+
cooldown2,
36+
stake: api.type === ApiStateType.Loaded ? api.stakeGovernance : undefined,
37+
stakeDescription: "Stake funds to participate in governance votes",
38+
cancelWarmup:
39+
api.type === ApiStateType.Loaded
40+
? api.cancelWarmupGovernance
41+
: undefined,
42+
cancelWarmupDescription:
43+
"Cancel staking tokens for governance that are currently in warmup",
44+
unstake:
45+
api.type === ApiStateType.Loaded ? api.unstakeGovernance : undefined,
46+
unstakeDescription: "Unstake tokens from the Governance program",
47+
}}
4548
/>
4649
);

apps/staking/src/components/ModalDialog/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const ModalDialog = ({
3535
}: ModalDialogProps) => (
3636
<ModalOverlay
3737
isKeyboardDismissDisabled={closeDisabled === true}
38-
className="fixed left-0 top-0 z-50 h-[var(--visual-viewport-height)] w-screen overflow-y-auto bg-black/30 px-4 py-8 backdrop-blur data-[entering]:duration-300 data-[exiting]:duration-300 data-[entering]:animate-in data-[exiting]:animate-out data-[entering]:fade-in data-[exiting]:fade-out sm:px-8 sm:py-16"
38+
className="fixed left-0 top-0 z-50 h-[var(--visual-viewport-height)] w-screen overflow-y-auto bg-black/30 px-4 py-8 backdrop-blur data-[entering]:duration-300 data-[exiting]:duration-300 data-[entering]:animate-in data-[exiting]:animate-out data-[entering]:fade-in data-[exiting]:fade-out xs:py-16 sm:px-8 sm:py-32"
3939
isDismissable={!closeDisabled}
4040
{...props}
4141
>

0 commit comments

Comments
 (0)