SHA256
Добавить трёхшаговый UI регистрации
This commit is contained in:
@@ -0,0 +1,82 @@
|
||||
import { createTopBar } from '../components/topbar.js';
|
||||
import { state } from '../state.js';
|
||||
|
||||
export const pageMeta = { id: 'registration-choice-view', title: 'Тип аккаунта', showAppChrome: false };
|
||||
|
||||
export function render({ navigate }) {
|
||||
const screen = document.createElement('section');
|
||||
screen.className = 'stack registration-screen signup-choice';
|
||||
const title = document.createElement('h1');
|
||||
title.className = 'signup-title';
|
||||
title.textContent = 'Выберите тип аккаунта';
|
||||
const intro = document.createElement('p');
|
||||
intro.className = 'signup-lead';
|
||||
intro.textContent = 'Оба варианта позволяют пользоваться SHiNE. Главное отличие — независимость аккаунта от сервера.';
|
||||
|
||||
function card({ type, icon, heading, price, lead, perks, button }) {
|
||||
const box = document.createElement('article');
|
||||
box.className = `signup-plan signup-plan--${type}`;
|
||||
const top = document.createElement('div');
|
||||
top.className = 'signup-plan__top';
|
||||
const symbol = document.createElement('span');
|
||||
symbol.className = 'signup-plan__symbol';
|
||||
symbol.textContent = icon;
|
||||
const header = document.createElement('div');
|
||||
const name = document.createElement('h2');
|
||||
name.textContent = heading;
|
||||
const cost = document.createElement('p');
|
||||
cost.className = 'signup-plan__price';
|
||||
cost.textContent = price;
|
||||
header.append(name, cost);
|
||||
top.append(symbol, header);
|
||||
const description = document.createElement('p');
|
||||
description.className = 'signup-plan__lead';
|
||||
description.textContent = lead;
|
||||
const list = document.createElement('ul');
|
||||
for (const perk of perks) {
|
||||
const li = document.createElement('li');
|
||||
li.textContent = perk;
|
||||
list.append(li);
|
||||
}
|
||||
const action = document.createElement('button');
|
||||
action.type = 'button';
|
||||
action.className = type === 'paid' ? 'primary-btn' : 'secondary-btn';
|
||||
action.textContent = button;
|
||||
action.addEventListener('click', () => {
|
||||
const draft = state.registrationDraft;
|
||||
if (draft.flowType !== type) {
|
||||
// При смене namespace старые ключи/коды больше не соответствуют выбранному аккаунту.
|
||||
draft.login = '';
|
||||
draft.password = '';
|
||||
draft.preGeneratedKeyBundle = null;
|
||||
draft.challengeId = '';
|
||||
draft.challengeExpiresAtMs = 0;
|
||||
draft.email = '';
|
||||
}
|
||||
draft.flowType = type;
|
||||
draft.uiStep = 1;
|
||||
navigate('register-view');
|
||||
});
|
||||
box.append(top, description, list, action);
|
||||
return box;
|
||||
}
|
||||
screen.append(
|
||||
createTopBar({ title: 'Регистрация в SHiNE', back: { label: '←', onClick: () => navigate('registration-intro-view') } }),
|
||||
title, intro,
|
||||
card({
|
||||
type: 'paid', icon: '◇', heading: 'Полноценный аккаунт',
|
||||
price: '≈ 0,02 SOL · разовая оплата',
|
||||
lead: 'Оплата создания личной записи (PDA) в блокчейне Solana. Точная сумма рассчитывается перед оплатой.',
|
||||
perks: ['Аккаунт не привязан к одному серверу SHiNE.', 'Можно переходить между серверами или запустить собственный.', 'Поддерживается смена пароля.'],
|
||||
button: 'Выбрать полноценный аккаунт',
|
||||
}),
|
||||
card({
|
||||
type: 'free', icon: '♧', heading: 'Бесплатный аккаунт',
|
||||
price: '0 SOL · бесплатно',
|
||||
lead: 'Регистрация подтверждается сервером SHiNE и не требует оплаты.',
|
||||
perks: ['Работа только через сервер, который подтвердил регистрацию.', 'Смена пароля недоступна.', 'Позже можно перейти на полноценный аккаунт, сохранив логин и историю.'],
|
||||
button: 'Зарегистрироваться бесплатно',
|
||||
}),
|
||||
);
|
||||
return screen;
|
||||
}
|
||||
Reference in New Issue
Block a user