diff --git a/src/pages/block-sync/block-sync.html b/src/pages/block-sync/block-sync.html index 0cd586a..1e7d429 100644 --- a/src/pages/block-sync/block-sync.html +++ b/src/pages/block-sync/block-sync.html @@ -3,7 +3,7 @@ - Synchronisation des blocs - LeCoffre + Synchronisation des Blocs - LeCoffre
-

🔄 Synchronisation des blocs

-

Synchronisation du wallet avec la blockchain

+

🔄 Synchronisation des Blocs

+

Synchronisation avec le réseau Bitcoin pour récupérer l'historique des transactions

- 🔄 Initialisation en cours... + 🔄 Initialisation de la synchronisation...
- - - - -
- -
diff --git a/src/pages/pairing/pairing.ts b/src/pages/pairing/pairing.ts index 668a9e6..5ca5b10 100644 --- a/src/pages/pairing/pairing.ts +++ b/src/pages/pairing/pairing.ts @@ -6,21 +6,18 @@ import { displayEmojis, generateCreateBtn, addressToEmoji, prepareAndSendPairing import { getCorrectDOM } from '../../utils/html.utils'; import { IframePairingComponent } from '../../components/iframe-pairing/iframe-pairing'; import { checkPBKDF2Key, checkWalletWithRetries } from '../../utils/prerequisites.utils'; -import { createPageTemplate } from '../../utils/page-template.utils'; import loginHtml from '../home/home.html?raw'; // Extend WindowEventMap to include custom events declare global { interface WindowEventMap { 'pairing-words-generated': CustomEvent; - 'pairing-status-update': CustomEvent; 'pairing-success': CustomEvent; 'pairing-error': CustomEvent; } } let isInitializing = false; -let pageTemplate: any; document.addEventListener('DOMContentLoaded', async () => { if (isInitializing) { @@ -31,12 +28,19 @@ document.addEventListener('DOMContentLoaded', async () => { isInitializing = true; console.log('🔐 Pairing page loaded'); - // Initialiser le template de page - pageTemplate = createPageTemplate(); + const status = document.getElementById('status') as HTMLElement; + const contentArea = document.getElementById('contentArea') as HTMLElement; + + function updateStatus(message: string, type: 'loading' | 'success' | 'error') { + if (status) { + status.textContent = message; + status.className = `status ${type}`; + } + } // Vérifier les prérequis en base de données console.log('🔍 Verifying prerequisites...'); - pageTemplate.updateStatus('🔍 Vérification des prérequis...', 'loading'); + updateStatus('🔍 Vérification des prérequis...', 'loading'); try { console.log('🔧 Getting device reader service...'); @@ -46,7 +50,7 @@ document.addEventListener('DOMContentLoaded', async () => { const pbkdf2KeyResult = await checkPBKDF2Key(); if (!pbkdf2KeyResult) { console.log('⚠️ PBKDF2 key not found, redirecting to security-setup...'); - pageTemplate.updateStatus('⚠️ Redirection vers la configuration de sécurité...', 'loading'); + updateStatus('⚠️ Redirection vers la configuration de sécurité...', 'loading'); setTimeout(() => { window.location.href = '/src/pages/security-setup/security-setup.html'; }, 1000); @@ -57,7 +61,7 @@ document.addEventListener('DOMContentLoaded', async () => { const wallet = await checkWalletWithRetries(); if (!wallet) { console.log('⚠️ Wallet still not found after retries, redirecting to wallet-setup...'); - pageTemplate.updateStatus('⚠️ Redirection vers la configuration du wallet...', 'loading'); + updateStatus('⚠️ Redirection vers la configuration du wallet...', 'loading'); setTimeout(() => { window.location.href = '/src/pages/wallet-setup/wallet-setup.html'; }, 1000); @@ -74,7 +78,7 @@ document.addEventListener('DOMContentLoaded', async () => { // Vérifier que le birthday est configuré (> 0) if (!wallet.sp_wallet.birthday || wallet.sp_wallet.birthday === 0) { console.log('⚠️ Birthday not configured, redirecting to birthday-setup...'); - pageTemplate.updateStatus('⚠️ Redirection vers la configuration de la date anniversaire...', 'loading'); + updateStatus('⚠️ Redirection vers la configuration de la date anniversaire...', 'loading'); setTimeout(() => { window.location.href = '/src/pages/birthday-setup/birthday-setup.html'; }, 1000); @@ -84,24 +88,28 @@ document.addEventListener('DOMContentLoaded', async () => { console.log('✅ All prerequisites verified for pairing page'); // Charger le contenu de pairing depuis home.html - pageTemplate.updateStatus('🔄 Initialisation du pairing...', 'loading'); + updateStatus('🔄 Initialisation du pairing...', 'loading'); // Injecter le contenu de pairing dans la zone de contenu - pageTemplate.setContent(loginHtml); + if (contentArea) { + contentArea.innerHTML = loginHtml; + } // Importer et initialiser la logique de pairing depuis home.ts const { initHomePage } = await import('../home/home'); await initHomePage(); - pageTemplate.updateStatus('✅ Prêt pour le pairing', 'success'); + updateStatus('✅ Prêt pour le pairing', 'success'); setTimeout(() => { - pageTemplate.hideStatus(); + if (status) { + status.style.display = 'none'; + } }, 2000); console.log('✅ Pairing page initialization completed'); } catch (error) { console.error('❌ Error initializing pairing page:', error); - pageTemplate.updateStatus(`❌ Erreur: ${(error as Error).message}`, 'error'); + updateStatus(`❌ Erreur: ${(error as Error).message}`, 'error'); // Si l'erreur est liée aux prérequis, rediriger vers la page appropriée const errorMessage = (error as Error).message; @@ -124,4 +132,4 @@ document.addEventListener('DOMContentLoaded', async () => { } finally { isInitializing = false; } -}); +}); \ No newline at end of file diff --git a/src/utils/page-template.utils.ts b/src/utils/page-template.utils.ts index 545e9f9..c93fe00 100644 --- a/src/utils/page-template.utils.ts +++ b/src/utils/page-template.utils.ts @@ -111,7 +111,7 @@ export class PageTemplate { this.continueBtn.textContent = text; this.continueBtn.style.display = 'block'; this.continueBtn.disabled = false; - + if (onClick) { this.continueBtn.onclick = onClick; }