Улучшить дизайн по мелочи

This commit is contained in:
AidarKC
2026-10-07 23:46:53 +03:00
parent d8f42c769c
commit dda21a54ff
20 changed files with 1228 additions and 142 deletions
+34 -15
View File
@@ -12,9 +12,10 @@ import {
import { clearStoredMessages } from '../services/message-store.js';
import { toUserMessage } from '../services/ui-error-texts.js';
import {
createSolanaWalletFromPrivateBase58,
formatSol,
getBalanceSol,
getTopupSiteUrl,
transferSol,
} from '../services/solana-wallet-service.js';
import { loadSolanaWeb3 } from '../vendor/solana-web3-loader.js';
import {
@@ -28,7 +29,10 @@ import { defaultServerLogin } from '../deploy-config.js';
export const pageMeta = { id: 'registration-payment-view', title: 'Оплата регистрации', showAppChrome: false };
const MIN_REQUIRED_SOL = 0.01;
const RECOMMENDED_TOPUP_SOL = 0.02;
const RECOMMENDED_TOPUP_SOL = 0.2;
const TEST_TOPUP_AMOUNT_SOL = 0.2;
const DEVNET_ENDPOINT = 'https://api.devnet.solana.com';
const TEST_TOPUP_SENDER_PRIVATE_32_BASE58 = '6xqAuKYvA8qrCdAkcw7Y8aMgvBnYk8JLxWLma5BzbAvu';
const AUTO_LOGIN_INITIAL_DELAY_MS = 1000;
const AUTO_LOGIN_RETRY_MS = 2000;
const REGISTRATION_PROGRESS_DURATION_MS = 12000;
@@ -256,22 +260,38 @@ export function render({ navigate }) {
const topupButton = document.createElement('button');
topupButton.className = 'ghost-btn';
topupButton.type = 'button';
topupButton.textContent = 'Пополнить кошелёк';
topupButton.textContent = 'Тестовое пополнение (пока доступно в тестовом режиме)';
topupButton.addEventListener('click', async () => {
status.style.display = 'none';
topupButton.disabled = true;
const defaultText = 'Тестовое пополнение (пока доступно в тестовом режиме)';
topupButton.textContent = 'Пополняем...';
try {
await deriveUserWalletAddress();
navigate('topup-view');
const address = await deriveUserWalletAddress();
const sender = await createSolanaWalletFromPrivateBase58(TEST_TOPUP_SENDER_PRIVATE_32_BASE58);
await transferSol({
endpoint: DEVNET_ENDPOINT,
fromKeypair: sender.keypair,
toAddress: address,
amountSol: TEST_TOPUP_AMOUNT_SOL,
});
const balance = await getBalanceSol({
endpoint: DEVNET_ENDPOINT,
address,
});
state.registrationPayment.balanceSOL = String(balance.sol);
balanceValue.textContent = `${formatSol(balance.sol, 6)} SOL`;
status.className = 'status-line is-available';
status.textContent = `Тестовое пополнение выполнено: +${TEST_TOPUP_AMOUNT_SOL} SOL. Баланс: ${formatSol(balance.sol, 6)} SOL.`;
status.style.display = '';
} catch (error) {
showWalletError(error, 'Не удалось подготовить кошелёк. Попробуйте ещё раз.');
showWalletError(error, 'Не удалось выполнить тестовое пополнение. Попробуйте ещё раз.');
} finally {
topupButton.disabled = false;
topupButton.textContent = defaultText;
}
});
const showKeysButton = document.createElement('button');
showKeysButton.className = 'ghost-btn';
showKeysButton.type = 'button';
showKeysButton.textContent = 'Показать сгенерированные ключи';
showKeysButton.addEventListener('click', () => navigate('registration-draft-keys-view'));
const submitButton = document.createElement('button');
submitButton.className = 'primary-btn';
submitButton.type = 'button';
@@ -301,8 +321,7 @@ export function render({ navigate }) {
: `Для регистрации пополните этот кошелёк соланами примерно на ${RECOMMENDED_TOPUP_SOL} SOL. Сейчас на кошельке ${formatSol(currentBalance, 6)} SOL. Минимум для продолжения: ${MIN_REQUIRED_SOL} SOL.`;
status.style.display = '';
if (isTestContour) {
const openTopup = window.confirm('Перейти на экран пополнения и затем продолжить регистрацию?');
if (openTopup) navigate('topup-view');
status.textContent += ` Нажмите «Тестовое пополнение», чтобы сразу добавить ${TEST_TOPUP_AMOUNT_SOL} SOL без перехода на другой экран.`;
}
return;
}
@@ -370,7 +389,7 @@ export function render({ navigate }) {
if (isTestContour) {
card.append(topupButton);
}
card.append(showKeysButton, submitButton, status);
card.append(submitButton, status);
screen.append(
createTopBar({