SHA256
51 lines
3.8 KiB
JavaScript
51 lines
3.8 KiB
JavaScript
import { t } from '../i18n/index.js';
|
|
import { createTopBar } from '../components/topbar.js';
|
|
import { state } from '../state.js';
|
|
|
|
const LICENSES = [
|
|
{ name: 'CC BY-NC 4.0', original: 'https://arweave.net/Xtym3vUAyt7OgFBINBh1ene-5360Ah76c6D-O9ywxVE', russian: 'https://creativecommons.org/licenses/by-nc/4.0/legalcode.ru' },
|
|
{ name: 'SHiNE-CDL 1.0', original: 'https://arweave.net/Q6mC26N5J1I2oudliGa-e-TTKjoQLigpXh7yH9EXjro', russian: 'https://arweave.net/Efr7_32Joi4DjMZKRLKeLeoZZRqB9pg3_LZsi_LpRU8' },
|
|
];
|
|
|
|
export const pageMeta = { id: 'registration-licenses-view', get title() { return t('screens.registration_licenses.title'); }, showAppChrome: false };
|
|
|
|
export function render({ navigate }) {
|
|
const draft = state.registrationDraft;
|
|
const screen = document.createElement('section');
|
|
screen.className = 'stack registration-screen signup-wizard';
|
|
if (!['free', 'paid'].includes(draft.flowType) || !draft.login || !draft.preGeneratedKeyBundle || ![0, 1].includes(draft.accountType)) {
|
|
queueMicrotask(() => navigate('register-view'));
|
|
return screen;
|
|
}
|
|
const body = document.createElement('div');
|
|
body.className = 'card stack registration-form signup-wizard__body';
|
|
const back = () => navigate('register-view');
|
|
screen.append(createTopBar({ title: t('screens.registration_licenses.title'), back: { label: '←', onClick: back } }), body);
|
|
const heading = document.createElement('h1'); heading.className = 'signup-title'; heading.textContent = t('screens.registration_licenses.title'); body.append(heading);
|
|
const paragraph = (key, className = '') => { const p = document.createElement('p'); if (className) p.className = className; p.textContent = t(`screens.registration_licenses.${key}`); body.append(p); };
|
|
paragraph('intro'); paragraph('rights');
|
|
for (const [index, license] of LICENSES.entries()) {
|
|
const title = document.createElement('h2'); title.textContent = license.name; body.append(title);
|
|
paragraph(index === 0 ? 'cc_description' : 'scdl_description');
|
|
const links = document.createElement('div'); links.className = 'signup-license-links';
|
|
const original = document.createElement('a'); original.className = 'secondary-btn signup-license-link'; original.href = license.original; original.target = '_blank'; original.rel = 'noopener noreferrer'; original.textContent = t('screens.registration_licenses.original');
|
|
const russian = document.createElement('a'); russian.className = 'secondary-btn signup-license-link'; russian.href = license.russian; russian.target = '_blank'; russian.rel = 'noopener noreferrer'; russian.textContent = t('screens.registration_licenses.russian');
|
|
links.append(original, russian); body.append(links);
|
|
}
|
|
const readFull = document.createElement('p');
|
|
const readFullStrong = document.createElement('strong');
|
|
readFullStrong.textContent = t('screens.registration_licenses.read_full');
|
|
readFull.append(readFullStrong); body.append(readFull);
|
|
const important = document.createElement('h2'); important.textContent = t('screens.registration_licenses.important'); body.append(important);
|
|
const list = document.createElement('ul');
|
|
for (const key of ['copyright', 'scope', 'irrevocable', 'permanent', 'owned_rights', 'private_messages', 'authentic_texts']) {
|
|
const item = document.createElement('li'); item.textContent = t(`screens.registration_licenses.${key}`); list.append(item);
|
|
}
|
|
body.append(list);
|
|
paragraph('confirmation'); paragraph('signature'); paragraph('license_updates');
|
|
const accept = document.createElement('button'); accept.type = 'button'; accept.className = 'primary-btn signup-next'; accept.textContent = t('screens.registration_licenses.accept');
|
|
accept.addEventListener('click', () => { draft.licensesAccepted = true; navigate(draft.flowType === 'free' ? 'registration-email-view' : 'registration-payment-view'); });
|
|
body.append(accept);
|
|
return screen;
|
|
}
|