diff --git a/src/components/connectOverlay/ConnectOverlay.tsx b/src/components/connectOverlay/ConnectOverlay.tsx index 729e0b3..1abd12c 100644 --- a/src/components/connectOverlay/ConnectOverlay.tsx +++ b/src/components/connectOverlay/ConnectOverlay.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useEffect, useState } from 'react'; import axios from 'axios'; import WebApp from '@twa-dev/sdk'; import { PulseLoader } from 'react-spinners'; @@ -43,11 +43,22 @@ const ConnectOverlay: React.FC = ({ close, onConnect, }) => { + // Redux const connectionState = useSelector( (state: RootState) => state.connection.connectionState ); const dispatch = useDispatch(); + // Dark Mode + const [darkMode, setDarkMode] = useState( + WebApp.colorScheme === 'dark' + ); + useEffect(() => { + setDarkMode(WebApp.colorScheme === 'dark'); + document.documentElement.classList.toggle('dark', darkMode); + localStorage.setItem('theme', darkMode ? 'dark' : 'light'); + }, [WebApp.colorScheme]); + const [networksExpanded, setNetworksExpanded] = useState(true); const [ethereumWalletsExpanded, setEthereumWalletsExpanded] = useState(false); @@ -202,30 +213,39 @@ const ConnectOverlay: React.FC = ({ }; return ( -
+
{connectionState === 'connecting' && ( -

+

Connecting

)} {connectionState === 'disconnected' && ( -

+

Connect Wallet

)} {connectionState === 'connected' && ( -

+

Account Details

)} {connectionState === 'error' && ( -

+

Connection Error

)} {connectionState === 'retrying' && ( -

+

Retrying

)} @@ -243,10 +263,12 @@ const ConnectOverlay: React.FC = ({
-

Connecting Wallet

+

+ Connecting Wallet +

-

+

Please connect your Wallet & approve transaction

@@ -255,7 +277,7 @@ const ConnectOverlay: React.FC = ({ {connectionState === 'disconnected' && ( <>
-

+

Choose Network

= ({
)}
-

+

Select Wallet

= ({ alt="" />
- {account &&

{truncateText(account, 8, 8)}

} + {account && ( +

+ {truncateText(account, 8, 8)} +

+ )}
= ({ onClick={copyAccountToClipboard} > -

+

Copy Address

@@ -365,7 +391,7 @@ const ConnectOverlay: React.FC = ({ onClick={viewOnExplorer} > -

+

View on explorer

@@ -373,7 +399,7 @@ const ConnectOverlay: React.FC = ({
-

+

Connected with{' '} {window.localStorage.getItem('walletProvider')}

@@ -393,11 +419,11 @@ const ConnectOverlay: React.FC = ({
-

+

An Unwanted Error Occurred

-
+

Wallet not connected.

Please try again

diff --git a/src/components/connectOverlay/NetworkBadge.tsx b/src/components/connectOverlay/NetworkBadge.tsx index 55f566b..b4843d1 100644 --- a/src/components/connectOverlay/NetworkBadge.tsx +++ b/src/components/connectOverlay/NetworkBadge.tsx @@ -37,7 +37,7 @@ const NetworkBadge: React.FC = ({ style={{ backgroundColor: selected ? backgroundColor : '' }} > -

{network}

+

{network}

); }; diff --git a/src/components/connectOverlay/WalletBadge.tsx b/src/components/connectOverlay/WalletBadge.tsx index dea9ee8..db5b157 100644 --- a/src/components/connectOverlay/WalletBadge.tsx +++ b/src/components/connectOverlay/WalletBadge.tsx @@ -34,7 +34,7 @@ const WalletBadge: React.FC = ({ style={{ backgroundColor: selected ? backgroundColor : '' }} > -

{walletName}

+

{walletName}

); }; diff --git a/tailwind.config.js b/tailwind.config.js index 6ef468c..934fe62 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -1,5 +1,6 @@ /** @type {import('tailwindcss').Config} */ export default { + darkMode: 'class', content: ['./src/**/*.{js,jsx,ts,tsx}', './public/index.html'], theme: { extend: { @@ -18,6 +19,8 @@ export default { customBlueSelected: '#B9C1F4', customGrayLine: '#c6c6c6', customGrayAccountDetails: '#616161', + customDarkModeBackground: '#262233', + customDarkModeTextColor: '#DEDEDE', }, gridTemplateColumns: { 'custom-1-3-1': '1fr 3fr 1fr', diff --git a/vite.config.ts b/vite.config.ts index f5ef820..482c5cc 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -9,4 +9,7 @@ export default defineConfig({ outDir: './docs', }, base: './', + server: { + port: 5174, + }, });