Skip to content

Commit

Permalink
UI minor fixes (#2186)
Browse files Browse the repository at this point in the history
  • Loading branch information
OKendigelyan authored Dec 19, 2024
1 parent d78b863 commit af5badf
Show file tree
Hide file tree
Showing 11 changed files with 81 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {
Box,
Button,
Center,
Divider,
Expand Down Expand Up @@ -129,7 +130,7 @@ export const AccountSelectorModal = () => {
<VStack
overflowY="auto"
width="100%"
maxHeight="400px"
maxHeight="430px"
divider={<Divider _last={{ display: "none" }} />}
spacing="18px"
>
Expand Down Expand Up @@ -188,26 +189,43 @@ export const AccountSelectorModal = () => {
))}

{/* This is a hack to toggle the shadow on the footer button*/}
<div ref={lastItemRef} />
<Box ref={lastItemRef} paddingBottom="40px" />
</VStack>
</ModalBody>
<ModalFooter
padding="8px"
borderRadius="30px"
boxShadow={
showShadow
? color(
"0px -4px 10px 0px rgba(45, 55, 72, 0.10)",
"0px -4px 10px 0px rgba(0, 0, 0, 0.20)"
)
: "transparent"
}
transition="box-shadow 0.2s ease-in"
position="relative"
height="23px"
margin="0"
paddingX={{ base: "32px", md: "42px" }}
>
{isVerified && (
<Button width="full" onClick={() => openWith(<OnboardOptionsModal />)} variant="primary">
Add Account
</Button>
<Flex
position="absolute"
top="-25px"
justifyContent="center"
width="full"
padding="8px"
background="white"
borderRadius="100px"
boxShadow={
showShadow
? color(
"0px -4px 10px 0px rgba(45, 55, 72, 0.10)",
"0px -4px 10px 0px rgba(0, 0, 0, 0.20)"
)
: "transparent"
}
transition="box-shadow 0.2s ease-in"
backdropFilter="blur(40px)"
>
<Button
width="full"
onClick={() => openWith(<OnboardOptionsModal />)}
variant="primary"
>
Add Account
</Button>
</Flex>
)}
</ModalFooter>
</ModalContent>
Expand Down
7 changes: 5 additions & 2 deletions apps/web/src/components/AddressTile/AddressTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ import { CopyAddressButton } from "../CopyAddressButton";
export const AddressTile = ({
size = "sm",
address,
hideBalance = false,
...flexProps
}: { address: Address; size?: "xs" | "sm" } & FlexProps) => {
}: { address: Address; size?: "xs" | "sm"; hideBalance?: boolean } & FlexProps) => {
const addressKind = useAddressKind(address);
const color = useColor();

Expand Down Expand Up @@ -71,7 +72,9 @@ export const AddressTile = ({
isLong={addressKind.type === "unknown"}
variant={isSmall ? "unstyled" : "ghost"}
/>
<Text size="sm">{balance !== undefined && prettyTezAmount(balance)}</Text>
{!hideBalance && (
<Text size="sm">{balance !== undefined && prettyTezAmount(balance)}</Text>
)}
</Flex>
</Flex>
</Flex>
Expand Down
5 changes: 5 additions & 0 deletions apps/web/src/components/SendFlow/NFT/FormPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ jest.mock("@umami/core", () => ({
estimate: jest.fn(),
}));

jest.mock("@chakra-ui/react", () => ({
...jest.requireActual("@chakra-ui/react"),
useBreakpointValue: jest.fn(),
}));

const sender = mockImplicitAccount(0);
const nft = mockNFTBalance(1, { balance: "1" });

Expand Down
5 changes: 5 additions & 0 deletions apps/web/src/components/SendFlow/NFT/SignPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ import { TEZ, parseContractPkh } from "@umami/tezos";
import { SignPage } from "./SignPage";
import { renderInModal, screen, waitFor } from "../../../testUtils";

jest.mock("@chakra-ui/react", () => ({
...jest.requireActual("@chakra-ui/react"),
useBreakpointValue: jest.fn(),
}));

let store: UmamiStore;

beforeEach(() => {
Expand Down
6 changes: 4 additions & 2 deletions apps/web/src/components/SendFlow/NFT/SignPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
ModalFooter,
Text,
VStack,
useBreakpointValue,
} from "@chakra-ui/react";
import { type EstimatedAccountOperations, type FA2Transfer, type NFTBalance } from "@umami/core";
import { FormProvider } from "react-hook-form";
Expand All @@ -27,6 +28,7 @@ export const SignPage = (props: { nft: NFTBalance; operations: EstimatedAccountO
const { fee, operations, estimationFailed, isLoading, form, signer, onSign } =
useSignPageHelpers(initialOperations);
const color = useColor();
const hideBalance = useBreakpointValue({ base: true, md: false });

const { recipient, amount } = operations.operations[0] as FA2Transfer;

Expand All @@ -52,11 +54,11 @@ export const SignPage = (props: { nft: NFTBalance; operations: EstimatedAccountO
<Divider />
<FormControl>
<FormLabel>From</FormLabel>
<AddressTile address={operations.sender.address} />
<AddressTile address={operations.sender.address} hideBalance={hideBalance} />
</FormControl>
<FormControl>
<FormLabel>To</FormLabel>
<AddressTile address={recipient} />
<AddressTile address={recipient} hideBalance={hideBalance} />
</FormControl>
</VStack>
</ModalBody>
Expand Down
5 changes: 5 additions & 0 deletions apps/web/src/components/SendFlow/Tez/FormPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ jest.mock("@umami/core", () => ({
estimate: jest.fn(),
}));

jest.mock("@chakra-ui/react", () => ({
...jest.requireActual("@chakra-ui/react"),
useBreakpointValue: jest.fn(),
}));

let store: UmamiStore;

beforeEach(() => {
Expand Down
5 changes: 5 additions & 0 deletions apps/web/src/components/SendFlow/Tez/SignPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ import { SignPage } from "./SignPage";
import { render, screen, waitFor } from "../../../testUtils";
import { type SignPageProps } from "../utils";

jest.mock("@chakra-ui/react", () => ({
...jest.requireActual("@chakra-ui/react"),
useBreakpointValue: jest.fn(),
}));

const fixture = (props: SignPageProps) => (
<Modal isOpen={true} onClose={() => {}}>
<SignPage {...props} />
Expand Down
6 changes: 4 additions & 2 deletions apps/web/src/components/SendFlow/Tez/SignPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
ModalBody,
ModalContent,
ModalFooter,
useBreakpointValue,
} from "@chakra-ui/react";
import { type TezTransfer } from "@umami/core";
import { FormProvider } from "react-hook-form";
Expand All @@ -21,6 +22,7 @@ export const SignPage = (props: SignPageProps) => {
const { operations: initialOperations } = props;
const { fee, operations, estimationFailed, isLoading, form, signer, onSign } =
useSignPageHelpers(initialOperations);
const hideBalance = useBreakpointValue({ base: true, md: false });

const { amount: mutezAmount, recipient } = operations.operations[0] as TezTransfer;

Expand All @@ -39,11 +41,11 @@ export const SignPage = (props: SignPageProps) => {
</FormControl>
<FormControl>
<FormLabel width="full">From</FormLabel>
<AddressTile address={operations.sender.address} />
<AddressTile address={operations.sender.address} hideBalance={hideBalance} />
</FormControl>
<FormControl>
<FormLabel width="full">To</FormLabel>
<AddressTile address={recipient} />
<AddressTile address={recipient} hideBalance={hideBalance} />
</FormControl>
<AdvancedSettingsAccordion />
</ModalBody>
Expand Down
5 changes: 5 additions & 0 deletions apps/web/src/components/SendFlow/Token/FormPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ jest.mock("@umami/core", () => ({
estimate: jest.fn(),
}));

jest.mock("@chakra-ui/react", () => ({
...jest.requireActual("@chakra-ui/react"),
useBreakpointValue: jest.fn(),
}));

const mockAccount = mockMnemonicAccount(0);
const mockTokenRaw = mockFA2TokenRaw(0, mockAccount.address.pkh);
const mockToken = mockFA2Token(0, mockAccount);
Expand Down
5 changes: 5 additions & 0 deletions apps/web/src/components/SendFlow/Token/SignPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ import { SignPage } from "./SignPage";
import { render, screen, waitFor } from "../../../testUtils";
import { type SignPageProps } from "../utils";

jest.mock("@chakra-ui/react", () => ({
...jest.requireActual("@chakra-ui/react"),
useBreakpointValue: jest.fn(),
}));

const fixture = (props: SignPageProps<{ token: FA12TokenBalance | FA2TokenBalance }>) => (
<Modal isOpen={true} onClose={() => {}}>
<SignPage {...props} />
Expand Down
7 changes: 4 additions & 3 deletions apps/web/src/components/SendFlow/Token/SignPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
ModalBody,
ModalContent,
ModalFooter,
useBreakpointValue,
} from "@chakra-ui/react";
import { type FA12TokenBalance, type FA2TokenBalance, type TokenTransfer } from "@umami/core";
import { FormProvider } from "react-hook-form";
Expand All @@ -24,7 +25,7 @@ export const SignPage = (props: SignPageProps<{ token: FA12TokenBalance | FA2Tok
} = props;
const { fee, operations, estimationFailed, isLoading, form, signer, onSign } =
useSignPageHelpers(initialOperations);

const hideBalance = useBreakpointValue({ base: true, md: false });
const { amount, recipient } = operations.operations[0] as TokenTransfer;

return (
Expand All @@ -42,11 +43,11 @@ export const SignPage = (props: SignPageProps<{ token: FA12TokenBalance | FA2Tok
</FormControl>
<FormControl>
<FormLabel width="full">From</FormLabel>
<AddressTile address={operations.sender.address} />
<AddressTile address={operations.sender.address} hideBalance={hideBalance} />
</FormControl>
<FormControl>
<FormLabel width="full">To</FormLabel>
<AddressTile address={recipient} />
<AddressTile address={recipient} hideBalance={hideBalance} />
</FormControl>
<AdvancedSettingsAccordion />
</ModalBody>
Expand Down

1 comment on commit af5badf

@github-actions
Copy link

Choose a reason for hiding this comment

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

Title Lines Statements Branches Functions
apps/desktop Coverage: 83%
83.81% (1786/2131) 79.58% (850/1068) 78.27% (454/580)
apps/web Coverage: 83%
83.81% (1786/2131) 79.58% (850/1068) 78.27% (454/580)
packages/components Coverage: 97%
97.51% (196/201) 95.91% (94/98) 88.13% (52/59)
packages/core Coverage: 81%
82.47% (207/251) 72.72% (88/121) 81.35% (48/59)
packages/crypto Coverage: 100%
100% (43/43) 90.9% (10/11) 100% (7/7)
packages/data-polling Coverage: 97%
95.27% (141/148) 87.5% (21/24) 92.85% (39/42)
packages/multisig Coverage: 98%
98.47% (129/131) 85.71% (18/21) 100% (36/36)
packages/social-auth Coverage: 100%
100% (21/21) 100% (11/11) 100% (3/3)
packages/state Coverage: 85%
84.79% (820/967) 81.03% (188/232) 78.59% (301/383)
packages/tezos Coverage: 89%
88.72% (118/133) 94.59% (35/37) 86.84% (33/38)
packages/tzkt Coverage: 89%
87.32% (62/71) 87.5% (14/16) 80.48% (33/41)

Please sign in to comment.