-
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.
- Loading branch information
1 parent
d9b6216
commit cd6b136
Showing
10 changed files
with
108 additions
and
15 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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
|
@@ -13,7 +13,7 @@ body:before { | |
top: 0; | ||
left: 0; | ||
right: 0; | ||
height: 100vh; | ||
min-height: 100%; | ||
} | ||
|
||
code { | ||
|
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,42 @@ | ||
import { mockImplicitAccount } from "@umami/core"; | ||
import { type UmamiStore, accountsActions, addTestAccount, makeStore } from "@umami/state"; | ||
|
||
import { Earn } from "./Earn"; | ||
import { render, screen } from "../../testUtils"; | ||
|
||
let store: UmamiStore; | ||
|
||
const account = mockImplicitAccount(0); | ||
|
||
beforeEach(() => { | ||
store = makeStore(); | ||
addTestAccount(store, account); | ||
store.dispatch(accountsActions.setCurrent(account.address.pkh)); | ||
}); | ||
|
||
describe("<Earn />", () => { | ||
it("renders correctly if user is verified", () => { | ||
render(<Earn />, { store }); | ||
|
||
const link = screen.getByRole("link", { name: "Start Earning" }); | ||
|
||
expect(screen.getByText("Boost your rewards")).toBeInTheDocument(); | ||
expect( | ||
screen.getByText("Maximize your tez with staking.com. Secure, efficient, and simple.") | ||
).toBeInTheDocument(); | ||
expect(link).toBeInTheDocument(); | ||
expect(link).toHaveAttribute("href", "https://stake.tezos.com/"); | ||
}); | ||
|
||
it("renders empty message if user is not verified", () => { | ||
store.dispatch( | ||
accountsActions.setIsVerified({ | ||
isVerified: false, | ||
pkh: account.address.pkh, | ||
}) | ||
); | ||
render(<Earn />, { store }); | ||
|
||
expect(screen.getByTestId("empty-state-message")).toBeInTheDocument(); | ||
}); | ||
}); |
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 |
---|---|---|
@@ -1 +1,30 @@ | ||
export const Earn = () => <div>"earn"</div>; | ||
import { Flex } from "@chakra-ui/react"; | ||
|
||
import { EmptyMessage } from "../../components/EmptyMessage"; | ||
import { useIsAccountVerified } from "../../components/Onboarding/VerificationFlow"; | ||
import { VerifyMessage } from "../../components/Onboarding/VerificationFlow/VerifyMessage"; | ||
import { ViewOverlay } from "../../components/ViewOverlay/ViewOverlay"; | ||
|
||
export const Earn = () => { | ||
const isVerified = useIsAccountVerified(); | ||
|
||
const buyTezUrl = "https://stake.tezos.com/"; | ||
|
||
return ( | ||
<> | ||
<Flex zIndex={1} flexGrow={1} width="full"> | ||
{isVerified ? ( | ||
<EmptyMessage | ||
cta="Start Earning" | ||
ctaUrl={buyTezUrl} | ||
subtitle={"Maximize your tez with staking.com.\nSecure, efficient, and simple."} | ||
title="Boost your rewards" | ||
/> | ||
) : ( | ||
<VerifyMessage /> | ||
)} | ||
</Flex> | ||
<ViewOverlay iconType="earn" /> | ||
</> | ||
); | ||
}; |