diff --git a/.gitignore b/.gitignore index b500355..0add2f2 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,5 @@ yarn-error.log* next-env.d.ts .idea/ + +certificates \ No newline at end of file diff --git a/components/react/authSignerModal.tsx b/components/react/authSignerModal.tsx index c11745c..5a72c76 100644 --- a/components/react/authSignerModal.tsx +++ b/components/react/authSignerModal.tsx @@ -1,12 +1,10 @@ -import { Fragment, useEffect } from 'react'; -import { Dialog, Transition } from '@headlessui/react'; +import { useEffect } from 'react'; import { SignData } from '@cosmos-kit/web3auth'; -import { SignDoc } from '@liftedinit/manifestjs/dist/codegen/cosmos/tx/v1beta1/tx'; import { TxBody, AuthInfo } from '@liftedinit/manifestjs/dist/codegen/cosmos/tx/v1beta1/tx'; import { decodePubkey } from '@cosmjs/proto-signing'; import { useWallet, useChain } from '@cosmos-kit/react'; -import Image from 'next/image'; import { getRealLogo } from '@/utils'; +import { useTheme } from '@/contexts'; type DisplayDataToSignProps = { data: SignData; @@ -121,6 +119,7 @@ const SignModal = ({ const { address } = useChain('manifest'); const walletIcon = wallet.wallet?.logo; const walletName = wallet.wallet?.prettyName; + const { theme } = useTheme(); useEffect(() => { const modal = document.getElementById('sign-modal') as HTMLDialogElement; @@ -138,7 +137,11 @@ const SignModal = ({
- Wallet type logo + Wallet type logo

{walletName?.toString()} Direct Signer

-
-

v{version}

+
+ +

v{version}

+ +
+ + {'Discord'} + + + {'Twitter'} + +
diff --git a/components/react/views/Connected.tsx b/components/react/views/Connected.tsx index 4342420..dd2f2fb 100644 --- a/components/react/views/Connected.tsx +++ b/components/react/views/Connected.tsx @@ -9,6 +9,7 @@ import { getRealLogo, shiftDigits, truncateString } from '@/utils'; import Image from 'next/image'; import { MdContacts } from 'react-icons/md'; import { Contacts } from './Contacts'; +import { useTheme } from '@/contexts'; export const Connected = ({ onClose, @@ -30,6 +31,7 @@ export const Connected = ({ const { balance } = useBalance(address ?? ''); const [copied, setCopied] = useState(false); const [showContacts, setShowContacts] = useState(false); + const { theme } = useTheme(); const copyAddress = () => { if (address) { @@ -57,7 +59,9 @@ export const Connected = ({ {name} diff --git a/components/react/views/Connecting.tsx b/components/react/views/Connecting.tsx index dbc1fd3..975bc45 100644 --- a/components/react/views/Connecting.tsx +++ b/components/react/views/Connecting.tsx @@ -4,6 +4,7 @@ import { Dialog } from '@headlessui/react'; import { XMarkIcon } from '@heroicons/react/24/outline'; import { ChevronLeftIcon } from '@heroicons/react/20/solid'; import { getRealLogo } from '@/utils'; +import { useTheme } from '@/contexts'; export const Connecting = ({ onClose, @@ -20,6 +21,7 @@ export const Connecting = ({ title: string; subtitle: string; }) => { + const { theme } = useTheme(); return (
@@ -43,7 +45,9 @@ export const Connecting = ({
{name} diff --git a/components/react/views/Error.tsx b/components/react/views/Error.tsx index 6865bb6..a6618c8 100644 --- a/components/react/views/Error.tsx +++ b/components/react/views/Error.tsx @@ -5,6 +5,7 @@ import { XMarkIcon, ArrowPathIcon } from '@heroicons/react/24/outline'; import { ChevronLeftIcon } from '@heroicons/react/20/solid'; import Image from 'next/image'; import { getRealLogo } from '@/utils'; +import { useTheme } from '@/contexts'; export const Error = ({ currentWalletName, onClose, @@ -18,6 +19,7 @@ export const Error = ({ onReconnect: () => void; logo: string; }) => { + const { theme } = useTheme(); return (
@@ -45,11 +47,13 @@ export const Error = ({
Wallet type logo { + const { theme } = useTheme(); return (
@@ -40,7 +42,9 @@ export const NotExist = ({
{name} diff --git a/components/react/views/WalletList.tsx b/components/react/views/WalletList.tsx index 1124235..891c3fb 100644 --- a/components/react/views/WalletList.tsx +++ b/components/react/views/WalletList.tsx @@ -13,6 +13,7 @@ export const WalletList = ({ onWalletClicked: (name: string, isMobileConnect?: boolean) => void; wallets: ChainWalletBase[]; }) => { + // Can't use `useTheme` here because it's not wrapped in a ThemeProvider const isDarkMode = document.documentElement.classList.contains('dark'); const social = wallets.filter(wallet => @@ -53,6 +54,7 @@ export const WalletList = ({
{browser.map(({ walletInfo: { name, prettyName, logo } }) => ( +
+ ))}
@@ -99,7 +102,7 @@ export const WalletList = ({ className="flex items-center justify-center p-4 dark:bg-[#ffffff0c] bg-[#f0f0ff5c] dark:hover:bg-[#0000004c] hover:bg-[#a8a8a84c] rounded-lg transition" > {prettyName} @@ -118,7 +121,7 @@ export const WalletList = ({ className="flex items-center w-full p-3 rounded-lg dark:bg-[#ffffff0c] bg-[#f0f0ff5c] dark:hover:bg-[#0000004c] hover:bg-[#a8a8a84c] transition" > {prettyName} @@ -138,7 +141,7 @@ export const WalletList = ({ className="flex items-center justify-center p-4 dark:bg-[#ffffff0c] bg-[#f0f0ff5c] dark:hover:bg-[#0000004c] hover:bg-[#a8a8a84c] rounded-lg transition" > {prettyName} diff --git a/utils/logos.ts b/utils/logos.ts index 153a5ca..66ecc57 100644 --- a/utils/logos.ts +++ b/utils/logos.ts @@ -1,10 +1,9 @@ import { ExtendedValidatorSDKType } from '@/components'; -export const getRealLogo = (logo: string) => { - const isDarkMode = document.documentElement.classList.contains('dark'); +export const getRealLogo = (logo: string, isDarkMode?: boolean) => { const localAndHasExtension = /^\/(?!.*\.[0-9a-z]+$)/i.test(logo); return localAndHasExtension - ? isDarkMode + ? isDarkMode === true ? logo?.toString() + '_light.svg' : logo?.toString() + '_dark.svg' : logo;