SHA256
Локализовать интерфейс SHiNE на русский и английский
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { t, th } from '../i18n/index.js';
|
||||
import { createTopBar } from '../components/topbar.js';
|
||||
import { showToast } from '../services/channels-ux.js';
|
||||
import { state } from '../state.js';
|
||||
@@ -9,7 +10,7 @@ import {
|
||||
import { loadSolanaWeb3 } from '../vendor/solana-web3-loader.js';
|
||||
import { actionErrorText } from '../services/ui-error-texts.js';
|
||||
|
||||
export const pageMeta = { id: 'topup-view', title: 'Пополнение solana счета', showAppChrome: false };
|
||||
export const pageMeta = { id: 'topup-view', get title() { return t('screens.topup_view.text_001'); }, showAppChrome: false };
|
||||
const DEVNET_ENDPOINT = 'https://api.devnet.solana.com';
|
||||
const REGISTRATION_TOPUP_AMOUNT_SOL = 0.02;
|
||||
|
||||
@@ -18,7 +19,7 @@ const REGISTRATION_TOPUP_AMOUNT_SOL = 0.02;
|
||||
async function blockchainWalletAddressFromBundle() {
|
||||
const keyBundle = state.registrationDraft.preGeneratedKeyBundle;
|
||||
if (!keyBundle || !keyBundle.blockchainPair) {
|
||||
throw new Error('Ключи ещё не сгенерированы. Вернитесь на экран регистрации.');
|
||||
throw new Error(t('screens.topup_view.text_013'));
|
||||
}
|
||||
const raw = atob(keyBundle.blockchainPair.publicKeyB64);
|
||||
const bytes = new Uint8Array(raw.length);
|
||||
@@ -40,7 +41,7 @@ export function render({ navigate }) {
|
||||
|
||||
const status = document.createElement('p');
|
||||
status.className = 'meta-muted';
|
||||
status.textContent = 'Проверяем кошелек...';
|
||||
status.textContent = t('screens.topup_view.text_002');
|
||||
status.style.whiteSpace = 'pre-wrap';
|
||||
status.style.overflowWrap = 'anywhere';
|
||||
status.style.wordBreak = 'break-word';
|
||||
@@ -49,16 +50,16 @@ export function render({ navigate }) {
|
||||
const copyButton = document.createElement('button');
|
||||
copyButton.className = 'ghost-btn';
|
||||
copyButton.type = 'button';
|
||||
copyButton.textContent = 'Скопировать';
|
||||
copyButton.textContent = t('screens.topup_view.text_003');
|
||||
copyButton.addEventListener('click', async () => {
|
||||
try {
|
||||
await navigator.clipboard.writeText(walletValue.value);
|
||||
copyButton.textContent = 'Скопировано';
|
||||
copyButton.textContent = t('screens.topup_view.text_004');
|
||||
window.setTimeout(() => {
|
||||
copyButton.textContent = 'Скопировать';
|
||||
copyButton.textContent = t('screens.topup_view.text_005');
|
||||
}, 1500);
|
||||
} catch {
|
||||
showToast('Не удалось скопировать номер кошелька – выделите его и скопируйте вручную.', { kind: 'error' });
|
||||
showToast(t('screens.topup_view.text_011'), { kind: 'error' });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -69,13 +70,13 @@ export function render({ navigate }) {
|
||||
const card = document.createElement('div');
|
||||
card.className = 'card stack';
|
||||
card.innerHTML = `
|
||||
<p class="auth-copy">Пополните счёт через доверенный devnet faucet и продолжите регистрацию.</p>
|
||||
<p class="auth-copy">${th('screens.topup_view.text_015')}</p>
|
||||
<div class="card stack" style="padding:12px; max-width:320px;">
|
||||
<div class="field-label" style="margin-bottom:6px;">Кошелёк для пополнения (blockchain key = Solana wallet)</div>
|
||||
<div class="field-label" style="margin-bottom:6px;">${th('screens.topup_view.text_016')}</div>
|
||||
</div>
|
||||
<div class="stack" style="gap:6px;">
|
||||
<p class="meta-muted">Или можете отдельно открыть страницу тестового пополнения.</p>
|
||||
<a class="link-card" id="topup-site-link" href="${getTopupSiteUrl(state.registrationPayment.walletAddress || '')}" target="_blank" rel="noreferrer">Открыть страницу тестового пополнения</a>
|
||||
<p class="meta-muted">${th('screens.topup_view.text_017')}</p>
|
||||
<a class="link-card" id="topup-site-link" href="${getTopupSiteUrl(state.registrationPayment.walletAddress || '')}" target="_blank" rel="noreferrer">${th('screens.topup_view.text_018')}</a>
|
||||
</div>
|
||||
`;
|
||||
card.children[1].append(walletRow);
|
||||
@@ -83,16 +84,16 @@ export function render({ navigate }) {
|
||||
const testButton = document.createElement('button');
|
||||
testButton.className = 'ghost-btn';
|
||||
testButton.type = 'button';
|
||||
testButton.textContent = 'Тестовое пополнение для регистрации';
|
||||
testButton.textContent = 'Как пополнить через devnet faucet';
|
||||
testButton.textContent = t('screens.topup_view.text_006');
|
||||
testButton.textContent = t('screens.topup_view.text_007');
|
||||
testButton.addEventListener('click', () => {
|
||||
status.textContent = 'Для пополнения скопируйте адрес блокчейн-кошелька и используйте внешний доверенный Solana devnet faucet. Приватный ключ отправителя не должен находиться в публичном приложении.';
|
||||
status.textContent = t('screens.topup_view.text_008');
|
||||
});
|
||||
|
||||
const backButton = document.createElement('button');
|
||||
backButton.className = 'primary-btn';
|
||||
backButton.type = 'button';
|
||||
backButton.textContent = 'Продолжить регистрацию';
|
||||
backButton.textContent = t('screens.topup_view.text_009');
|
||||
backButton.addEventListener('click', () => navigate('registration-payment-view'));
|
||||
|
||||
const actions = document.createElement('div');
|
||||
@@ -115,15 +116,15 @@ export function render({ navigate }) {
|
||||
address: walletValue.value,
|
||||
});
|
||||
state.registrationPayment.balanceSOL = String(balance.sol);
|
||||
status.textContent = `Текущий баланс: ${formatSol(balance.sol, 6)} SOL`;
|
||||
status.textContent = t('screens.topup_view.text_014', { value1: formatSol(balance.sol, 6) });
|
||||
} catch (error) {
|
||||
status.textContent = actionErrorText('Не удалось получить баланс', error);
|
||||
status.textContent = actionErrorText(t('screens.topup_view.text_012'), error);
|
||||
}
|
||||
})();
|
||||
|
||||
screen.append(
|
||||
createTopBar({
|
||||
title: 'Пополнение solana счета',
|
||||
title: t('screens.topup_view.text_010'),
|
||||
back: { label: '←', onClick: () => navigate('registration-payment-view') },
|
||||
}),
|
||||
card,
|
||||
|
||||
Reference in New Issue
Block a user