diff --git a/src/components/ToolTipGuide.css b/src/components/ToolTipGuide.css new file mode 100644 index 0000000..721c13b --- /dev/null +++ b/src/components/ToolTipGuide.css @@ -0,0 +1,3 @@ +.force-opacity-1 { + opacity: 1 !important; +} \ No newline at end of file diff --git a/src/components/TooltipGuide.tsx b/src/components/TooltipGuide.tsx index f43ce34..a0bf88b 100644 --- a/src/components/TooltipGuide.tsx +++ b/src/components/TooltipGuide.tsx @@ -1,5 +1,6 @@ import { useState, useEffect, type ReactNode } from 'react' import { Tooltip } from 'react-tooltip' +import './ToolTipGuide.css' export interface TooltipStep { id: string @@ -43,13 +44,24 @@ const TooltipGuide = ({ } } + const handleSkip = () => { + setShowTooltips(false) + onComplete?.() + } + const renderTooltipContent = (content: string) => { return (
{content}
-
+
+ +
+ + + {showWalletList && ( +
+ {connectionError && ( +
+ {connectionError} +
+ )} + span { + padding: 10px 24px; + color: #ffffff; + border: 1px solid rgba(255, 255, 255, 0.2); + border-radius: 6px; + margin-bottom: 12px; + display: flex; + align-items: center; + justify-content: center; + gap: 8px; + background: transparent; + backdrop-filter: blur(10px); + transition: all 0.2s ease; + cursor: pointer; + } + & > span:hover { + background: rgba(255, 255, 255, 0.1); + border-color: rgba(255, 255, 255, 0.3); + } + `} + /> +
+ )} +
) } return ( - +
+ + + {showWalletList && ( +
+ span { + padding: 10px 12px; + color: #ffffff; + border: 1px solid rgba(255, 255, 255, 0.2); + border-radius: 6px; + margin-bottom: 10px; + display: flex; + align-items: center; + justify-content: start; + gap: 8px; + background: transparent; + backdrop-filter: blur(10px); + transition: all 0.2s ease; + cursor: pointer; + opacity: 0; + transform: translateY(-10px); + animation: cascadeIn 0.4s ease-out forwards; + } + & > span:nth-child(1) { animation-delay: 0.02s; } + & > span:nth-child(2) { animation-delay: 0.08s; } + & > span:nth-child(3) { animation-delay: 0.12s; } + & > span:nth-child(4) { animation-delay: 0.17s; } + & > span:nth-child(5) { animation-delay: 0.22s; } + & > span:nth-child(6) { animation-delay: 0.27s; } + & > span:hover { + background: rgba(255, 255, 255, 0.1); + border-color: rgba(255, 255, 255, 0.3); + transform: translateY(-2px); + } + @keyframes cascadeIn { + from { + opacity: 0; + transform: translateY(-10px); + } + to { + opacity: 1; + transform: translateY(0); + } + } + `} + /> +
+ )} +
) } diff --git a/src/stores/walletStore.ts b/src/stores/walletStore.ts index 570dcaf..68ddaed 100644 --- a/src/stores/walletStore.ts +++ b/src/stores/walletStore.ts @@ -71,7 +71,36 @@ export const useWalletStore = create()( const walletApi = await window.cardano[walletName].enable() - const stakeAddresses = await walletApi.getRewardAddresses() + await new Promise(resolve => setTimeout(resolve, 100)) + + let stakeAddresses: string[] = [] + let retries = 3 + + while (retries > 0) { + try { + stakeAddresses = await walletApi.getRewardAddresses() + break + } catch (error: unknown) { + retries-- + + if (error instanceof Error && (error.message.includes('account changed') || error.message.includes('Account changed'))) { + console.warn(`Account changed error for ${walletName}, retrying... (${retries} attempts left)`) + + if (retries > 0) { + await new Promise(resolve => setTimeout(resolve, 500)) + continue + } else { + const newWalletApi = await window.cardano[walletName].enable() + await new Promise(resolve => setTimeout(resolve, 200)) + stakeAddresses = await newWalletApi.getRewardAddresses() + break + } + } else { + throw error + } + } + } + const stakeAddress = stakeAddresses?.[0] || null set({ @@ -82,8 +111,12 @@ export const useWalletStore = create()( walletApi, }) - const { getBalance, getWalletAddress } = get() - await Promise.all([getBalance(), getWalletAddress()]) + try { + const { getBalance, getWalletAddress } = get() + await Promise.all([getBalance(), getWalletAddress()]) + } catch (error) { + console.warn('Failed to get balance or address, but wallet is connected:', error) + } return true } catch (error) {