SHA256
233 lines
8.1 KiB
JavaScript
233 lines
8.1 KiB
JavaScript
import { t, th } from '../i18n/index.js';
|
|
import { createTopBar } from '../components/topbar.js';
|
|
import { state } from '../state.js';
|
|
|
|
export const pageMeta = { id: 'registration-faq-view', get title() { return t('screens.registration_faq_view.text_001'); }, showAppChrome: false };
|
|
|
|
export const REGISTRATION_FAQ_TOPICS = [
|
|
{
|
|
id: 'keys-storage',
|
|
get shortTitle() { return t('screens.registration_faq_view.text_018'); },
|
|
get title() { return t('screens.registration_faq_view.text_002'); },
|
|
get paragraphs() { return [
|
|
t('screens.registration_faq_view.text_029'),
|
|
t('screens.registration_faq_view.text_030'),
|
|
t('screens.registration_faq_view.text_031'),
|
|
]; },
|
|
},
|
|
{
|
|
id: 'reliability',
|
|
get shortTitle() { return t('screens.registration_faq_view.text_019'); },
|
|
get title() { return t('screens.registration_faq_view.text_003'); },
|
|
get paragraphs() { return [
|
|
t('screens.registration_faq_view.text_032'),
|
|
t('screens.registration_faq_view.text_033'),
|
|
t('screens.registration_faq_view.text_034'),
|
|
]; },
|
|
},
|
|
{
|
|
id: 'key-derivation',
|
|
get shortTitle() { return t('screens.registration_faq_view.text_020'); },
|
|
get title() { return t('screens.registration_faq_view.text_004'); },
|
|
get paragraphs() { return [
|
|
t('screens.registration_faq_view.text_035'),
|
|
t('screens.registration_faq_view.text_036'),
|
|
t('screens.registration_faq_view.text_037'),
|
|
]; },
|
|
},
|
|
{
|
|
id: 'three-keys',
|
|
get shortTitle() { return t('screens.registration_faq_view.text_021'); },
|
|
get title() { return t('screens.registration_faq_view.text_005'); },
|
|
get paragraphs() { return [
|
|
t('screens.registration_faq_view.text_038'),
|
|
t('screens.registration_faq_view.text_039'),
|
|
t('screens.registration_faq_view.text_040'),
|
|
t('screens.registration_faq_view.text_041'),
|
|
]; },
|
|
},
|
|
{
|
|
id: 'generation-time',
|
|
get shortTitle() { return t('screens.registration_faq_view.text_022'); },
|
|
get title() { return t('screens.registration_faq_view.text_006'); },
|
|
get paragraphs() { return [
|
|
t('screens.registration_faq_view.text_042'),
|
|
t('screens.registration_faq_view.text_043'),
|
|
t('screens.registration_faq_view.text_044'),
|
|
]; },
|
|
},
|
|
{
|
|
id: 'strong-password',
|
|
get shortTitle() { return t('screens.registration_faq_view.text_023'); },
|
|
get title() { return t('screens.registration_faq_view.text_007'); },
|
|
get paragraphs() { return [
|
|
t('screens.registration_faq_view.text_045'),
|
|
t('screens.registration_faq_view.text_046'),
|
|
t('screens.registration_faq_view.text_047'),
|
|
]; },
|
|
},
|
|
{
|
|
id: 'why-own-password',
|
|
get shortTitle() { return t('screens.registration_faq_view.text_024'); },
|
|
get title() { return t('screens.registration_faq_view.text_008'); },
|
|
get paragraphs() { return [
|
|
t('screens.registration_faq_view.text_048'),
|
|
t('screens.registration_faq_view.text_049'),
|
|
t('screens.registration_faq_view.text_050'),
|
|
]; },
|
|
},
|
|
{
|
|
id: 'first-server',
|
|
get shortTitle() { return t('screens.registration_faq_view.text_025'); },
|
|
get title() { return t('screens.registration_faq_view.text_009'); },
|
|
get paragraphs() { return [
|
|
t('screens.registration_faq_view.text_051'),
|
|
t('screens.registration_faq_view.text_052'),
|
|
t('screens.registration_faq_view.text_053'),
|
|
t('screens.registration_faq_view.text_054'),
|
|
]; },
|
|
},
|
|
{
|
|
id: 'connect-device',
|
|
get shortTitle() { return t('screens.registration_faq_view.text_026'); },
|
|
get title() { return t('screens.registration_faq_view.text_010'); },
|
|
get paragraphs() { return [
|
|
t('screens.registration_faq_view.text_055'),
|
|
t('screens.registration_faq_view.text_056'),
|
|
t('screens.registration_faq_view.text_057'),
|
|
]; },
|
|
},
|
|
{
|
|
id: 'hardware-device',
|
|
shortTitle: 'ESP32',
|
|
get title() { return t('screens.registration_faq_view.text_011'); },
|
|
get paragraphs() { return [
|
|
t('screens.registration_faq_view.text_058'),
|
|
t('screens.registration_faq_view.text_059'),
|
|
t('screens.registration_faq_view.text_060'),
|
|
t('screens.registration_faq_view.text_061'),
|
|
]; },
|
|
links: [
|
|
{
|
|
get label() { return t('screens.registration_faq_view.text_012'); },
|
|
href: 'https://docs.waveshare.com/ESP32-S3-Touch-AMOLED-2.16',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
id: 'wallet-device',
|
|
get shortTitle() { return t('screens.registration_faq_view.text_027'); },
|
|
get title() { return t('screens.registration_faq_view.text_013'); },
|
|
get paragraphs() { return [
|
|
t('screens.registration_faq_view.text_062'),
|
|
t('screens.registration_faq_view.text_063'),
|
|
t('screens.registration_faq_view.text_064'),
|
|
]; },
|
|
},
|
|
];
|
|
|
|
function getTopicById(topicId) {
|
|
return REGISTRATION_FAQ_TOPICS.find((topic) => topic.id === topicId) || REGISTRATION_FAQ_TOPICS[0];
|
|
}
|
|
|
|
export function openRegistrationFaq(navigate, topicId) {
|
|
state.registrationHelp.selectedTopic = getTopicById(topicId).id;
|
|
navigate('registration-faq-view');
|
|
}
|
|
|
|
export function render({ navigate }) {
|
|
const selectedTopic = getTopicById(state.registrationHelp?.selectedTopic);
|
|
const screen = document.createElement('section');
|
|
screen.className = 'stack';
|
|
|
|
const heroCard = document.createElement('div');
|
|
heroCard.className = 'card stack registration-faq-hero';
|
|
heroCard.innerHTML = `
|
|
<p class="auth-copy">${th('screens.registration_faq_view.text_028')}</p>
|
|
`;
|
|
|
|
const topicCard = document.createElement('div');
|
|
topicCard.className = 'card stack registration-faq-topic';
|
|
|
|
const question = document.createElement('h2');
|
|
question.className = 'registration-faq-title';
|
|
question.textContent = selectedTopic.title;
|
|
topicCard.append(question);
|
|
|
|
selectedTopic.paragraphs.forEach((paragraph) => {
|
|
const p = document.createElement('p');
|
|
p.className = 'auth-copy';
|
|
p.textContent = paragraph;
|
|
topicCard.append(p);
|
|
});
|
|
|
|
if (Array.isArray(selectedTopic.links) && selectedTopic.links.length > 0) {
|
|
selectedTopic.links.forEach((linkItem) => {
|
|
const link = document.createElement('a');
|
|
link.className = 'link-card';
|
|
link.href = linkItem.href;
|
|
link.target = '_blank';
|
|
link.rel = 'noopener noreferrer';
|
|
link.textContent = linkItem.label;
|
|
topicCard.append(link);
|
|
});
|
|
}
|
|
|
|
const topicsCard = document.createElement('div');
|
|
topicsCard.className = 'stack';
|
|
|
|
const topicsLabel = document.createElement('p');
|
|
topicsLabel.className = 'nav-list__title';
|
|
topicsLabel.textContent = t('screens.registration_faq_view.text_014');
|
|
|
|
const topicsGrid = document.createElement('div');
|
|
topicsGrid.className = 'nav-list';
|
|
|
|
REGISTRATION_FAQ_TOPICS.filter((topic) => topic.id !== selectedTopic.id).forEach((topic) => {
|
|
const button = document.createElement('button');
|
|
button.className = 'nav-row';
|
|
button.type = 'button';
|
|
const label = document.createElement('span');
|
|
label.className = 'nav-row__label';
|
|
label.textContent = topic.title;
|
|
button.append(label);
|
|
button.addEventListener('click', () => {
|
|
state.registrationHelp.selectedTopic = topic.id;
|
|
navigate('registration-faq-view');
|
|
});
|
|
topicsGrid.append(button);
|
|
});
|
|
|
|
topicsCard.append(topicsLabel, topicsGrid);
|
|
|
|
const actions = document.createElement('div');
|
|
actions.className = 'auth-footer-actions';
|
|
|
|
const backButton = document.createElement('button');
|
|
backButton.className = 'ghost-btn';
|
|
backButton.type = 'button';
|
|
backButton.textContent = t('screens.registration_faq_view.text_015');
|
|
backButton.addEventListener('click', () => navigate('register-view'));
|
|
|
|
const registerButton = document.createElement('button');
|
|
registerButton.className = 'primary-btn';
|
|
registerButton.type = 'button';
|
|
registerButton.textContent = t('screens.registration_faq_view.text_016');
|
|
registerButton.addEventListener('click', () => navigate('register-view'));
|
|
|
|
actions.append(backButton, registerButton);
|
|
|
|
screen.append(
|
|
createTopBar({
|
|
title: t('screens.registration_faq_view.text_017'),
|
|
back: { label: '←', onClick: () => navigate('register-view') },
|
|
}),
|
|
heroCard,
|
|
topicCard,
|
|
topicsCard,
|
|
actions,
|
|
);
|
|
|
|
return screen;
|
|
}
|