Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(components): fix assign me and fix color in redelegation #371

Merged
merged 5 commits into from
Jun 8, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Improvements

- [#371](https://github.com/alleslabs/celatone-frontend/pull/371) Refactor assign me component and fix color in redelegation page
- [#357](https://github.com/alleslabs/celatone-frontend/pull/357) Abstract color, typeface, images to theme config
- [#352](https://github.com/alleslabs/celatone-frontend/pull/352) Refactor/Abstract styling (color system, font weight and more)
- [#347](https://github.com/alleslabs/celatone-frontend/pull/347) Move tx table accordion arrow to the front and refactor block txs table
Expand Down
11 changes: 9 additions & 2 deletions src/lib/components/AssignMe.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
import { Text } from "@chakra-ui/react";
import type { TextProps } from "@chakra-ui/react";
import { useWallet } from "@cosmos-kit/react";
import type { MouseEventHandler } from "react";

interface AssginMeProps {
onClick?: MouseEventHandler<HTMLParagraphElement>;
isDisable?: boolean;
textAlign?: TextProps["textAlign"];
}

export const AssignMe = ({ onClick, isDisable = false }: AssginMeProps) => {
export const AssignMe = ({
onClick,
isDisable = false,
textAlign = "right",
}: AssginMeProps) => {
const { address: walletAddress } = useWallet();
const enabled = Boolean(!isDisable && walletAddress);

return (
<Text
textAlign="right"
textAlign={textAlign}
mr={3}
color={enabled ? "accent.main" : "text.disabled"}
fontWeight={700}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const NonRedelegatableTableRow = ({

<TableRow>
<Flex direction="column" gap={1} color="text.dark">
<Text variant="body2">
<Text variant="body2" color="text.dark">
{formatUTC(nonRedelegatable.completionTime)}
</Text>
<Text variant="body3" color="text.disabled">
Expand Down
14 changes: 5 additions & 9 deletions src/lib/pages/faucet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
useInternalNavigate,
useValidateAddress,
} from "lib/app-provider";
import { AssignMe } from "lib/components/AssignMe";
import type { FormStatus } from "lib/components/forms";
import { TextInput } from "lib/components/forms";
import { CustomIcon } from "lib/components/icon";
Expand Down Expand Up @@ -158,19 +159,14 @@ const Faucet = () => {
status={status}
label="Receiving Address"
helperAction={
<Text
color="accent.main"
fontWeight={700}
variant="body3"
cursor="pointer"
alignSelf="flex-start"
<AssignMe
onClick={() => {
AmpTrack(AmpEvent.USE_ASSIGN_ME);
setAddress(walletAddress);
}}
>
Assign me
</Text>
isDisable={!walletAddress || address === walletAddress}
textAlign="left"
/>
}
/>
<Button
Expand Down
12 changes: 4 additions & 8 deletions src/lib/pages/instantiate/instantiate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
useLCDEndpoint,
useValidateAddress,
} from "lib/app-provider";
import { AssignMe } from "lib/components/AssignMe";
import { ConnectWalletAlert } from "lib/components/ConnectWalletAlert";
import type { FormStatus } from "lib/components/forms";
import { ControllerInput } from "lib/components/forms";
Expand Down Expand Up @@ -319,18 +320,13 @@ const Instantiate = ({ onComplete }: InstantiatePageProps) => {
variant="floating"
error={validateAdmin(watchAdminAddress)}
helperAction={
<Text
color="accent.main"
fontWeight={700}
variant="body3"
cursor="pointer"
<AssignMe
onClick={() => {
AmpTrack(AmpEvent.USE_ASSIGN_ME);
setValue("adminAddress", address);
}}
>
Assign me
</Text>
isDisable={!address || watchAdminAddress === address}
/>
}
/>
<Heading variant="h6" as="h6" my={8} alignSelf="flex-start">
Expand Down