-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: hints in modals for Beacon and WC
- Loading branch information
1 parent
e5b5a6c
commit 9ca413e
Showing
16 changed files
with
134 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { | ||
Accordion, | ||
AccordionButton, | ||
AccordionIcon, | ||
AccordionItem, | ||
AccordionPanel, | ||
Heading, | ||
} from "@chakra-ui/react"; | ||
import { Hints, type SignPage } from "@umami/core"; | ||
|
||
import { useColor } from "../../styles/useColor"; | ||
|
||
type HintsProps = { | ||
signPage: SignPage; | ||
}; | ||
|
||
export const HintsAccordion = ({ signPage }: HintsProps) => { | ||
const color = useColor(); | ||
|
||
if (!Hints[signPage].header || !Hints[signPage].description) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Accordion | ||
width="full" | ||
marginTop="16px" | ||
marginBottom="16px" | ||
allowToggle | ||
data-testid="hints-accordion" | ||
> | ||
<AccordionItem border="none" borderRadius="8px" backgroundColor={color("100")}> | ||
<h2> | ||
<AccordionButton padding="12px" borderRadius="8px"> | ||
<Heading flex="1" textAlign="left" size="md"> | ||
{Hints[signPage].header} | ||
</Heading> | ||
<AccordionIcon /> | ||
</AccordionButton> | ||
</h2> | ||
<AccordionPanel padding="16px">{Hints[signPage].description}</AccordionPanel> | ||
</AccordionItem> | ||
</Accordion> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./HintsAccordion"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { type SignPage } from "./Titles"; | ||
|
||
type HintData = { | ||
header?: string; | ||
description?: string; | ||
}; | ||
const basicOperationHeader = undefined; | ||
const basicOperationDescription = undefined; | ||
|
||
const finalizationConsequences = | ||
"Finalized funds are returned to your balance, allowing you to spend them or stake them again to earn rewards. Delegation rewards for these funds stop once they are finalized."; | ||
const unstakingConsequences = `The unstaking process takes 4 cycles (~10 days) to unlock your staked funds, making them finalizable on request. You will receive delegation rewards for finalizable funds. ${finalizationConsequences}`; | ||
|
||
export const Hints: Record<SignPage, HintData> = { | ||
TezSignPage: { | ||
header: basicOperationHeader, | ||
description: basicOperationDescription, | ||
}, | ||
OriginationOperationSignPage: { | ||
header: basicOperationHeader, | ||
description: basicOperationDescription, | ||
}, | ||
ContractCallSignPage: { | ||
header: basicOperationHeader, | ||
description: basicOperationDescription, | ||
}, | ||
DelegationSignPage: { | ||
header: "It takes 2 cycles (~6 days) to start receiving delegation rewards.", | ||
description: | ||
"Bakers typically distribute delegation rewards every cycle (~3 days). Ensure the delegation fee offered by the baker is less than 100%; otherwise, you may not receive rewards. Delegation means that all your funds are delegated to one baker. The funds remain spendable, and you can cancel or change the delegation at any time.", | ||
}, | ||
UndelegationSignPage: { | ||
header: "Stops both delegation and staking. Restoring rewards takes 2 cycles (~6 days).", | ||
description: `Undelegation takes effect immediately. However, you will still receive delegation rewards for the current and the next 2 cycles, as baking rights are computed 2 cycles in advance. By undelegating, you also initiate the unstaking process if you have staked. ${unstakingConsequences}`, | ||
}, | ||
StakeSignPage: { | ||
header: "You will start receiving rewards within 1 cycle (~3 days).", | ||
description: `Your spendable balance will be reduced by the amount staked. You will start accruing staking rewards within 1 cycle (~3 days). Staking rewards are compounded on your staked balance. You can cancel staking any time. ${unstakingConsequences}`, | ||
}, | ||
UnstakeSignPage: { | ||
header: "Takes at least 4 cycles (~10 days) to complete.", | ||
description: unstakingConsequences, | ||
}, | ||
FinalizeUnstakeSignPage: { | ||
header: "Takes 1 block (8 seconds) to complete.", | ||
description: `Finalizing applies to all finalizable funds in your balance. ${finalizationConsequences}`, | ||
}, | ||
}; |
1 change: 1 addition & 0 deletions
1
apps/web/src/components/Titles/Titles.tsx → packages/core/src/Titles.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9ca413e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.