SHA256
Полностью поддерживает английский язык
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { formatDateTime, formatNumber } from '../i18n/format.js';
|
||||
import { t, th } from '../i18n/index.js';
|
||||
import {
|
||||
buildArweaveDataUrl,
|
||||
@@ -113,13 +114,13 @@ export function formatArweaveHistoryTime(ms) {
|
||||
const minutes = Math.max(1, Math.floor(diffMs / 60000));
|
||||
return t('screens.arweave_attachment_manager.text_065', { value1: minutes });
|
||||
}
|
||||
return new Date(value).toLocaleString('ru-RU');
|
||||
return formatDateTime(new Date(value));
|
||||
}
|
||||
|
||||
export function formatArweaveHistoryDateTime(ms) {
|
||||
const value = Number(ms || 0);
|
||||
if (!Number.isFinite(value) || value <= 0) return '–';
|
||||
return new Date(value).toLocaleString('ru-RU');
|
||||
return formatDateTime(new Date(value));
|
||||
}
|
||||
|
||||
export async function getArweaveAttachmentAvailability({ gateway, attachment } = {}) {
|
||||
@@ -357,7 +358,7 @@ export function openArweaveAttachmentManager({
|
||||
return;
|
||||
}
|
||||
button.textContent = balanceInfo
|
||||
? t('screens.arweave_attachment_manager.text_067', { value1: Number(balanceInfo.ar || 0).toLocaleString('ru-RU', { maximumFractionDigits: 6 }) })
|
||||
? t('screens.arweave_attachment_manager.text_067', { value1: formatNumber(Number(balanceInfo.ar || 0), { maximumFractionDigits: 6 }) })
|
||||
: t('screens.arweave_attachment_manager.text_015');
|
||||
};
|
||||
|
||||
@@ -372,14 +373,14 @@ export function openArweaveAttachmentManager({
|
||||
const fileSize = formatBytes(selectedFile.size);
|
||||
const isFreeSize = Number(selectedFile.size || 0) <= getFreeTurboUploadBytesLimit();
|
||||
mainMetaEl.innerHTML = `
|
||||
<div class="ar-attachment-summary">Размер ${escapeHtml(fileSize)} · ${isFreeSize
|
||||
<div class="ar-attachment-summary">${th('remaining.file_upload.size')}${escapeHtml(fileSize)} · ${isFreeSize
|
||||
? t('screens.arweave_attachment_manager.text_016')
|
||||
: (uploadPrice ? t('screens.arweave_attachment_manager.text_068', { value1: escapeHtml(uploadPrice) }) : t('screens.arweave_attachment_manager.text_017'))}</div>
|
||||
<details class="ar-attachment-details">
|
||||
<summary>${th('screens.arweave_attachment_manager.text_070')}</summary>
|
||||
<div>SHA-256: ${escapeHtml(selectedSha256 || '–')}</div>
|
||||
${uploadPrice ? `<div>Цена Turbo: ${escapeHtml(uploadPrice)}</div>` : ''}
|
||||
<div>Бесплатно до ${escapeHtml(formatBytes(getFreeTurboUploadBytesLimit()))}</div>
|
||||
${uploadPrice ? `<div>${th('remaining.file_upload.turbo_price')}${escapeHtml(uploadPrice)}</div>` : ''}
|
||||
<div>${th('remaining.file_upload.free_up_to')}${escapeHtml(formatBytes(getFreeTurboUploadBytesLimit()))}</div>
|
||||
</details>
|
||||
`;
|
||||
};
|
||||
@@ -477,7 +478,7 @@ export function openArweaveAttachmentManager({
|
||||
<h3 class="modal-title">${t('dialogs.modals.arweave_attachment_manager.label_009')}</h3>
|
||||
<p class="ar-attachment-note">${t('dialogs.modals.arweave_attachment_manager.label_010')}</p>
|
||||
<div class="ar-wallet-address" data-role="address">${escapeHtml(wallet.address)}</div>
|
||||
<div class="ar-balance-grid"><div><span>${t('dialogs.modals.arweave_attachment_manager.label_011')}</span><strong>${escapeHtml(Number(balanceInfo?.ar || 0).toLocaleString('ru-RU', { maximumFractionDigits: 6 }))} AR</strong></div></div>
|
||||
<div class="ar-balance-grid"><div><span>${t('dialogs.modals.arweave_attachment_manager.label_011')}</span><strong>${escapeHtml(formatNumber(Number(balanceInfo?.ar || 0), { maximumFractionDigits: 6 }))} AR</strong></div></div>
|
||||
<div class="form-actions-grid">
|
||||
<button class="secondary-btn" type="button" data-action="copy">${t('dialogs.modals.arweave_attachment_manager.label_012')}</button>
|
||||
<button class="primary-btn" type="button" data-action="close">${t('dialogs.modals.arweave_attachment_manager.label_013')}</button>
|
||||
@@ -500,10 +501,10 @@ export function openArweaveAttachmentManager({
|
||||
return;
|
||||
}
|
||||
mainMetaEl.innerHTML = `
|
||||
${isAvatarMode ? '' : `<div>Имя: ${escapeHtml(selectedFile.name || 'file')}</div>`}
|
||||
<div>Размер: ${escapeHtml(formatBytes(selectedFile.size || 0))}</div>
|
||||
${isAvatarMode ? '' : `<div>${th('remaining.file_upload.name')}${escapeHtml(selectedFile.name || 'file')}</div>`}
|
||||
<div>${th('remaining.file_upload.size_label')}${escapeHtml(formatBytes(selectedFile.size || 0))}</div>
|
||||
<div>SHA-256: ${escapeHtml(selectedSha256 || '–')}</div>
|
||||
${priceInfo ? `<div>Цена: ${escapeHtml(Number(priceInfo.ar || 0).toLocaleString('ru-RU', { maximumFractionDigits: 6 }))} AR</div>` : ''}
|
||||
${priceInfo ? `<div>${th('remaining.file_upload.price')}${escapeHtml(formatNumber(Number(priceInfo.ar || 0), { maximumFractionDigits: 6 }))} AR</div>` : ''}
|
||||
`;
|
||||
};
|
||||
|
||||
@@ -847,7 +848,7 @@ export function openArweaveAttachmentManager({
|
||||
purpose: isAvatarMode ? 'avatar' : 'attachment',
|
||||
});
|
||||
metaEl.innerHTML = `
|
||||
<div>Размер: ${escapeHtml(formatBytes(item.size))}</div>
|
||||
<div>${th('remaining.file_upload.size_label')}${escapeHtml(formatBytes(item.size))}</div>
|
||||
<div>SHA-256: ${escapeHtml(item.sha256)}</div>
|
||||
`;
|
||||
setText(errorEl, '');
|
||||
|
||||
@@ -36,7 +36,7 @@ export function renderAvatar({
|
||||
size = 'xl',
|
||||
className = '',
|
||||
title = '',
|
||||
alt = 'Аватар',
|
||||
alt = t('remaining.avatar.avatar'),
|
||||
glow = false,
|
||||
official = false,
|
||||
authorLogin = '',
|
||||
|
||||
@@ -47,9 +47,9 @@ function attachmentLabel(item) {
|
||||
|
||||
export function openChannelEditor({
|
||||
id = 'channel-editor',
|
||||
title = 'Ответ',
|
||||
submitLabel = 'Ответить',
|
||||
placeholder = 'Напишите ответ',
|
||||
title = t('remaining.channel_editor.reply'),
|
||||
submitLabel = t('remaining.channel_editor.reply_2'),
|
||||
placeholder = t('remaining.channel_editor.write_a_reply'),
|
||||
context = null,
|
||||
destination = '',
|
||||
key = 'reply',
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import { t } from '../i18n/index.js';
|
||||
// Возвращает Promise<boolean>: true — подтвердили, false — отмена, Escape или тап мимо.
|
||||
export function confirmDialog({
|
||||
title = 'Подтвердите действие',
|
||||
title = t('remaining.confirmation.confirm_action'),
|
||||
text = '',
|
||||
confirmLabel = 'Да',
|
||||
cancelLabel = 'Отмена',
|
||||
confirmLabel = t('remaining.confirmation.yes'),
|
||||
cancelLabel = t('remaining.confirmation.cancel'),
|
||||
danger = false,
|
||||
aboveEditor = false,
|
||||
rememberChoice = null,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { openSheet } from './sheet.js';
|
||||
|
||||
// Пошаговое подтверждение перед публичной записью. Ни один шаг не выполняет сетевых запросов.
|
||||
// Текст задаёт вызывающий экран; запись начинается только после прохождения всех шагов.
|
||||
export function confirmConsentSteps({ title = 'Подтверждение', steps = [] } = {}) {
|
||||
export function confirmConsentSteps({ title = t('remaining.consent.confirmation'), steps = [] } = {}) {
|
||||
if (!steps.length) return Promise.resolve(false);
|
||||
return new Promise((resolve) => {
|
||||
let completed = false;
|
||||
|
||||
@@ -4,7 +4,7 @@ import { t } from '../i18n/index.js';
|
||||
// вовсе, и экран не мелькает.
|
||||
import { iconHtml } from './ui-icon.js';
|
||||
|
||||
export function createSpinner({ size = 'md', label = 'Загрузка' } = {}) {
|
||||
export function createSpinner({ size = 'md', label = t('remaining.feedback.loading') } = {}) {
|
||||
const el = document.createElement('span');
|
||||
el.className = `spinner spinner--${size}`;
|
||||
el.setAttribute('role', 'status');
|
||||
@@ -12,7 +12,7 @@ export function createSpinner({ size = 'md', label = 'Загрузка' } = {})
|
||||
return el;
|
||||
}
|
||||
|
||||
export function createLoadingState({ label = 'Загрузка', delayMs = 350, className = '' } = {}) {
|
||||
export function createLoadingState({ label = t('remaining.feedback.loading'), delayMs = 350, className = '' } = {}) {
|
||||
const el = document.createElement('div');
|
||||
el.className = `loading-state${className ? ` ${className}` : ''}`;
|
||||
el.style.setProperty('--loading-delay', `${Math.max(0, Number(delayMs) || 0)}ms`);
|
||||
@@ -61,8 +61,8 @@ export function createStateMessage({
|
||||
}
|
||||
|
||||
export function createErrorState({
|
||||
title = 'Не удалось загрузить',
|
||||
text = 'Проверьте соединение и попробуйте ещё раз.',
|
||||
title = t('remaining.feedback.could_not_load'),
|
||||
text = t('remaining.feedback.check_your_connection_and_try_again'),
|
||||
onRetry = null,
|
||||
className = '',
|
||||
} = {}) {
|
||||
|
||||
@@ -22,7 +22,7 @@ function statusSideHtml({ kind, title, active, received, given, verb }) {
|
||||
return `
|
||||
<section class="pf-sc pf-sc--${esc(kind)}${active ? ' is-active' : ' is-empty'}" aria-label="${esc(title)}">
|
||||
<div class="pf-sc__title">${esc(title)}</div>
|
||||
<button type="button" class="pf-sc__row" data-profile-list="${receivedKind}" aria-label="${esc(title)}: подтвердили ${Number(received || 0)}">
|
||||
<button type="button" class="pf-sc__row" data-profile-list="${receivedKind}" aria-label="${esc(title)}${th('remaining.html_profile_card.confirmed_by')}${Number(received || 0)}">
|
||||
<strong>${Number(received || 0)}</strong><span>${th('screens.profile_card.text_017')}</span>
|
||||
</button>
|
||||
<button type="button" class="pf-sc__row" data-profile-list="${givenKind}" aria-label="${esc(title)}: ${esc(verb)} ${Number(given || 0)}">
|
||||
@@ -103,7 +103,7 @@ export function profileCardHtml({ card, login = '', tilesHtml = '', tilesWrapCla
|
||||
: '';
|
||||
|
||||
return `
|
||||
<div class="pf-hero" aria-label="Профиль ${esc(cardLogin)}">
|
||||
<div class="pf-hero" aria-label="${th('remaining.html_profile_card.profile')}${esc(cardLogin)}">
|
||||
<div class="pf-identity">
|
||||
<div class="pf-side pf-side--left">${officialSide}</div>
|
||||
<div class="pf-avatar user-profile-avatar-slot${shining ? ' is-shining' : ''}"></div>
|
||||
@@ -115,7 +115,7 @@ export function profileCardHtml({ card, login = '', tilesHtml = '', tilesWrapCla
|
||||
</div>
|
||||
|
||||
<div class="pf-stats">
|
||||
${statHtml({ kind: 'friends', label: t('screens.profile_card.text_003'), valueHtml: closeFriends ? `${friends}<small> · ${closeFriends} близк.</small>` : String(friends), ariaLabel: t('screens.profile_card.text_014', { value1: friends, value2: closeFriends }) })}
|
||||
${statHtml({ kind: 'friends', label: t('screens.profile_card.text_003'), valueHtml: closeFriends ? `${friends}<small> · ${closeFriends}${th('remaining.html_profile_card.close')}</small>` : String(friends), ariaLabel: t('screens.profile_card.text_014', { value1: friends, value2: closeFriends }) })}
|
||||
${statHtml({ kind: 'channels_owned', label: t('screens.profile_card.text_004'), valueHtml: String(Number(stats.ownedPublicChannelsCount || 0)), ariaLabel: t('screens.profile_card.text_015', { value1: Number(stats.ownedPublicChannelsCount || 0) }) })}
|
||||
${statHtml({ kind: 'channels_following', label: t('screens.profile_card.text_005'), valueHtml: String(Number(stats.followingChannelsCount || 0)), ariaLabel: t('screens.profile_card.text_016', { value1: Number(stats.followingChannelsCount || 0) }) })}
|
||||
</div>
|
||||
|
||||
@@ -16,7 +16,7 @@ export function attachScrollToBottomButton({
|
||||
scrollContainer,
|
||||
mountTarget = document.querySelector('.app-shell'),
|
||||
thresholdPx = 160,
|
||||
title = 'Вниз',
|
||||
title = t('remaining.scroll.scroll_down'),
|
||||
} = {}) {
|
||||
const target = resolveElement(mountTarget);
|
||||
if (!(target instanceof Element)) {
|
||||
|
||||
@@ -124,7 +124,7 @@ export function createTopBar({
|
||||
* trailing – узел справа внутри поля (например, счётчик «3 из 12»).
|
||||
*/
|
||||
export function createSearchTopBar({
|
||||
placeholder = 'Поиск',
|
||||
placeholder = t('remaining.navigation.search'),
|
||||
value = '',
|
||||
onInput = null,
|
||||
onSubmit = null,
|
||||
|
||||
Reference in New Issue
Block a user