From 907705d763b6264e4017f689a0b9557c2fd6cd78 Mon Sep 17 00:00:00 2001 From: rowan Date: Fri, 8 Nov 2024 18:50:42 +0900 Subject: [PATCH] Revise Reject and Approve button designs on interactive pages --- .../extension/src/components/button/styles.ts | 3 + .../src/components/special-button/styles.ts | 3 + apps/extension/src/hooks/interaction.ts | 13 ++--- apps/extension/src/languages/en.json | 1 - apps/extension/src/languages/ko.json | 1 - apps/extension/src/languages/zh-cn.json | 1 - apps/extension/src/layouts/header/header.tsx | 14 +---- apps/extension/src/layouts/header/types.ts | 2 - .../permission/basic-access-for-evm/index.tsx | 49 +++++++++++----- .../basic-access-for-starknet/index.tsx | 49 +++++++++++----- .../pages/permission/basic-access/index.tsx | 49 ++++++++++++---- .../permission/get-chain-infos/index.tsx | 37 +++++++++--- .../extension/src/pages/sign/cosmos/adr36.tsx | 54 +++++++++++++----- .../src/pages/sign/cosmos/icns/index.tsx | 57 +++++++++++++------ .../src/pages/sign/cosmos/tx/view.tsx | 47 +++++++++++---- .../src/pages/sign/ethereum/view.tsx | 44 ++++++++++---- .../src/pages/starknet/send/index.tsx | 10 ---- .../src/pages/starknet/sign/message/view.tsx | 51 ++++++++++++++--- .../src/pages/starknet/sign/tx/view.tsx | 48 ++++++++++++---- .../src/pages/suggest-chain/index.tsx | 41 ++++++++++--- 20 files changed, 416 insertions(+), 158 deletions(-) diff --git a/apps/extension/src/components/button/styles.ts b/apps/extension/src/components/button/styles.ts index 94086f8dc1..f44063f33b 100644 --- a/apps/extension/src/components/button/styles.ts +++ b/apps/extension/src/components/button/styles.ts @@ -285,6 +285,9 @@ export const Styles = { display: flex; align-items: center; margin-right: 0.25rem; + svg { + fill: ${ColorPalette["transparent"]}; + } `, Right: styled.span` height: 100%; diff --git a/apps/extension/src/components/special-button/styles.ts b/apps/extension/src/components/special-button/styles.ts index 400ae9a55a..59bdb8a3d8 100644 --- a/apps/extension/src/components/special-button/styles.ts +++ b/apps/extension/src/components/special-button/styles.ts @@ -91,6 +91,9 @@ export const Styles = { display: flex; align-items: center; margin-right: 0.25rem; + svg { + fill: ${ColorPalette["transparent"]}; + } `, Right: styled.span` height: 100%; diff --git a/apps/extension/src/hooks/interaction.ts b/apps/extension/src/hooks/interaction.ts index 8bc299c45f..61df427f38 100644 --- a/apps/extension/src/hooks/interaction.ts +++ b/apps/extension/src/hooks/interaction.ts @@ -12,17 +12,10 @@ export const useInteractionInfo = (cleanUp?: () => void) => { interactionInternal: searchParams.get("interactionInternal") === "true", }; - useEffect(() => { - return () => { - if (cleanUpRef.current) { - cleanUpRef.current(); - } - }; - }, []); - useEffect(() => { // Execute the clean-up function when closing window. const beforeunload = async () => { + console.log("beforeunload"); if (cleanUpRef.current) { cleanUpRef.current(); } @@ -34,6 +27,10 @@ export const useInteractionInfo = (cleanUp?: () => void) => { }; }, []); + useEffect(() => { + // TODO: 현재 페이지에서 뒤로가기를 했을 때 이를 감지하고 cleanUp 함수를 실행하는 로직이 필요함. + }, []); + return useMemo(() => { return { interaction: result.interaction, diff --git a/apps/extension/src/languages/en.json b/apps/extension/src/languages/en.json index e38732c922..08d10500d7 100644 --- a/apps/extension/src/languages/en.json +++ b/apps/extension/src/languages/en.json @@ -664,7 +664,6 @@ "button.next": "Next", "button.advanced": "Advanced", "button.approve": "Approve", - "button.reject": "Reject", "button.save": "Save", "button.close": "Close", "button.back": "Back", diff --git a/apps/extension/src/languages/ko.json b/apps/extension/src/languages/ko.json index 9aa42c9cc4..00700f8293 100644 --- a/apps/extension/src/languages/ko.json +++ b/apps/extension/src/languages/ko.json @@ -648,7 +648,6 @@ "button.next": "다음", "button.advanced": "고급", "button.approve": "승인", - "button.reject": "거부", "button.save": "저장", "button.close": "닫기", "button.back": "뒤로가기", diff --git a/apps/extension/src/languages/zh-cn.json b/apps/extension/src/languages/zh-cn.json index 1880363175..d17ed699d2 100644 --- a/apps/extension/src/languages/zh-cn.json +++ b/apps/extension/src/languages/zh-cn.json @@ -619,7 +619,6 @@ "button.next": "下一步", "button.advanced": "高级", "button.approve": "确认", - "button.reject": "拒绝", "button.save": "保存", "button.close": "关闭", "text-button.select-all": "全选", diff --git a/apps/extension/src/layouts/header/header.tsx b/apps/extension/src/layouts/header/header.tsx index 22466259b4..b2bdadb725 100644 --- a/apps/extension/src/layouts/header/header.tsx +++ b/apps/extension/src/layouts/header/header.tsx @@ -188,7 +188,6 @@ export const HeaderLayout: FunctionComponent< left, right, bottomButtons, - bottomButtonsContainerStyle, displayFlex, fixedHeight, fixedMinHeight, @@ -225,7 +224,6 @@ export const HeaderLayout: FunctionComponent< return () => window.removeEventListener("resize", handleResize); }, []); - // TODO: 버튼이 여러개일때의 처리를 해야한다. const bottomPadding = (() => { if (!hasBottomButton) { return "0"; @@ -249,17 +247,12 @@ export const HeaderLayout: FunctionComponent< index: number ) => { if (button.isSpecial) { - // isSpecial is not used. - const { isSpecial, ...other } = button; - return ; + return ; } - // isSpecial is not used. - const { isSpecial, ...other } = button; - return ( -