From 2030aafee2cd266c84be9c4646c327fb2baf6515 Mon Sep 17 00:00:00 2001 From: osrm <90407222+osrm@users.noreply.github.com> Date: Mon, 2 Dec 2024 22:30:59 +0900 Subject: [PATCH 01/10] cleanup README.md fix typos and grammars --- dapp/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dapp/README.md b/dapp/README.md index 349464532..3d3f02761 100644 --- a/dapp/README.md +++ b/dapp/README.md @@ -1,10 +1,10 @@ # Acre dApp -The application is integrate with OrangeKit and allows people to earn yield on their Bitcoin via yield farming on Ethereum. +The application is integrated with OrangeKit and allows people to earn yield on their Bitcoin via yield farming on Ethereum. This project was bootstrapped with [Create Vite](https://github.com/vitejs/vite/tree/main/packages/create-vite). -To access the dApp in Ledger Live import manifest as described in the +To access the dApp in Ledger Live import the manifest as described in the [Ledger Live Setup](#ledger-live-setup) section. ### Development @@ -29,7 +29,7 @@ Install dependencies and start the dApp: ### Environmental variables -To make sure dApp is running correctly, include the following variables in `.env` file: +To make sure dApp is running correctly, include the following variables in the `.env` file: ```bash VITE_TBTC_API_ENDPOINT= From 614d412c8892d03066432e87cbd5ac0a258e8eb9 Mon Sep 17 00:00:00 2001 From: osrm <90407222+osrm@users.noreply.github.com> Date: Mon, 2 Dec 2024 22:31:25 +0900 Subject: [PATCH 02/10] fix typo README.md --- solidity/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solidity/README.md b/solidity/README.md index e842e5564..da86c24f0 100644 --- a/solidity/README.md +++ b/solidity/README.md @@ -18,7 +18,7 @@ pnpm install ### Testing -To run the test execute: +To run the tests execute: ``` $ pnpm test From f90c9a53f00d74921a36be0de0ac3ae2ec414ca9 Mon Sep 17 00:00:00 2001 From: Kamil Pyszkowski Date: Tue, 3 Dec 2024 17:42:14 +0100 Subject: [PATCH 03/10] Remove `Sidebar` component --- dapp/.env | 1 - dapp/src/DApp.tsx | 13 +- dapp/src/components/Layout.tsx | 2 - .../components/ModalRoot/withBaseModal.tsx | 11 +- dapp/src/components/Sidebar.tsx | 117 ------------------ dapp/src/contexts/SidebarContext.tsx | 49 -------- dapp/src/contexts/index.tsx | 1 - dapp/src/hooks/index.ts | 1 - dapp/src/hooks/useSidebar.ts | 12 -- dapp/src/theme/Sidebar.ts | 38 ------ dapp/src/theme/index.ts | 2 - dapp/src/theme/utils/semanticTokens.ts | 3 - dapp/src/theme/utils/zIndices.ts | 1 - 13 files changed, 7 insertions(+), 244 deletions(-) delete mode 100644 dapp/src/components/Sidebar.tsx delete mode 100644 dapp/src/contexts/SidebarContext.tsx delete mode 100644 dapp/src/hooks/useSidebar.ts delete mode 100644 dapp/src/theme/Sidebar.ts diff --git a/dapp/.env b/dapp/.env index fdb71b35d..fd447e796 100644 --- a/dapp/.env +++ b/dapp/.env @@ -19,7 +19,6 @@ VITE_GELATO_RELAY_API_KEY="htaJCy_XHj8WsE3w53WBMurfySDtjLP_TrNPPa6IPIc_" # this VITE_SUBGRAPH_API_KEY="" # Feature flags -VITE_FEATURE_FLAG_GAMIFICATION_ENABLED="false" VITE_FEATURE_FLAG_WITHDRAWALS_ENABLED="false" VITE_FEATURE_FLAG_OKX_WALLET_ENABLED="false" VITE_FEATURE_FLAG_XVERSE_WALLET_ENABLED="false" diff --git a/dapp/src/DApp.tsx b/dapp/src/DApp.tsx index 587d248ef..9e4992e53 100644 --- a/dapp/src/DApp.tsx +++ b/dapp/src/DApp.tsx @@ -9,7 +9,6 @@ import { AcreSdkProvider } from "./acre-react/contexts" import GlobalStyles from "./components/GlobalStyles" import { DocsDrawerContextProvider, - SidebarContextProvider, WalletConnectionAlertContextProvider, } from "./contexts" import { useInitApp } from "./hooks" @@ -66,13 +65,11 @@ function DAppProviders() { - - - - - - - + + + + + diff --git a/dapp/src/components/Layout.tsx b/dapp/src/components/Layout.tsx index 42bc526a7..c9cec76f8 100644 --- a/dapp/src/components/Layout.tsx +++ b/dapp/src/components/Layout.tsx @@ -6,7 +6,6 @@ import { DappMode } from "#/types" import DocsDrawer from "./DocsDrawer" import Header from "./Header" import ModalRoot from "./ModalRoot" -import Sidebar from "./Sidebar" import MobileModeBanner from "./MobileModeBanner" import Footer from "./Footer" @@ -46,7 +45,6 @@ function Layout() { > - diff --git a/dapp/src/components/ModalRoot/withBaseModal.tsx b/dapp/src/components/ModalRoot/withBaseModal.tsx index 5eeb2396a..b15a22cf6 100644 --- a/dapp/src/components/ModalRoot/withBaseModal.tsx +++ b/dapp/src/components/ModalRoot/withBaseModal.tsx @@ -1,7 +1,7 @@ import React, { ComponentType, useCallback } from "react" import { Modal, ModalContent, ModalOverlay, ModalProps } from "@chakra-ui/react" import { BaseModalProps } from "#/types" -import { useAppNavigate, useSidebar } from "#/hooks" +import { useAppNavigate } from "#/hooks" const MODAL_BASE_SIZE = "lg" @@ -12,7 +12,6 @@ function withBaseModal( return function ModalBase(props: T) { const { closeModal, closeOnEsc, navigateToOnClose } = props - const { isOpen: isSidebarOpen } = useSidebar() const navigate = useAppNavigate() const handleCloseModal = useCallback(() => { @@ -33,13 +32,7 @@ function withBaseModal( {...modalProps} > - + diff --git a/dapp/src/components/Sidebar.tsx b/dapp/src/components/Sidebar.tsx deleted file mode 100644 index b2e010259..000000000 --- a/dapp/src/components/Sidebar.tsx +++ /dev/null @@ -1,117 +0,0 @@ -import React, { ComponentProps, useEffect } from "react" -import { - Box, - Card, - CardBody, - Flex, - useMultiStyleConfig, - Image, -} from "@chakra-ui/react" -import { useScrollbarVisibility, useSidebar } from "#/hooks" -import { - EXTERNAL_HREF, - REWARD_BOOST, - SEASON_KEY, - featureFlags, -} from "#/constants" -import { rewardsBoostArrowImage } from "#/assets/images/benefits" -import ButtonLink from "./shared/ButtonLink" -import { TextSm } from "./shared/Typography" - -const CHAKRA_MODAL_CONTAINER_SELECTOR = ".chakra-modal__content-container" - -const BUTTONS: Partial>[] = [ - { - children: "Docs", - variant: "solid", - href: EXTERNAL_HREF.DOCS, - isExternal: true, - }, - { - children: "FAQ", - colorScheme: "gold", - href: EXTERNAL_HREF.FAQ, - isExternal: true, - }, - { - children: "Contracts", - colorScheme: "gold", - href: EXTERNAL_HREF.CONTRACTS, - isExternal: true, - }, - { - children: "Blog", - colorScheme: "gold", - href: EXTERNAL_HREF.BLOG, - isExternal: true, - }, -] - -const BENEFITS = [ - { ...REWARD_BOOST, imageSrc: rewardsBoostArrowImage }, - SEASON_KEY, -].map((benefit) => ({ ...benefit, name: `1x ${benefit.name}` })) - -export default function Sidebar() { - const { isOpen } = useSidebar() - const { isVisible, scrollbarWidth, refreshState } = useScrollbarVisibility( - CHAKRA_MODAL_CONTAINER_SELECTOR, - ) - const styles = useMultiStyleConfig("Sidebar") - - useEffect(() => { - if (!isOpen) return - refreshState() - }, [isOpen, refreshState]) - - return ( - - - {featureFlags.GAMIFICATION_ENABLED && ( - <> - {/* TODO: Update the component when logic of losing rewards is ready */} - Rewards you’ll unlock - - {BENEFITS.map(({ name, imageSrc }) => ( - - - {name} - - - - ))} - - - )} - - {BUTTONS.map((buttonProps) => ( - - ))} - - - ) -} diff --git a/dapp/src/contexts/SidebarContext.tsx b/dapp/src/contexts/SidebarContext.tsx deleted file mode 100644 index 125b871a1..000000000 --- a/dapp/src/contexts/SidebarContext.tsx +++ /dev/null @@ -1,49 +0,0 @@ -import useIsEmbed from "#/hooks/useIsEmbed" -import React, { createContext, useCallback, useMemo, useState } from "react" - -type SidebarContextValue = { - isOpen: boolean - onOpen: () => void - onClose: () => void -} - -export const SidebarContext = createContext({ - isOpen: false, - onOpen: () => {}, - onClose: () => {}, -}) - -export function SidebarContextProvider({ - children, -}: { - children: React.ReactNode -}): React.ReactElement { - const { isEmbed } = useIsEmbed() - - const [isOpen, setIsOpen] = useState(false) - - const onOpen = useCallback(() => { - if (isEmbed) return - - setIsOpen(true) - }, [isEmbed]) - - const onClose = useCallback(() => { - setIsOpen(false) - }, []) - - const contextValue: SidebarContextValue = useMemo( - () => ({ - isOpen, - onOpen, - onClose, - }), - [isOpen, onClose, onOpen], - ) - - return ( - - {children} - - ) -} diff --git a/dapp/src/contexts/index.tsx b/dapp/src/contexts/index.tsx index 658feecbd..263951aec 100644 --- a/dapp/src/contexts/index.tsx +++ b/dapp/src/contexts/index.tsx @@ -1,5 +1,4 @@ export * from "./DocsDrawerContext" -export * from "./SidebarContext" export * from "./StakeFlowContext" export * from "./PaginationContext" export * from "./WalletConnectionAlertContext" diff --git a/dapp/src/hooks/index.ts b/dapp/src/hooks/index.ts index 91b1cfeb6..b075db2e4 100644 --- a/dapp/src/hooks/index.ts +++ b/dapp/src/hooks/index.ts @@ -2,7 +2,6 @@ export * from "./store" export * from "./sdk" export * from "./orangeKit" export * from "./useDetectThemeMode" -export * from "./useSidebar" export * from "./useDocsDrawer" export * from "./useTransactionDetails" export * from "./useStakeFlowContext" diff --git a/dapp/src/hooks/useSidebar.ts b/dapp/src/hooks/useSidebar.ts deleted file mode 100644 index 944364076..000000000 --- a/dapp/src/hooks/useSidebar.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { useContext } from "react" -import { SidebarContext } from "#/contexts" - -export function useSidebar() { - const context = useContext(SidebarContext) - - if (!context) { - throw new Error("SidebarContext used outside of SidebarContext component") - } - - return context -} diff --git a/dapp/src/theme/Sidebar.ts b/dapp/src/theme/Sidebar.ts deleted file mode 100644 index 1b1a431b1..000000000 --- a/dapp/src/theme/Sidebar.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { createMultiStyleConfigHelpers, defineStyle } from "@chakra-ui/react" - -const PARTS = ["sidebarContainer", "sidebar"] - -const baseStyleSidebarContainer = defineStyle({ - top: 0, - right: 0, - h: "100vh", - position: "fixed", - overflow: "hidden", - zIndex: "sidebar", - transition: "width 0.3s", -}) - -const baseStyleSidebar = defineStyle({ - p: 4, - height: "100%", - w: "sidebar_width", - bg: "gold.200", - borderTop: "2px", - borderLeft: "2px", - borderColor: "gold.100", - borderTopLeftRadius: "xl", - display: "flex", - flexDirection: "column", - gap: 3, -}) - -const multiStyleConfig = createMultiStyleConfigHelpers(PARTS) - -const baseStyle = multiStyleConfig.definePartsStyle({ - sidebarContainer: baseStyleSidebarContainer, - sidebar: baseStyleSidebar, -}) - -export const sidebarTheme = multiStyleConfig.defineMultiStyleConfig({ - baseStyle, -}) diff --git a/dapp/src/theme/index.ts b/dapp/src/theme/index.ts index aaf6f4765..4c306df41 100644 --- a/dapp/src/theme/index.ts +++ b/dapp/src/theme/index.ts @@ -13,7 +13,6 @@ import { modalTheme } from "./Modal" import { cardTheme } from "./Card" import { tooltipTheme } from "./Tooltip" import { headingTheme } from "./Heading" -import { sidebarTheme } from "./Sidebar" import { currencyBalanceTheme } from "./CurrencyBalance" import { tokenBalanceInputTheme } from "./TokenBalanceInput" import { inputTheme } from "./Input" @@ -61,7 +60,6 @@ const defaultTheme = { Input: inputTheme, Link: linkTheme, Modal: modalTheme, - Sidebar: sidebarTheme, Spinner: spinnerTheme, Tag: tagTheme, TokenBalanceInput: tokenBalanceInputTheme, diff --git a/dapp/src/theme/utils/semanticTokens.ts b/dapp/src/theme/utils/semanticTokens.ts index 8ad1298ba..e33367d84 100644 --- a/dapp/src/theme/utils/semanticTokens.ts +++ b/dapp/src/theme/utils/semanticTokens.ts @@ -5,7 +5,4 @@ export const semanticTokens = { modal_shift: "9.75rem", // 156px dashboard_card_padding: 5, }, - sizes: { - sidebar_width: 80, - }, } diff --git a/dapp/src/theme/utils/zIndices.ts b/dapp/src/theme/utils/zIndices.ts index 3e9fb1a4b..f0be28d85 100644 --- a/dapp/src/theme/utils/zIndices.ts +++ b/dapp/src/theme/utils/zIndices.ts @@ -1,5 +1,4 @@ export const zIndices = { - sidebar: 1450, drawer: 1470, mobileBanner: 1500, header: 1400, From 5f7db576cae78709cefd42e93c494d196b8042b5 Mon Sep 17 00:00:00 2001 From: Kamil Pyszkowski Date: Tue, 3 Dec 2024 17:45:15 +0100 Subject: [PATCH 04/10] Revert `.env` changes --- dapp/.env | 1 + 1 file changed, 1 insertion(+) diff --git a/dapp/.env b/dapp/.env index fd447e796..fdb71b35d 100644 --- a/dapp/.env +++ b/dapp/.env @@ -19,6 +19,7 @@ VITE_GELATO_RELAY_API_KEY="htaJCy_XHj8WsE3w53WBMurfySDtjLP_TrNPPa6IPIc_" # this VITE_SUBGRAPH_API_KEY="" # Feature flags +VITE_FEATURE_FLAG_GAMIFICATION_ENABLED="false" VITE_FEATURE_FLAG_WITHDRAWALS_ENABLED="false" VITE_FEATURE_FLAG_OKX_WALLET_ENABLED="false" VITE_FEATURE_FLAG_XVERSE_WALLET_ENABLED="false" From 6e4c0aa2e5944c4b387506f0ac851ee521a64cf6 Mon Sep 17 00:00:00 2001 From: Karolina Kosiorowska Date: Wed, 4 Dec 2024 13:21:11 +0100 Subject: [PATCH 05/10] Pull the existing components one level up If there's only an index file, there's no need to have a directory with an index.* file. The idea with using index.tsx is that imports can remain unchanged in cases where we upgrade from having a single-file component to needing scoped sibling components. --- .../src/components/{DocsDrawer/index.tsx => DocsDrawer.tsx} | 0 .../components/{GlobalStyles/index.tsx => GlobalStyles.tsx} | 0 .../{BlockExplorerLink/index.tsx => BlockExplorerLink.tsx} | 0 .../shared/{ButtonLink/index.tsx => ButtonLink.tsx} | 0 .../{CurrencyBalance/index.tsx => CurrencyBalance.tsx} | 2 +- .../index.tsx => CurrencyBalanceWithConversion.tsx} | 2 +- .../{NumberFormatInput/index.tsx => NumberFormatInput.tsx} | 0 .../components/shared/{Skeleton/index.tsx => Skeleton.tsx} | 0 .../components/shared/{Spinner/index.tsx => Spinner.tsx} | 0 .../{TokenBalanceInput/index.tsx => TokenBalanceInput.tsx} | 6 +++--- 10 files changed, 5 insertions(+), 5 deletions(-) rename dapp/src/components/{DocsDrawer/index.tsx => DocsDrawer.tsx} (100%) rename dapp/src/components/{GlobalStyles/index.tsx => GlobalStyles.tsx} (100%) rename dapp/src/components/shared/{BlockExplorerLink/index.tsx => BlockExplorerLink.tsx} (100%) rename dapp/src/components/shared/{ButtonLink/index.tsx => ButtonLink.tsx} (100%) rename dapp/src/components/shared/{CurrencyBalance/index.tsx => CurrencyBalance.tsx} (98%) rename dapp/src/components/shared/{CurrencyBalanceWithConversion/index.tsx => CurrencyBalanceWithConversion.tsx} (85%) rename dapp/src/components/shared/{NumberFormatInput/index.tsx => NumberFormatInput.tsx} (100%) rename dapp/src/components/shared/{Skeleton/index.tsx => Skeleton.tsx} (100%) rename dapp/src/components/shared/{Spinner/index.tsx => Spinner.tsx} (100%) rename dapp/src/components/shared/{TokenBalanceInput/index.tsx => TokenBalanceInput.tsx} (96%) diff --git a/dapp/src/components/DocsDrawer/index.tsx b/dapp/src/components/DocsDrawer.tsx similarity index 100% rename from dapp/src/components/DocsDrawer/index.tsx rename to dapp/src/components/DocsDrawer.tsx diff --git a/dapp/src/components/GlobalStyles/index.tsx b/dapp/src/components/GlobalStyles.tsx similarity index 100% rename from dapp/src/components/GlobalStyles/index.tsx rename to dapp/src/components/GlobalStyles.tsx diff --git a/dapp/src/components/shared/BlockExplorerLink/index.tsx b/dapp/src/components/shared/BlockExplorerLink.tsx similarity index 100% rename from dapp/src/components/shared/BlockExplorerLink/index.tsx rename to dapp/src/components/shared/BlockExplorerLink.tsx diff --git a/dapp/src/components/shared/ButtonLink/index.tsx b/dapp/src/components/shared/ButtonLink.tsx similarity index 100% rename from dapp/src/components/shared/ButtonLink/index.tsx rename to dapp/src/components/shared/ButtonLink.tsx diff --git a/dapp/src/components/shared/CurrencyBalance/index.tsx b/dapp/src/components/shared/CurrencyBalance.tsx similarity index 98% rename from dapp/src/components/shared/CurrencyBalance/index.tsx rename to dapp/src/components/shared/CurrencyBalance.tsx index bf7f65750..1b5aa3be7 100644 --- a/dapp/src/components/shared/CurrencyBalance/index.tsx +++ b/dapp/src/components/shared/CurrencyBalance.tsx @@ -12,7 +12,7 @@ import { numberToLocaleString, } from "#/utils" import { CurrencyType, AmountType } from "#/types" -import Tooltip from "../Tooltip" +import Tooltip from "./Tooltip" export type CurrencyBalanceProps = { currency: CurrencyType diff --git a/dapp/src/components/shared/CurrencyBalanceWithConversion/index.tsx b/dapp/src/components/shared/CurrencyBalanceWithConversion.tsx similarity index 85% rename from dapp/src/components/shared/CurrencyBalanceWithConversion/index.tsx rename to dapp/src/components/shared/CurrencyBalanceWithConversion.tsx index 5d19dd126..ea9f64850 100644 --- a/dapp/src/components/shared/CurrencyBalanceWithConversion/index.tsx +++ b/dapp/src/components/shared/CurrencyBalanceWithConversion.tsx @@ -1,6 +1,6 @@ import React from "react" import { useCurrencyConversion } from "#/hooks" -import { CurrencyBalance, CurrencyBalanceProps } from "../CurrencyBalance" +import { CurrencyBalance, CurrencyBalanceProps } from "./CurrencyBalance" export function CurrencyBalanceWithConversion({ from, diff --git a/dapp/src/components/shared/NumberFormatInput/index.tsx b/dapp/src/components/shared/NumberFormatInput.tsx similarity index 100% rename from dapp/src/components/shared/NumberFormatInput/index.tsx rename to dapp/src/components/shared/NumberFormatInput.tsx diff --git a/dapp/src/components/shared/Skeleton/index.tsx b/dapp/src/components/shared/Skeleton.tsx similarity index 100% rename from dapp/src/components/shared/Skeleton/index.tsx rename to dapp/src/components/shared/Skeleton.tsx diff --git a/dapp/src/components/shared/Spinner/index.tsx b/dapp/src/components/shared/Spinner.tsx similarity index 100% rename from dapp/src/components/shared/Spinner/index.tsx rename to dapp/src/components/shared/Spinner.tsx diff --git a/dapp/src/components/shared/TokenBalanceInput/index.tsx b/dapp/src/components/shared/TokenBalanceInput.tsx similarity index 96% rename from dapp/src/components/shared/TokenBalanceInput/index.tsx rename to dapp/src/components/shared/TokenBalanceInput.tsx index cd92ff160..69067f35d 100644 --- a/dapp/src/components/shared/TokenBalanceInput/index.tsx +++ b/dapp/src/components/shared/TokenBalanceInput.tsx @@ -21,9 +21,9 @@ import { useCurrencyConversion } from "#/hooks" import NumberFormatInput, { NumberFormatInputValues, NumberFormatInputProps, -} from "../NumberFormatInput" -import { CurrencyBalance } from "../CurrencyBalance" -import HelperErrorText, { HelperErrorTextProps } from "../Form/HelperErrorText" +} from "./NumberFormatInput" +import { CurrencyBalance } from "./CurrencyBalance" +import HelperErrorText, { HelperErrorTextProps } from "./Form/HelperErrorText" type FiatCurrencyBalanceProps = { amount: bigint From ef61f7dc8a47b7330dc67e8dcd59354857fcc8e5 Mon Sep 17 00:00:00 2001 From: Karolina Kosiorowska Date: Wed, 4 Dec 2024 14:22:18 +0100 Subject: [PATCH 06/10] Update component file names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We should not decouple file name from component name—these should match. --- .../ActiveStakingStep/StakeFormModal/StakeDetails.tsx | 4 ++-- .../ActiveUnstakingStep/UnstakeFormModal/UnstakeDetails.tsx | 4 ++-- .../FeesDetails/{FeesItem.tsx => FeesDetailsAmountItem.tsx} | 0 .../{AmountItem.tsx => TransactionDetailsAmountItem.tsx} | 0 4 files changed, 4 insertions(+), 4 deletions(-) rename dapp/src/components/shared/FeesDetails/{FeesItem.tsx => FeesDetailsAmountItem.tsx} (100%) rename dapp/src/components/shared/TransactionDetails/{AmountItem.tsx => TransactionDetailsAmountItem.tsx} (100%) diff --git a/dapp/src/components/TransactionModal/ActiveStakingStep/StakeFormModal/StakeDetails.tsx b/dapp/src/components/TransactionModal/ActiveStakingStep/StakeFormModal/StakeDetails.tsx index ac51f54cd..05fb8ad5c 100644 --- a/dapp/src/components/TransactionModal/ActiveStakingStep/StakeFormModal/StakeDetails.tsx +++ b/dapp/src/components/TransactionModal/ActiveStakingStep/StakeFormModal/StakeDetails.tsx @@ -1,7 +1,7 @@ import React from "react" import { List } from "@chakra-ui/react" -import TransactionDetailsAmountItem from "#/components/shared/TransactionDetails/AmountItem" -import FeesDetailsAmountItem from "#/components/shared/FeesDetails/FeesItem" +import TransactionDetailsAmountItem from "#/components/shared/TransactionDetails/TransactionDetailsAmountItem" +import FeesDetailsAmountItem from "#/components/shared/FeesDetails/FeesDetailsAmountItem" import { TOKEN_AMOUNT_FIELD_NAME } from "#/components/shared/TokenAmountForm/TokenAmountFormBase" import { FeesTooltip } from "#/components/TransactionModal/FeesTooltip" import { diff --git a/dapp/src/components/TransactionModal/ActiveUnstakingStep/UnstakeFormModal/UnstakeDetails.tsx b/dapp/src/components/TransactionModal/ActiveUnstakingStep/UnstakeFormModal/UnstakeDetails.tsx index b457f1347..b69ce1a4a 100644 --- a/dapp/src/components/TransactionModal/ActiveUnstakingStep/UnstakeFormModal/UnstakeDetails.tsx +++ b/dapp/src/components/TransactionModal/ActiveUnstakingStep/UnstakeFormModal/UnstakeDetails.tsx @@ -1,6 +1,6 @@ import React from "react" import { Flex, List } from "@chakra-ui/react" -import TransactionDetailsAmountItem from "#/components/shared/TransactionDetails/AmountItem" +import TransactionDetailsAmountItem from "#/components/shared/TransactionDetails/TransactionDetailsAmountItem" import { TOKEN_AMOUNT_FIELD_NAME } from "#/components/shared/TokenAmountForm/TokenAmountFormBase" import { useFormField, @@ -9,7 +9,7 @@ import { } from "#/hooks" import { ACTION_FLOW_TYPES, CurrencyType } from "#/types" import { DESIRED_DECIMALS_FOR_FEE, featureFlags } from "#/constants" -import FeesDetailsAmountItem from "#/components/shared/FeesDetails/FeesItem" +import FeesDetailsAmountItem from "#/components/shared/FeesDetails/FeesDetailsAmountItem" import WithdrawWarning from "./WithdrawWarning" import { FeesTooltip } from "../../FeesTooltip" diff --git a/dapp/src/components/shared/FeesDetails/FeesItem.tsx b/dapp/src/components/shared/FeesDetails/FeesDetailsAmountItem.tsx similarity index 100% rename from dapp/src/components/shared/FeesDetails/FeesItem.tsx rename to dapp/src/components/shared/FeesDetails/FeesDetailsAmountItem.tsx diff --git a/dapp/src/components/shared/TransactionDetails/AmountItem.tsx b/dapp/src/components/shared/TransactionDetails/TransactionDetailsAmountItem.tsx similarity index 100% rename from dapp/src/components/shared/TransactionDetails/AmountItem.tsx rename to dapp/src/components/shared/TransactionDetails/TransactionDetailsAmountItem.tsx From 2a810b885fdcfa710a611f73414cada427662f9d Mon Sep 17 00:00:00 2001 From: Rafal Czajkowski Date: Thu, 5 Dec 2024 16:07:39 +0100 Subject: [PATCH 07/10] Bump siww package to `v1.0.0-beta.7` This version adds support for Bitcoin Legacy testnet address starting with `n`. --- dapp/package.json | 2 +- pnpm-lock.yaml | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dapp/package.json b/dapp/package.json index b384d7b43..cf3d222b3 100644 --- a/dapp/package.json +++ b/dapp/package.json @@ -24,7 +24,7 @@ "@ledgerhq/wallet-api-acre-module": "0.1.0", "@ledgerhq/wallet-api-client": "1.6.0", "@orangekit/react": "1.0.0-beta.34", - "@orangekit/sign-in-with-wallet": "1.0.0-beta.6", + "@orangekit/sign-in-with-wallet": "1.0.0-beta.7", "@reduxjs/toolkit": "^2.2.0", "@rehooks/local-storage": "^2.4.5", "@safe-global/safe-core-sdk-types": "^5.0.1", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 53c684f24..8681fa1f8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -42,8 +42,8 @@ importers: specifier: 1.0.0-beta.34 version: 1.0.0-beta.34(@react-native-async-storage/async-storage@1.23.1(react-native@0.74.2(@babel/core@7.24.7)(@babel/preset-env@7.24.7(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1)(utf-8-validate@5.0.10)))(@tanstack/query-core@5.45.0)(@tanstack/react-query@5.45.0(react@18.3.1))(@types/react@18.3.3)(bufferutil@4.0.8)(encoding@0.1.13)(immer@10.1.1)(react-dom@18.3.1(react@18.3.1))(react-native@0.74.2(@babel/core@7.24.7)(@babel/preset-env@7.24.7(@babel/core@7.24.7))(@types/react@18.3.3)(bufferutil@4.0.8)(encoding@0.1.13)(react@18.3.1)(utf-8-validate@5.0.10))(rollup@4.18.0)(typescript@5.4.5)(utf-8-validate@5.0.10)(zod@3.23.8) '@orangekit/sign-in-with-wallet': - specifier: 1.0.0-beta.6 - version: 1.0.0-beta.6(bech32@2.0.0)(ethers@6.13.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)) + specifier: 1.0.0-beta.7 + version: 1.0.0-beta.7(bech32@2.0.0)(ethers@6.13.0(bufferutil@4.0.8)(utf-8-validate@5.0.10)) '@reduxjs/toolkit': specifier: ^2.2.0 version: 2.2.5(react-redux@9.1.2(@types/react@18.3.3)(react@18.3.1)(redux@5.0.1))(react@18.3.1) @@ -2698,11 +2698,11 @@ packages: '@orangekit/sdk@1.0.0-beta.19': resolution: {integrity: sha512-sIqzu3QTb0WkB4Ir4zHX4tP7hf+uZBXX60q/ww6UzwPjoqGL3dOdui59lTZSNygdMbydLE3y9FSNZPNkQvm+gA==} - '@orangekit/sign-in-with-wallet-parser@1.0.0-beta.6': - resolution: {integrity: sha512-Yi6ohSJV4/Ovrq5c7jD+kPE8pZxLhWtFbZjKRwUW8JL60P/tcyT5o0etul0reqcY2iBlIo5aoC2Hh0noRGl86w==} + '@orangekit/sign-in-with-wallet-parser@1.0.0-beta.7': + resolution: {integrity: sha512-C7gmliw2TJOQzIMpuhDZhIGlp7zFSqNsa/oevNaqnB+i0zFIsXZjsKg2oddr8smYG1+KhbX+V+O3AeaPCSsK9A==} - '@orangekit/sign-in-with-wallet@1.0.0-beta.6': - resolution: {integrity: sha512-UzNG8QHehem2wayWDyMBd13z1lQUBKsSq+NjGK6KHYWUbet6EizBeVZK7jSruzTHba3gDI8I3NH071E6sxTFtQ==} + '@orangekit/sign-in-with-wallet@1.0.0-beta.7': + resolution: {integrity: sha512-o2U5oi8b+2cc0Lel4p7myp1pQ6J2OLCdVTRhYQ4Te4+iqVFns1UlHx28pEo0zvGCJ5CwHQBmJHX6QguL02Kj4Q==} peerDependencies: bech32: '=2.0.0' ethers: ^6.0.8 @@ -14891,16 +14891,16 @@ snapshots: - supports-color - utf-8-validate - '@orangekit/sign-in-with-wallet-parser@1.0.0-beta.6': + '@orangekit/sign-in-with-wallet-parser@1.0.0-beta.7': dependencies: '@noble/hashes': 1.4.0 apg-js: 4.4.0 uri-js: 4.4.1 valid-url: 1.0.9 - '@orangekit/sign-in-with-wallet@1.0.0-beta.6(bech32@2.0.0)(ethers@6.13.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))': + '@orangekit/sign-in-with-wallet@1.0.0-beta.7(bech32@2.0.0)(ethers@6.13.0(bufferutil@4.0.8)(utf-8-validate@5.0.10))': dependencies: - '@orangekit/sign-in-with-wallet-parser': 1.0.0-beta.6 + '@orangekit/sign-in-with-wallet-parser': 1.0.0-beta.7 '@stablelib/random': 1.0.2 bech32: 2.0.0 ethers: 6.13.0(bufferutil@4.0.8)(utf-8-validate@5.0.10) From 86dc681e74aac1ae45b2afdf25f7e9e0acd59bac Mon Sep 17 00:00:00 2001 From: Karolina Kosiorowska Date: Fri, 6 Dec 2024 08:55:05 +0100 Subject: [PATCH 08/10] Fix eslint issue --- .../ActiveUnstakingStep/UnstakeFormModal/UnstakeDetails.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dapp/src/components/TransactionModal/ActiveUnstakingStep/UnstakeFormModal/UnstakeDetails.tsx b/dapp/src/components/TransactionModal/ActiveUnstakingStep/UnstakeFormModal/UnstakeDetails.tsx index 1879c7100..4ac3b86ad 100644 --- a/dapp/src/components/TransactionModal/ActiveUnstakingStep/UnstakeFormModal/UnstakeDetails.tsx +++ b/dapp/src/components/TransactionModal/ActiveUnstakingStep/UnstakeFormModal/UnstakeDetails.tsx @@ -8,9 +8,9 @@ import { } from "#/hooks" import { ACTION_FLOW_TYPES, CurrencyType } from "#/types" import { DESIRED_DECIMALS_FOR_FEE } from "#/constants" -import { FeesTooltip } from "../../FeesTooltip" import FeesDetailsAmountItem from "#/components/shared/FeesDetails/FeesDetailsAmountItem" import TransactionDetailsAmountItem from "#/components/shared/TransactionDetails/TransactionDetailsAmountItem" +import { FeesTooltip } from "../../FeesTooltip" function UnstakeDetails({ currency }: { currency: CurrencyType }) { const { value = 0n } = useFormField( From 9a506e5670747aea1895aa0f819ac63824258c33 Mon Sep 17 00:00:00 2001 From: Kamil Pyszkowski Date: Fri, 6 Dec 2024 13:05:39 +0100 Subject: [PATCH 09/10] Remove `useScrollbarVisibility` hook --- dapp/src/hooks/index.ts | 1 - dapp/src/hooks/useScrollbarVisibility.ts | 32 ------------------------ 2 files changed, 33 deletions(-) delete mode 100644 dapp/src/hooks/useScrollbarVisibility.ts diff --git a/dapp/src/hooks/index.ts b/dapp/src/hooks/index.ts index b075db2e4..7758c4fd7 100644 --- a/dapp/src/hooks/index.ts +++ b/dapp/src/hooks/index.ts @@ -33,7 +33,6 @@ export { default as useTriggerConnectWalletModal } from "./useTriggerConnectWall export { default as useLastUsedBtcAddress } from "./useLastUsedBtcAddress" export { default as useAcrePoints } from "./useAcrePoints" export { default as useSignMessageAndCreateSession } from "./useSignMessageAndCreateSession" -export { default as useScrollbarVisibility } from "./useScrollbarVisibility" export { default as useAccessCode } from "./useAccessCode" export { default as useFormField } from "./useFormField" export { default as useDepositBTCTransaction } from "./useDepositBTCTransaction" diff --git a/dapp/src/hooks/useScrollbarVisibility.ts b/dapp/src/hooks/useScrollbarVisibility.ts deleted file mode 100644 index c1ce79034..000000000 --- a/dapp/src/hooks/useScrollbarVisibility.ts +++ /dev/null @@ -1,32 +0,0 @@ -import { useCallback, useEffect, useState } from "react" - -const SCROLLBAR_WIDTH = `${window.innerWidth - document.body.offsetWidth}px` - -function isScrollbarVisible(selector: string) { - const element = document.querySelector(selector) - - if (!element) return false - - return element?.scrollHeight > element?.clientHeight -} - -export default function useScrollbarVisibility(selector: string) { - const [isVisible, setIsVisible] = useState(false) - - useEffect(() => { - const handleResize = () => { - setIsVisible(isScrollbarVisible(selector)) - } - window.addEventListener("resize", handleResize) - - return () => { - window.removeEventListener("resize", handleResize) - } - }, [selector]) - - const refreshState = useCallback(() => { - setIsVisible(isScrollbarVisible(selector)) - }, [selector]) - - return { isVisible, scrollbarWidth: SCROLLBAR_WIDTH, refreshState } -} From d4d447647c090356ed3cbb9edb4318f755d72044 Mon Sep 17 00:00:00 2001 From: Kamil Pyszkowski Date: Fri, 6 Dec 2024 13:07:46 +0100 Subject: [PATCH 10/10] Remove redundant z index --- dapp/src/components/ModalRoot/withBaseModal.tsx | 2 +- dapp/src/theme/utils/zIndices.ts | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/dapp/src/components/ModalRoot/withBaseModal.tsx b/dapp/src/components/ModalRoot/withBaseModal.tsx index b15a22cf6..b5d8cb4d5 100644 --- a/dapp/src/components/ModalRoot/withBaseModal.tsx +++ b/dapp/src/components/ModalRoot/withBaseModal.tsx @@ -32,7 +32,7 @@ function withBaseModal( {...modalProps} > - + diff --git a/dapp/src/theme/utils/zIndices.ts b/dapp/src/theme/utils/zIndices.ts index f0be28d85..0b8c0d5e5 100644 --- a/dapp/src/theme/utils/zIndices.ts +++ b/dapp/src/theme/utils/zIndices.ts @@ -3,6 +3,5 @@ export const zIndices = { mobileBanner: 1500, header: 1400, footer: 1380, - modalContent: 1410, modalOverlay: 1390, }