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: refactor pastTxs page, add new messages, change filter action se… #112

Merged
merged 21 commits into from
Jan 27, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
1e011e7
fix: refactor pastTxs page, add new messages, change filter action se…
bkioshn Jan 20, 2023
468583b
fix: pagination problem when search, table size, input autocomplete
bkioshn Jan 20, 2023
bf902b3
Merge branch 'develop' into fix/past-txs
bkioshn Jan 20, 2023
48c4ee4
chore: add changelog
bkioshn Jan 20, 2023
a4eb495
fix: updateAdminMsg to support contract address for new admin
bkioshn Jan 20, 2023
a64422b
fix: throw err in query fnc, change file name, fix style
bkioshn Jan 23, 2023
5ab2a96
chore: change name, add props interface
bkioshn Jan 24, 2023
1ec30a9
Merge branch 'develop' into fix/past-txs
bkioshn Jan 25, 2023
8425e57
fix: instantiate2 cant resend, create modal for instantiate2 msg
bkioshn Jan 25, 2023
73d72fe
fix: handle camleCase and snakeCase when encounter strange character
bkioshn Jan 25, 2023
644c778
Merge branch 'develop' into fix/past-txs
bkioshn Jan 26, 2023
2e533d3
fix: format unsupported tokens in past tx
bkioshn Jan 26, 2023
6c9d802
fix: handle contract address not found for instantiate msg
bkioshn Jan 26, 2023
1fb1727
chore: fix changelog, fix line and indent, add comment, fix import
bkioshn Jan 26, 2023
ac4be29
fix: fix type, rendering condition, replace forEach with reduce
bkioshn Jan 26, 2023
17bd8c3
chore: fix type, change name, add comment
bkioshn Jan 27, 2023
0799c31
fix: redo modal
bkioshn Jan 27, 2023
efb1677
fix: token component in past tx
bkioshn Jan 27, 2023
4373fee
fix: handle precision for token in past tx
bkioshn Jan 27, 2023
55f0595
style: fix tooltip width
bkioshn Jan 27, 2023
1e85a96
Merge branch 'develop' into fix/past-txs
bkioshn Jan 27, 2023
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 @@ -39,6 +39,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Features

