From 1bb1efe06baa6fe077dd8f77fd061c73318f50a3 Mon Sep 17 00:00:00 2001 From: 0311xuyang Date: Thu, 31 Oct 2024 09:23:23 +0800 Subject: [PATCH 1/7] update shentu msg type --- apps/extension/src/stores/root.tsx | 11 ----------- apps/mobile/src/stores/root.tsx | 11 ----------- 2 files changed, 22 deletions(-) diff --git a/apps/extension/src/stores/root.tsx b/apps/extension/src/stores/root.tsx index 6f6d4cd0b0..4a7f0ae964 100644 --- a/apps/extension/src/stores/root.tsx +++ b/apps/extension/src/stores/root.tsx @@ -348,17 +348,6 @@ export class RootStore { CosmosAccount.use({ queriesStore: this.queriesStore, msgOptsCreator: (chainId) => { - // In certik, change the msg type of the MsgSend to "bank/MsgSend" - if (chainId.startsWith("shentu-")) { - return { - send: { - native: { - type: "bank/MsgSend", - }, - }, - }; - } - // In akash or sifchain, increase the default gas for sending if ( chainId.startsWith("akashnet-") || diff --git a/apps/mobile/src/stores/root.tsx b/apps/mobile/src/stores/root.tsx index 87d0b3df72..fb4356a068 100644 --- a/apps/mobile/src/stores/root.tsx +++ b/apps/mobile/src/stores/root.tsx @@ -231,17 +231,6 @@ export class RootStore { CosmosAccount.use({ queriesStore: this.queriesStore, msgOptsCreator: chainId => { - // In certik, change the msg type of the MsgSend to "bank/MsgSend" - if (chainId.startsWith('shentu-')) { - return { - send: { - native: { - type: 'bank/MsgSend', - }, - }, - }; - } - // In akash or sifchain, increase the default gas for sending if ( chainId.startsWith('akashnet-') || From 2d640755aedbc27d47d7b3752d51571a6250db15 Mon Sep 17 00:00:00 2001 From: rowan Date: Tue, 5 Nov 2024 14:22:39 +0900 Subject: [PATCH 2/7] Allow HeaderLayout component to have multiple bottom buttons --- apps/extension/src/layouts/header/header.tsx | 104 +++++++--- apps/extension/src/layouts/header/types.ts | 5 +- .../src/pages/ibc-transfer/index.tsx | 194 +++++++++--------- .../src/pages/main/layouts/header.tsx | 2 +- .../permission/basic-access-for-evm/index.tsx | 26 +-- .../basic-access-for-starknet/index.tsx | 26 +-- .../pages/permission/basic-access/index.tsx | 26 +-- .../permission/get-chain-infos/index.tsx | 16 +- .../extension/src/pages/send/amount/index.tsx | 22 +- .../pages/setting/advanced/endpoint/index.tsx | 20 +- .../src/pages/setting/contacts/add/index.tsx | 24 ++- .../setting/general/authz/revoke/index.tsx | 18 +- .../general/link-keplr-mobile/index.tsx | 20 +- .../setting/security/auto-lock/index.tsx | 18 +- .../security/change-password/index.tsx | 18 +- .../src/pages/setting/token/add/index.tsx | 24 ++- .../extension/src/pages/sign/cosmos/adr36.tsx | 178 ++++++++-------- .../src/pages/sign/cosmos/icns/index.tsx | 32 +-- .../src/pages/sign/cosmos/tx/view.tsx | 24 ++- .../src/pages/sign/ethereum/view.tsx | 160 ++++++++------- .../src/pages/starknet/send/index.tsx | 38 ++-- .../src/pages/starknet/sign/tx/view.tsx | 22 +- .../src/pages/suggest-chain/index.tsx | 86 ++++---- .../src/pages/wallet/change-name/index.tsx | 26 +-- .../src/pages/wallet/delete/index.tsx | 14 +- .../src/pages/wallet/show-sensitive/index.tsx | 6 +- 26 files changed, 621 insertions(+), 528 deletions(-) diff --git a/apps/extension/src/layouts/header/header.tsx b/apps/extension/src/layouts/header/header.tsx index 9ccd566f28..4220d3ed22 100644 --- a/apps/extension/src/layouts/header/header.tsx +++ b/apps/extension/src/layouts/header/header.tsx @@ -182,7 +182,7 @@ export const HeaderLayout: FunctionComponent< title, left, right, - bottomButton, + bottomButtons, displayFlex, fixedHeight, fixedMinHeight, @@ -197,6 +197,9 @@ export const HeaderLayout: FunctionComponent< const [height, setHeight] = React.useState(() => pxToRem(600)); const lastSetHeight = useRef(-1); + const hasBottomButton = bottomButtons && bottomButtons.length > 0; + const hasMultipleBottomButton = bottomButtons && bottomButtons.length > 1; + useLayoutEffect(() => { function handleResize() { if (window.visualViewport) { @@ -216,21 +219,32 @@ export const HeaderLayout: FunctionComponent< return () => window.removeEventListener("resize", handleResize); }, []); + // TODO: 버튼이 여러개일때의 처리를 해야한다. const bottomPadding = (() => { - if (!bottomButton) { + if (!hasBottomButton) { return "0"; } - if (bottomButton.isSpecial) { + const specialButton = bottomButtons.find((button) => button.isSpecial); + + if (!!specialButton) { return ( bottomButtonPaddingRem * 2 + - getSpecialButtonHeightRem(bottomButton.size) + + getSpecialButtonHeightRem(specialButton.size) + "rem" ); } + const largestButton = bottomButtons.reduce((prev, current) => { + return getButtonHeightRem(prev.size) > getButtonHeightRem(current.size) + ? prev + : current; + }, bottomButtons[0]); + return ( - bottomButtonPaddingRem * 2 + getButtonHeightRem(bottomButton.size) + "rem" + bottomButtonPaddingRem * 2 + + getButtonHeightRem(largestButton.size) + + "rem" ); })(); @@ -277,7 +291,7 @@ export const HeaderLayout: FunctionComponent< {children} - {bottomButton ? ( + {hasBottomButton ? ( {/* @@ -304,30 +323,55 @@ export const HeaderLayout: FunctionComponent< }} /> ) : null} - {(() => { - if (bottomButton.isSpecial) { - // isSpecial is not used. - const { isSpecial, ...other } = bottomButton; - return ; - } else { - // isSpecial is not used. - const { isSpecial, type, ...other } = bottomButton; - - // onSubmit prop이 존재한다면 기본적으로 type="submit"으로 설정한다 - // TODO: 만약에 bottomButton이 배열을 받을 수 있도록 수정된다면 이 부분도 수정되어야함. - - const props = { - ...other, - type: type || onSubmit ? ("submit" as const) : undefined, - }; - - return ( - -