SHA256
CORE/CONTENT test5593 и адаптация UI
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import { t } from '../i18n/index.js';
|
||||
import { createTopBar } from '../components/topbar.js';
|
||||
import { formatSol, getBalanceSol } from '../services/solana-wallet-service.js';
|
||||
|
||||
export const pageMeta = {id:'devnet-topup-view', get title() { return t('screens.devnet_topup_view.text_001'); }, showAppChrome:false};
|
||||
const DEVNET_ENDPOINT='https://api.devnet.solana.com';
|
||||
function readWalletFromUrl() {
|
||||
try { return new URL(window.location.href).searchParams.get('wallet')?.trim() || ''; }
|
||||
catch { return ''; }
|
||||
}
|
||||
export function render() {
|
||||
const screen=document.createElement('section');screen.className='stack registration-screen';
|
||||
const card=document.createElement('div');card.className='card stack';
|
||||
const title=document.createElement('h3');title.textContent=t('screens.devnet_topup_view.text_002');
|
||||
const note=document.createElement('p');note.className='meta-muted';
|
||||
note.textContent=t('screens.devnet_topup_view.text_003');
|
||||
const wallet=readWalletFromUrl();
|
||||
const input=document.createElement('input');input.className='input';input.readOnly=true;input.value=wallet;
|
||||
const copy=document.createElement('button');copy.className='secondary-btn';copy.textContent=t('screens.devnet_topup_view.text_004');
|
||||
copy.addEventListener('click',()=>navigator.clipboard.writeText(input.value).catch(()=>{}));
|
||||
const balance=document.createElement('p');balance.className='meta-muted';
|
||||
balance.textContent=wallet?t('screens.devnet_topup_view.text_007'):t('screens.devnet_topup_view.text_008');
|
||||
if(wallet)void getBalanceSol({endpoint:DEVNET_ENDPOINT,address:wallet})
|
||||
.then(value=>balance.textContent=t('screens.devnet_topup_view.text_009', { value1: formatSol(value.sol,6) }))
|
||||
.catch(()=>balance.textContent=t('screens.devnet_topup_view.text_005'));
|
||||
card.append(title,note,input,copy,balance);
|
||||
screen.append(createTopBar({title:t('screens.devnet_topup_view.text_006')}),card);
|
||||
return screen;
|
||||
}
|
||||
Reference in New Issue
Block a user