-
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 df12b46
Showing
16 changed files
with
134 additions
and
32 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,43 @@ | ||
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(); | ||
|
||
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 || "No header available"} | ||
</Heading> | ||
<AccordionIcon /> | ||
</AccordionButton> | ||
</h2> | ||
<AccordionPanel padding="16px"> | ||
{Hints[signPage].description || "No description available."} | ||
</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,53 @@ | ||
import { type SignPage } from "./Titles"; | ||
|
||
type HintData = { | ||
header?: string; | ||
description?: string; | ||
}; | ||
const basicOperationHeader = | ||
"A confirmation takes 1 block (8 seconds). The transaction becomes final and irreversible after 2 blocks (16 seconds)."; | ||
const basicOperationDescription = | ||
"A confirmation means that the block is confirmed by the network but the operation can still be cancelled due to chain reorganizations. Finality means that the operation is irreversible."; | ||
|
||
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 4 cycles (~6 days) to start receiving delegation rewards.", | ||
description: | ||
"Bakers usually distribute delegation rewards every cycle (~2.8 days). Ensure that the delegation fee offered by the baker is less than 100%; otherwise, you might not receive rewards. Delegation means that all your funds are delegated to one baker. The funds are still spendable, and you can cancel or change the delegation at any time.", | ||
}, | ||
UndelegationSignPage: { | ||
header: | ||
"Immediately stops delegation and initiates unstaking. Restoring delegation rewards takes 4 cycles (~10 days). After 4 cycles (~10 days), unstaked tez can be finalized and made avaialable", | ||
description: | ||
"Undelegation takes effect immediately, and you will stop accruing staking rewards. However, delegation rewards for the current and the next 2 cycles will still be received, as baking rights are computed 2 cycles in advance. By undelegating, you also initiate the unstaking process if you have staked. The unstaking process takes approximately 4 cycles (~10 days) to unlock your staked funds, making them finalizable. Once finalized, the funds will be returned to your balance. You will receive delegation rewards for finalizable funds.", | ||
}, | ||
StakeSignPage: { | ||
header: | ||
"Your balance will be reduced by the staked amount. You will start receiving rewards within 1 cycle (~3 days) max.", | ||
description: | ||
"When you stake, the chosen amount is automatically deducted from your available balance. Rewards are added to your staked balance automatically every time your chosen baker produces a new block and at the end of each cycle (every ~3 days). If you decide to cancel staking, it will take approximately 4 cycles (~10 days) to unlock your staked funds, making them finalizable. Once finalized, the funds will be returned to your balance. You will receive delegation rewards for finalizable funds.", | ||
}, | ||
UnstakeSignPage: { | ||
header: "Unstaking takes at least 4 cycles (~10 days) to complete.", | ||
description: | ||
"During this time, your funds are locked, and you will not receive staking rewards. After 4 cycles, your staked funds become finalizable. Once finalized, the funds will be returned to your balance. You will receive delegation rewards for finalizable funds.", | ||
}, | ||
FinalizeUnstakeSignPage: { | ||
header: | ||
"Finalizing unstake takes 1 block (8 seconds) to complete and applies to all finalizable funds in your balance.", | ||
description: | ||
"Once finalized, your funds are returned to your balance, allowing you to spend them or stake them again to earn rewards. Delegation rewards for these funds will stop once they are finalized.", | ||
}, | ||
}; |
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