From ebae213ec993ccb7b4cd27d2a17c164de1af0cf4 Mon Sep 17 00:00:00 2001 From: Wenty Li <105278450+wenty22@users.noreply.github.com> Date: Fri, 15 Dec 2023 13:33:43 +0800 Subject: [PATCH] Fixed modal flickering issue in grid layout. (#66) * chore: Update bug_report template (#26) * feat: Add test example * feat: Update examples * feat: Add disclaimer & download url * docs: Update example * docs: Update docs * docs: Update docs * docs: Update gitignore * docs: Update docs * feat: Add zIndices theme config * feat: Update examples * feat: Refactor switch network modal * refactor: Clean code * feat: Update examples * refactor: Update dependencies * feat: Update version * docs: Update docs * chore: Add changeset * test: Test changeset version * docs: Create LICENSE * docs: Update packages info * chore: Add husky & lint-staged * abc: test commit lint * chore: Update husky * chore: Update husky * test: test husky * chore: Add issue & pr template * fix: Update OpenSwitchNetworkOptions type * feat: Add options to control modal close * feat: Add default wallets to walletConnect * docs: Update useModal document * refactor: Add className to base components * chore: Add release github acton * chore: Add publish ci script * chore: Fix github action * chore: Update github action * test: Test github action * chore: Add .pnpm-store to gitignore * chore: Update github action * chore: Copy readme to walletkit package when publish * chore: Update issue_template * chore: Update pr & issue template * Update bug_report.yml * Create config.yml * Delete .github/ISSUE_TEMPLATE/config.yml * Update bug_report.yml * Update bug_report.yml * chore: Update bug_report.yml * style: Add chains type declaration for dev example * style: Add chains type declaration for dev example * chore: test docs release workflow * chore: Test docs release workflow * chore: test docs release workflow * chore: test docs release workflow * style: Add chains type declaration for dev example * chore: test docs release workflow * chore: Test docs release workflow * chore: test docs release workflow * chore: test docs release workflow * test: test alpha release * chore: update versions (alpha) (#39) Co-authored-by: github-actions[bot] * docs: Update docs * fix: fix theme `auto` mode issue & fix walletConnect chains error * fix: fixed `WalletConnect` automatic connection issue * chore: Update dependencies versions * chore: update versions (alpha) (#41) Co-authored-by: github-actions[bot] * chore: prettier & eslint ignore changeset's md files * fix: No need refresh when open WalletConnect Modal in QRCode page * chore: Add vconsole for dev demo * fix: fixed trustwallet losing status after refreshing * chore: update release info * fix: Fixed trustwallet losing account status after refreshing (#44) * chore: prettier & eslint ignore changeset's md files * fix: No need refresh when open WalletConnect Modal in QRCode page * chore: Add vconsole for dev demo * fix: fixed trustwallet losing status after refreshing * chore: update release info * chore: update versions (alpha) (#45) Co-authored-by: github-actions[bot] * style: Update log output styles * style: Add switchNetwork log * refactor: update the `installed` field that detect whether wallet is installed to a function * fix: fixed conflict issue between trustwallet and metaMask * docs: update release docs * Dev (#47) * chore: prettier & eslint ignore changeset's md files * fix: No need refresh when open WalletConnect Modal in QRCode page * chore: Add vconsole for dev demo * fix: fixed trustwallet losing status after refreshing * chore: update release info * style: Update log output styles * style: Add switchNetwork log * refactor: update the `installed` field that detect whether wallet is installed to a function * fix: fixed conflict issue between trustwallet and metaMask * docs: update release docs * chore: update versions (alpha) (#48) Co-authored-by: github-actions[bot] * docs: Add tests for adding new wallet * Dev (#49) * chore: prettier & eslint ignore changeset's md files * fix: No need refresh when open WalletConnect Modal in QRCode page * chore: Add vconsole for dev demo * fix: fixed trustwallet losing status after refreshing * chore: update release info * style: Update log output styles * style: Add switchNetwork log * refactor: update the `installed` field that detect whether wallet is installed to a function * fix: fixed conflict issue between trustwallet and metaMask * docs: update release docs * docs: Add tests for adding new wallet * docs: Update contributing * docs: Add test result table to PULL_REQUEST_TEMPLATE * fix: fixed multiple wallet conflicts resulting in undetectable issues * chore: Add changeset log * fix: Fixed multiple wallets conficts resulting in undetectable issues. (#51) * docs: Add test result table to PULL_REQUEST_TEMPLATE * fix: fixed multiple wallet conflicts resulting in undetectable issues * chore: Add changeset log * chore: update versions (alpha) (#52) Co-authored-by: github-actions[bot] * fix: Fixed TrustWallet will automatically reconnect after reloading the page. (#53) * docs: Add test result table to PULL_REQUEST_TEMPLATE * fix: fixed multiple wallet conflicts resulting in undetectable issues * chore: Add changeset log * chore: update versions (alpha) (#54) Co-authored-by: github-actions[bot] * feat: add `action` prop to WalletKitButton & WalletKitButton.Custom to support the case of adding network. * Add `action` prop to WalletKitButton & WalletKitButton.Custom to support the case of adding network. (#56) * docs: Add test result table to PULL_REQUEST_TEMPLATE * fix: fixed multiple wallet conflicts resulting in undetectable issues * chore: Add changeset log * feat: add `action` prop to WalletKitButton & WalletKitButton.Custom to support the case of adding network. * chore: update versions (alpha) (#57) Co-authored-by: github-actions[bot] * fix: fix theme configuration naming error issue * docs: Add changeset docs * build: release * fix: Fixed modal flickering issue in grid layout. --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] --- .changeset/afraid-crabs-pump.md | 5 +++++ .changeset/cold-rockets-knock.md | 5 +++++ .changeset/famous-drinks-behave.md | 5 +++++ .changeset/happy-hounds-complain.md | 5 +++++ .changeset/honest-numbers-hug.md | 5 +++++ .changeset/late-birds-compare.md | 5 +++++ .changeset/lovely-months-argue.md | 5 +++++ .changeset/modern-comics-smell.md | 5 +++++ .changeset/pre.json | 19 +++++++++++++++++++ .changeset/pretty-flowers-rhyme.md | 5 +++++ .../components/WalletKitProvider/context.ts | 1 + .../components/WalletKitProvider/index.tsx | 5 ++++- .../walletkit/src/pages/Connectors/index.tsx | 4 +--- 13 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 .changeset/afraid-crabs-pump.md create mode 100644 .changeset/cold-rockets-knock.md create mode 100644 .changeset/famous-drinks-behave.md create mode 100644 .changeset/happy-hounds-complain.md create mode 100644 .changeset/honest-numbers-hug.md create mode 100644 .changeset/late-birds-compare.md create mode 100644 .changeset/lovely-months-argue.md create mode 100644 .changeset/modern-comics-smell.md create mode 100644 .changeset/pre.json create mode 100644 .changeset/pretty-flowers-rhyme.md diff --git a/.changeset/afraid-crabs-pump.md b/.changeset/afraid-crabs-pump.md new file mode 100644 index 00000000..c9bc7057 --- /dev/null +++ b/.changeset/afraid-crabs-pump.md @@ -0,0 +1,5 @@ +--- +'@totejs/walletkit': patch +--- + +Fixed theme configuration naming error issue diff --git a/.changeset/cold-rockets-knock.md b/.changeset/cold-rockets-knock.md new file mode 100644 index 00000000..6ebe2b36 --- /dev/null +++ b/.changeset/cold-rockets-knock.md @@ -0,0 +1,5 @@ +--- +'@totejs/walletkit': patch +--- + +Fixed modal flickering issue in grid layout. diff --git a/.changeset/famous-drinks-behave.md b/.changeset/famous-drinks-behave.md new file mode 100644 index 00000000..d53113e8 --- /dev/null +++ b/.changeset/famous-drinks-behave.md @@ -0,0 +1,5 @@ +--- +'@totejs/walletkit': patch +--- + +Fixed TrustWallet will automatically reconnect after reloading the page. diff --git a/.changeset/happy-hounds-complain.md b/.changeset/happy-hounds-complain.md new file mode 100644 index 00000000..17ddadad --- /dev/null +++ b/.changeset/happy-hounds-complain.md @@ -0,0 +1,5 @@ +--- +'@totejs/walletkit': patch +--- + +refactor: update the `installed` field that detect whether wallet is installed to a function diff --git a/.changeset/honest-numbers-hug.md b/.changeset/honest-numbers-hug.md new file mode 100644 index 00000000..12669d36 --- /dev/null +++ b/.changeset/honest-numbers-hug.md @@ -0,0 +1,5 @@ +--- +'@totejs/walletkit': patch +--- + +Fixed multiple wallets conficts resulting in undetectable issues. diff --git a/.changeset/late-birds-compare.md b/.changeset/late-birds-compare.md new file mode 100644 index 00000000..2471f4e7 --- /dev/null +++ b/.changeset/late-birds-compare.md @@ -0,0 +1,5 @@ +--- +'@totejs/walletkit': patch +--- + +Fixed `WalletConnect` automatic connection issue in the follow scenario: connect the WalletConnect -> close browser -> reopen browser -> disconnect -> select WalletConnect, will automatically connect. diff --git a/.changeset/lovely-months-argue.md b/.changeset/lovely-months-argue.md new file mode 100644 index 00000000..8674cc05 --- /dev/null +++ b/.changeset/lovely-months-argue.md @@ -0,0 +1,5 @@ +--- +'@totejs/walletkit': patch +--- + +Fixed trustwallet losing account status after refreshing diff --git a/.changeset/modern-comics-smell.md b/.changeset/modern-comics-smell.md new file mode 100644 index 00000000..55dfc42c --- /dev/null +++ b/.changeset/modern-comics-smell.md @@ -0,0 +1,5 @@ +--- +'@totejs/walletkit': patch +--- + +Fixed conflict issue between trustwallet and metaMask. diff --git a/.changeset/pre.json b/.changeset/pre.json new file mode 100644 index 00000000..06ad5de3 --- /dev/null +++ b/.changeset/pre.json @@ -0,0 +1,19 @@ +{ + "mode": "exit", + "tag": "alpha", + "initialVersions": { + "example-nextjs": "0.0.1", + "example-vite": "0.0.1", + "@totejs/walletkit": "1.0.7-alpha.2", + "website": "0.0.1" + }, + "changesets": [ + "famous-drinks-behave", + "happy-hounds-complain", + "honest-numbers-hug", + "late-birds-compare", + "lovely-months-argue", + "modern-comics-smell", + "pretty-flowers-rhyme" + ] +} diff --git a/.changeset/pretty-flowers-rhyme.md b/.changeset/pretty-flowers-rhyme.md new file mode 100644 index 00000000..261fa305 --- /dev/null +++ b/.changeset/pretty-flowers-rhyme.md @@ -0,0 +1,5 @@ +--- +'@totejs/walletkit': patch +--- + +Add `action` prop to WalletKitButton & WalletKitButton.Custom to support the case of adding network. diff --git a/packages/walletkit/src/components/WalletKitProvider/context.ts b/packages/walletkit/src/components/WalletKitProvider/context.ts index fa7cf50b..a61faf62 100644 --- a/packages/walletkit/src/components/WalletKitProvider/context.ts +++ b/packages/walletkit/src/components/WalletKitProvider/context.ts @@ -29,6 +29,7 @@ export interface WalletKitOptions { export interface WalletKitContextProps { options: WalletKitOptions; supportedChains: ChainProps[]; + isMobileLayout: boolean; action: Action; setAction: (action: Action) => void; diff --git a/packages/walletkit/src/components/WalletKitProvider/index.tsx b/packages/walletkit/src/components/WalletKitProvider/index.tsx index f357fec8..ba196ffb 100644 --- a/packages/walletkit/src/components/WalletKitProvider/index.tsx +++ b/packages/walletkit/src/components/WalletKitProvider/index.tsx @@ -10,6 +10,7 @@ import { RouteProvider } from '../RouteProvider'; import { ThemeVariant, ThemeMode, ThemeProvider } from '../ThemeProvider'; import { WalletKitModal } from '../WalletKitModal'; import { WalletKitOptions, WalletKitContextProps, WalletKitContext, Action } from './context'; +import { useResponsive } from '@/base/hooks/useResponsive'; export interface WalletKitProviderProps { options: WalletKitOptions; @@ -34,6 +35,7 @@ export const WalletKitProvider = (props: WalletKitProviderProps) => { const [selectedConnector, setSelectedConnector] = useState({} as Connector); const chains = useChains(); + const { isMobileLayout } = useResponsive(); const value = useMemo(() => { const finalOptions = getDefaultProviderOptions(options); @@ -44,13 +46,14 @@ export const WalletKitProvider = (props: WalletKitProviderProps) => { log: debugMode ? console.log : () => {}, options: finalOptions, supportedChains: finalChains, + isMobileLayout, action, setAction, selectedConnector, setSelectedConnector, }; return finalValue; - }, [options, chains, debugMode, action, selectedConnector]); + }, [options, chains, debugMode, isMobileLayout, action, selectedConnector]); return ( diff --git a/packages/walletkit/src/pages/Connectors/index.tsx b/packages/walletkit/src/pages/Connectors/index.tsx index 81eac6c4..b03b94e8 100644 --- a/packages/walletkit/src/pages/Connectors/index.tsx +++ b/packages/walletkit/src/pages/Connectors/index.tsx @@ -1,6 +1,5 @@ import { Box } from '@/base/components/Box'; import { ModalHeader } from '@/base/components/Modal/ModalHeader'; -import { useResponsive } from '@/base/hooks/useResponsive'; import { Navbar } from '@/components/Navbar'; import { useWalletKitContext, cx } from '@/index'; import { useConnect } from 'wagmi'; @@ -11,9 +10,8 @@ import { LIST_LAYOUT_THRESHOLD } from '@/constants/common'; export function ConnectorsPage() { const { connectors } = useConnect(); - const { options } = useWalletKitContext(); + const { options, isMobileLayout } = useWalletKitContext(); - const { isMobileLayout } = useResponsive(); const visibleConnectors = connectors.filter((c) => !!c._wallet); const useGridLayout = visibleConnectors.length > LIST_LAYOUT_THRESHOLD || isMobileLayout;