Skip to content

Commit

Permalink
Hide balance for mobile view on sign screen
Browse files Browse the repository at this point in the history
  • Loading branch information
OKendigelyan committed Dec 9, 2024
1 parent 8ced9ad commit 308fc07
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
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
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 @@ -8,6 +8,7 @@ import {
ModalContent,
ModalFooter,
Text,
useBreakpointValue,
VStack,

Check warning on line 12 in apps/web/src/components/SendFlow/NFT/SignPage.tsx

View workflow job for this annotation

GitHub Actions / test

Member 'VStack' of the import declaration should be sorted alphabetically
} from "@chakra-ui/react";
import { type EstimatedAccountOperations, type FA2Transfer, type NFTBalance } from "@umami/core";
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
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
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

0 comments on commit 308fc07

Please sign in to comment.