- [#112](https://github.com/alleslabs/celatone-frontend/pull/112) Refactor past transactions page, support new messages including Migration, Instantiate2, Update Admin, Clear Admin, and change filter actions to dropdown selection
- [#72](https://github.com/alleslabs/celatone-frontend/pull/72) Fix general wording and grammar
- [#110](https://github.com/alleslabs/celatone-frontend/pull/110) Fix proposal detail rendering
- [#109](https://github.com/alleslabs/celatone-frontend/pull/109) Fix incorrect rendering of zero value badges
Expand Down
36 changes: 36 additions & 0 deletions src/lib/components/action-msg/ActionMessages.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import type { AllTransaction, PastTransaction } from "lib/types";
import { ActionMsgType } from "lib/types";
import { extractMsgType } from "lib/utils";

import { MultipleActionsMsg } from "./MultipleActionsMsg";
import { SingleActionMsg } from "./SingleActionMsg";
import { SingleMsg } from "./SingleMsg";

export const RenderActionsMessages = ({
bkioshn marked this conversation as resolved.
Show resolved Hide resolved
transaction,
}: {
transaction: AllTransaction | PastTransaction;
bkioshn marked this conversation as resolved.
Show resolved Hide resolved
}) => {
if (transaction.actionMsgType === ActionMsgType.SINGLE_ACTION_MSG) {
return (
<SingleActionMsg
messages={transaction.messages}
type={extractMsgType(transaction.messages[0].type)}
success={transaction.success}
/>
);
}
if (transaction.actionMsgType === ActionMsgType.MULTIPLE_ACTION_MSG) {
return <MultipleActionsMsg messages={transaction.messages} />;
}
return (
<SingleMsg
type="Message"
tags={
transaction.messages.length === 1
? [extractMsgType(transaction.messages[0].type).substring(3)]
: [transaction.messages.length.toString()]
}
/>
);
};
2 changes: 1 addition & 1 deletion src/lib/components/action-msg/SingleMsg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const SingleMsg = ({
<Tag borderRadius="full">+{length - tags.length} </Tag>
)}
{/* Length */}
{!tags && length && <Tag>{length}</Tag>}
{!tags && length && <Tag borderRadius="full">{length}</Tag>}
{/* Text2 */}
{text2}
{/* Link */}
Expand Down
35 changes: 35 additions & 0 deletions src/lib/components/button/RedoButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { Button } from "@chakra-ui/react";
import { useWallet } from "@cosmos-kit/react";
import { BsArrowCounterclockwise } from "react-icons/bs";

import { useRedo } from "lib/pages/past-txs/hooks/useRedo";
import type { Message } from "lib/types";
import { extractMsgType } from "lib/utils";

interface RedoButtonProps {
message: Message;
}

export const RedoButton = ({ message }: RedoButtonProps) => {
const onClickRedo = useRedo();
const { currentChainName } = useWallet();

return (
<Button
leftIcon={<BsArrowCounterclockwise />}
variant="outline"
iconSpacing="2"
size="sm"
onClick={(e) =>
onClickRedo(
e,
extractMsgType(message.type),
message.msg,
currentChainName
)
}
>
Redo
</Button>
);
};
33 changes: 33 additions & 0 deletions src/lib/components/button/ResendButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Button } from "@chakra-ui/react";
import { useState } from "react";

import { FailedModal } from "lib/pages/instantiate/component";
import { useResend } from "lib/pages/past-txs/hooks/useResend";
import type { Message } from "lib/types";

interface ResendButtonProps {
messages: Message[];
}
export const ResendButton = ({ messages }: ResendButtonProps) => {
const onClickResend = useResend();
const [error, setError] = useState("");

bkioshn marked this conversation as resolved.
Show resolved Hide resolved
const [isButtonLoading, setIsButtonLoading] = useState(false);

return (
<>
<Button
variant="outline"
iconSpacing="0"
size="sm"
onClick={(e) =>
onClickResend(e, messages, setIsButtonLoading, setError)
}
isDisabled={isButtonLoading}
>
Resend
</Button>
{error && <FailedModal errorLog={error} onClose={() => setError("")} />}
</>
);
};
69 changes: 69 additions & 0 deletions src/lib/components/table/AccordionTx.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import { SlideFade } from "@chakra-ui/react";
import { useState } from "react";

import { SingleActionMsg } from "../action-msg/SingleActionMsg";
import { AccordionStepperItem } from "lib/components/AccordionStepperItem";
import { RedoButton } from "lib/components/button/RedoButton";
import { ResendButton } from "lib/components/button/ResendButton";
import type { Message } from "lib/types";
import { extractMsgType } from "lib/utils";

import { TableRow } from "./tableComponents";

interface AccordionTxProps {
message: Message;
allowFurtherAction: boolean;
}

interface RenderButtonProps {
message: Message;
}

const RenderButton = ({ message }: RenderButtonProps) => {
if (
extractMsgType(message.type) === "MsgExecuteContract" ||
extractMsgType(message.type) === "MsgInstantiateContract"
)
return <RedoButton message={message} />;

if (extractMsgType(message.type) === "MsgSend")
return <ResendButton messages={[message]} />;

return null;
};

export const AccordionTx = ({
message,
allowFurtherAction,
}: AccordionTxProps) => {
const [showButton, setShowButton] = useState(false);
return (
<TableRow
h="40px"
borderBottom="none"
pl="256px"
gap={3}
_hover={{ background: "divider.main" }}
css={{
"&:not(:first-of-type) div#before-stepper": {
visibility: "visible",
},
}}
onMouseEnter={() => setShowButton(true)}
onMouseLeave={() => setShowButton(false)}
>
<AccordionStepperItem />
<SingleActionMsg
messages={[message]}
type={extractMsgType(message.type)}
success
singleMsg
/>
{allowFurtherAction && (
<SlideFade in={showButton} offsetY="20px">
<RenderButton message={message} />
</SlideFade>
)}
</TableRow>
);
};
33 changes: 0 additions & 33 deletions src/lib/components/table/MsgDetail.tsx

This file was deleted.

Loading