Настройки: «Оформление», «Уведомления» и «О приложении»

- «Оформление»: тема Авто / Светлая / Тёмная и все 26 палитр образцами – применяются сразу;
  «Настроить цвета вручную» – прежний редактор. Раньше тема переключалась пилюлей
  с эмодзи в шапке, а палитры были спрятаны в настройках разработчика;
- «Уведомления»: звук нового сообщения в открытом приложении (вкл/выкл), состояние
  разрешения системных уведомлений с кнопкой «Разрешить», список чатов «без звука»
  с «Включить звук»;
- «О приложении»: версии приложения, сборки (датой), сервера и сервер доступа,
  «Скопировать сведения» – для обращения в поддержку;
- разделы сгруппированы: внешний вид и уведомления – сверху, устройства и ключи – ниже;
- device-prefs.js – настройки этого устройства (не аккаунта);
- hidden снова скрывает .nav-list.
This commit is contained in:
q
2026-10-13 03:48:00 +03:00
parent 26db18e250
commit 96d23b16fc
12 changed files with 474 additions and 94 deletions
+1 -1
View File
@@ -1,2 +1,2 @@
client.version=1.19.6
client.version=1.19.7
server.version=1.15.0
+1 -1
View File
@@ -39,7 +39,7 @@
}());
</script>
<script>
window.__SHINE_BUILD_HASH__ = '20261013040000';
window.__SHINE_BUILD_HASH__ = '20261013043000';
window.__SHINE_CLIENT_VERSION__ = '1.2.10';
</script>
<script>
+7
View File
@@ -97,6 +97,8 @@ import * as deviceCameraView from './pages/device-camera-view.js';
import * as showKeysView from './pages/show-keys-view.js';
import * as clientSessionView from './pages/device-session-view.js?v=202606131435';
import * as languageView from './pages/language-view.js';
import * as appearanceView from './pages/appearance-view.js';
import * as notificationSettingsView from './pages/notification-settings-view.js';
import * as appLogView from './pages/app-log-view.js';
import * as pwaDiagnosticsView from './pages/pwa-diagnostics-view.js';
import * as solanaUsersInitView from './pages/solana-users-init-view.js';
@@ -106,6 +108,7 @@ import * as contactSearchView from './pages/contact-search-view.js';
import * as chatView from './pages/chat-view.js?v=202610130200';
import * as chatMediaView from './pages/chat-media-view.js';
import { isDmChatMuted } from './services/dm-chat-prefs.js';
import { getDevicePref } from './services/device-prefs.js';
import * as userProfileView from './pages/user-profile-view.js';
import * as userProfileListView from './pages/user-profile-list-view.js';
import * as userRelationManageView from './pages/user-relation-manage-view.js';
@@ -171,6 +174,8 @@ const routes = {
'show-keys-view': showKeysView,
'device-session-view': clientSessionView,
'language-view': languageView,
'appearance-view': appearanceView,
'notification-settings-view': notificationSettingsView,
'app-log-view': appLogView,
'pwa-diagnostics-view': pwaDiagnosticsView,
'solana-users-init-view': solanaUsersInitView,
@@ -652,6 +657,8 @@ async function unlockHiddenDmAudio() {
async function playDmSignal({ extended = false } = {}) {
try {
// «Звук в открытом приложении» выключен в настройках уведомлений.
if (getDevicePref('dmSound', true) === false) return false;
if (!hiddenDmAudioUnlocked || !hiddenDmAudioContext) return false;
if (hiddenDmAudioContext.state === 'suspended') {
await hiddenDmAudioContext.resume();
+133
View File
@@ -0,0 +1,133 @@
// «Оформление»: тема (Авто / Светлая / Тёмная) и палитра – образцами, применяются сразу.
// Тонкая ручная настройка цветов – прежний редактор палитры.
import { createTopBar } from '../components/topbar.js';
import { iconHtml } from '../components/ui-icon.js';
import { openPaletteEditor } from '../components/palette-editor.js';
import {
PALETTE_PRESETS, getPaletteSettings, getThemeMode, resolvePalette, resolveThemeMode, setPaletteSettings, setThemeMode,
} from '../services/theme-service.js';
export const pageMeta = { id: 'appearance-view', title: 'Оформление' };
const THEME_MODES = [
['system', 'Авто'],
['light', 'Светлая'],
['dark', 'Тёмная'],
];
export function render({ navigate, chrome } = {}) {
const screen = document.createElement('section');
screen.className = 'stack appearance-screen';
let closeEditor = null; // openPaletteEditor возвращает функцию закрытия
chrome?.setTopbar(createTopBar({
title: 'Оформление',
back: { onClick: () => navigate('settings-view') },
}));
// --- тема ---
const themeTitle = document.createElement('p');
themeTitle.className = 'nav-list__title';
themeTitle.textContent = 'Тема';
const themeTabs = document.createElement('div');
themeTabs.className = 'tabs tabs--three appearance-theme';
themeTabs.setAttribute('role', 'radiogroup');
themeTabs.setAttribute('aria-label', 'Тема оформления');
const themeHint = document.createElement('p');
themeHint.className = 'meta-muted appearance-hint';
for (const [mode, label] of THEME_MODES) {
const button = document.createElement('button');
button.type = 'button';
button.className = 'tab-btn';
button.dataset.mode = mode;
button.setAttribute('role', 'radio');
button.textContent = label;
button.addEventListener('click', () => {
setThemeMode(mode);
sync();
});
themeTabs.append(button);
}
// --- палитра ---
const paletteTitle = document.createElement('p');
paletteTitle.className = 'nav-list__title';
paletteTitle.textContent = 'Цвета';
const grid = document.createElement('div');
grid.className = 'palette-grid';
grid.setAttribute('role', 'radiogroup');
grid.setAttribute('aria-label', 'Палитра');
const swatches = new Map();
for (const [id, preset] of Object.entries(PALETTE_PRESETS)) {
const button = document.createElement('button');
button.type = 'button';
button.className = 'palette-swatch';
button.setAttribute('role', 'radio');
button.setAttribute('aria-label', preset.label);
button.innerHTML = `
<span class="palette-swatch__sample" aria-hidden="true">
<span class="palette-swatch__bar"></span>
<span class="palette-swatch__bubble"></span>
<span class="palette-swatch__dot"></span>
<span class="palette-swatch__check">${iconHtml('check')}</span>
</span>
<span class="palette-swatch__label"></span>
`;
button.querySelector('.palette-swatch__label').textContent = preset.label;
button.addEventListener('click', () => {
// Выбор готовой палитры сбрасывает ручные правки – иначе выбор выглядел бы «не тем».
setPaletteSettings({ preset: id, custom: { dark: {}, light: {} } });
sync();
});
swatches.set(id, button);
grid.append(button);
}
const more = document.createElement('div');
more.className = 'nav-list';
const customRow = document.createElement('button');
customRow.type = 'button';
customRow.className = 'nav-row';
customRow.innerHTML = '<span class="nav-row__label">Настроить цвета вручную</span><span class="nav-row__hint"></span>';
customRow.addEventListener('click', () => {
closeEditor?.();
closeEditor = openPaletteEditor({ onClose: () => { closeEditor = null; sync(); } });
});
more.append(customRow);
function sync() {
const mode = getThemeMode();
const resolved = resolveThemeMode(mode);
themeTabs.querySelectorAll('.tab-btn').forEach((button) => {
button.setAttribute('aria-checked', String(button.dataset.mode === mode));
});
themeHint.textContent = mode === 'system'
? `Как в системе устройства: сейчас ${resolved === 'light' ? 'светлая' : 'тёмная'}.`
: 'Не зависит от настроек устройства.';
const settings = getPaletteSettings();
const customized = Object.keys(settings.custom.dark).length + Object.keys(settings.custom.light).length > 0;
swatches.forEach((button, id) => {
// Образцы показывают ту тему, что сейчас на экране.
const colors = resolvePalette(resolved, { preset: id, custom: { dark: {}, light: {} } });
const sample = button.querySelector('.palette-swatch__sample');
sample.style.setProperty('--swatch-bg', colors.background);
sample.style.setProperty('--swatch-surface', colors.surface);
sample.style.setProperty('--swatch-accent', colors.accent);
sample.style.setProperty('--swatch-bubble', colors['bubble-out']);
sample.style.setProperty('--swatch-on-accent', colors['on-accent']);
button.setAttribute('aria-checked', String(settings.preset === id && !customized));
});
customRow.querySelector('.nav-row__hint').textContent = customized
? `Свои правки поверх «${PALETTE_PRESETS[settings.preset]?.label || settings.preset}»`
: 'Каждый цвет отдельно, для светлой и тёмной темы';
}
sync();
screen.append(themeTitle, themeTabs, themeHint, paletteTitle, grid, more);
screen.cleanup = () => {
const close = closeEditor;
closeEditor = null;
close?.();
};
return screen;
}
+1 -1
View File
@@ -783,7 +783,7 @@ export function render({ navigate, route, chrome } = {}) {
['line', 'contact', 'Контакт'],
['dash', 'friend', 'Пунктир – связь только с одной стороны'],
['aura', '', 'Свечение вокруг – сияющий'],
['badge', '', 'Синяя галочка – основной аккаунт'],
['badge', '', 'Синяя галочка – официальный аккаунт'],
['mark', '', 'Цветная точка – ваша заметка или метка'],
];
for (const [kind, type, text] of rows) {
@@ -0,0 +1,139 @@
// «Уведомления» в настройках: звук сообщений, разрешение системных уведомлений и чаты
// «без звука». Всё – настройки этого устройства, сервер про них не знает.
import { createTopBar } from '../components/topbar.js';
import { normalizeDmChatId } from '../state.js';
import { DM_CHAT_PREFS_EVENT, getMutedDmChats, setDmChatMuted } from '../services/dm-chat-prefs.js';
import { DEVICE_PREFS_EVENT, getDevicePref, setDevicePref } from '../services/device-prefs.js';
import { showToast } from '../services/channels-ux.js';
export const pageMeta = { id: 'notification-settings-view', title: 'Уведомления' };
function permissionState() {
if (typeof Notification === 'undefined') return 'unsupported';
return Notification.permission; // granted | denied | default
}
export function render({ navigate, chrome } = {}) {
const screen = document.createElement('section');
screen.className = 'stack notification-settings-screen';
let disposed = false;
chrome?.setTopbar(createTopBar({
title: 'Уведомления',
back: { onClick: () => navigate('settings-view') },
}));
const soundTitle = document.createElement('p');
soundTitle.className = 'nav-list__title';
soundTitle.textContent = 'Сообщения';
const soundList = document.createElement('div');
soundList.className = 'nav-list';
const soundRow = document.createElement('label');
soundRow.className = 'nav-row nav-row--switch';
soundRow.innerHTML = `
<span class="nav-row__text">
<span class="nav-row__label">Звук в открытом приложении</span>
<span class="nav-row__hint">Короткий сигнал о новом сообщении</span>
</span>
<input class="switch" type="checkbox" />
`;
const soundSwitch = soundRow.querySelector('input');
soundSwitch.checked = getDevicePref('dmSound', true) !== false;
soundSwitch.addEventListener('change', () => setDevicePref('dmSound', soundSwitch.checked));
soundList.append(soundRow);
// Системные уведомления – когда приложение свёрнуто или закрыто.
const systemList = document.createElement('div');
systemList.className = 'nav-list';
const systemRow = document.createElement('div');
systemRow.className = 'nav-row nav-row--action';
systemList.append(systemRow);
function renderSystemRow() {
const permission = permissionState();
const texts = {
granted: ['Уведомления на устройстве', 'Разрешены: придут, даже когда приложение свёрнуто'],
denied: ['Уведомления на устройстве', 'Запрещены. Разрешите их для этого сайта в настройках браузера'],
default: ['Уведомления на устройстве', 'Пока не разрешены – без них не узнать о сообщении, когда приложение свёрнуто'],
unsupported: ['Уведомления на устройстве', 'Этот браузер их не поддерживает'],
};
const [label, hint] = texts[permission] || texts.unsupported;
systemRow.innerHTML = `
<span class="nav-row__text">
<span class="nav-row__label"></span>
<span class="nav-row__hint"></span>
</span>
`;
systemRow.querySelector('.nav-row__label').textContent = label;
systemRow.querySelector('.nav-row__hint').textContent = hint;
if (permission === 'default') {
const allow = document.createElement('button');
allow.type = 'button';
allow.className = 'primary-btn nav-row__button';
allow.textContent = 'Разрешить';
allow.addEventListener('click', async () => {
allow.disabled = true;
try {
const result = await Notification.requestPermission();
if (result === 'granted') showToast('Уведомления разрешены');
} catch {
showToast('Не удалось запросить разрешение', { kind: 'error' });
}
if (!disposed) renderSystemRow();
});
systemRow.append(allow);
}
}
renderSystemRow();
// Чаты «без звука»: здесь их видно списком и можно вернуть звук.
const mutedTitle = document.createElement('p');
mutedTitle.className = 'nav-list__title';
const mutedList = document.createElement('div');
mutedList.className = 'nav-list';
const mutedEmpty = document.createElement('p');
mutedEmpty.className = 'meta-muted appearance-hint';
function renderMuted() {
const muted = getMutedDmChats();
mutedTitle.textContent = muted.length ? `Чаты без звука · ${muted.length}` : 'Чаты без звука';
mutedList.replaceChildren();
mutedList.hidden = !muted.length;
mutedEmpty.hidden = Boolean(muted.length);
mutedEmpty.textContent = 'Нет. Выключить звук чата можно в его меню «•••» или долгим нажатием в списке чатов.';
for (const chatId of muted) {
const row = document.createElement('div');
row.className = 'nav-row nav-row--action';
const text = document.createElement('span');
text.className = 'nav-row__text';
const label = document.createElement('button');
label.type = 'button';
label.className = 'nav-row__label text-btn notification-settings-chat';
label.textContent = `@${chatId}`;
label.addEventListener('click', () => navigate(`chat/${encodeURIComponent(normalizeDmChatId(chatId))}`));
text.append(label);
const unmute = document.createElement('button');
unmute.type = 'button';
unmute.className = 'secondary-btn nav-row__button';
unmute.textContent = 'Включить звук';
unmute.addEventListener('click', () => setDmChatMuted(chatId, false));
row.append(text, unmute);
mutedList.append(row);
}
}
renderMuted();
const onPrefs = () => { if (!disposed) renderMuted(); };
const onDevicePrefs = () => { if (!disposed) soundSwitch.checked = getDevicePref('dmSound', true) !== false; };
window.addEventListener(DM_CHAT_PREFS_EVENT, onPrefs);
window.addEventListener(DEVICE_PREFS_EVENT, onDevicePrefs);
screen.append(soundTitle, soundList, systemList, mutedTitle, mutedList, mutedEmpty);
screen.cleanup = () => {
if (disposed) return;
disposed = true;
window.removeEventListener(DM_CHAT_PREFS_EVENT, onPrefs);
window.removeEventListener(DEVICE_PREFS_EVENT, onDevicePrefs);
};
return screen;
}
+88 -81
View File
@@ -1,8 +1,9 @@
import { confirmDialog } from '../components/confirm-dialog.js';
import { createTopBar } from '../components/topbar.js';
import { addAppLogEntry, authService, closeSavedProfile, state } from '../state.js';
import { isDeveloperToolsEnabled } from '../services/feature-settings.js';
import { getThemeMode, setThemeMode } from '../services/theme-service.js';
import { openSheet } from '../components/sheet.js';
import { showToast } from '../services/channels-ux.js';
import { PALETTE_PRESETS, getPaletteSettings, getThemeMode } from '../services/theme-service.js';
import {
canInstallPwa,
isStandalonePwaMode,
@@ -12,56 +13,95 @@ import {
export const pageMeta = { id: 'settings-view', title: 'Настройки' };
// Номер сборки вида 20261013040000 – это дата и время: показываем «13.10.2026, 04:00».
function formatBuildStamp(rawValue) {
const value = String(rawValue || '').trim();
if (!/^\d{14}$/.test(value)) return value;
const yyyy = value.slice(0, 4);
const mm = value.slice(4, 6);
const dd = value.slice(6, 8);
const hh = value.slice(8, 10);
const min = value.slice(10, 12);
const ss = value.slice(12, 14);
return `${yyyy}-${mm}-${dd}/${hh}:${min}__${ss}`;
return `${value.slice(6, 8)}.${value.slice(4, 6)}.${value.slice(0, 4)}, ${value.slice(8, 10)}:${value.slice(10, 12)}`;
}
function formatVersionForUi(rawValue) {
const value = String(rawValue || '').trim();
if (!value) return 'n/a';
const formatted = formatBuildStamp(value);
if (formatted && formatted !== value) {
return `${formatted} (${value})`;
}
if (formatted && formatted !== value) return formatted;
return value;
}
// Сервер отвечает версией на Ping (или GetServerInfo у старых серверов).
async function loadServerVersion() {
try {
const pingResp = await authService.ws.request('Ping', { ts: Date.now() }, 7000);
const value = String(pingResp?.payload?.serverVersion || pingResp?.serverVersion || '').trim();
if (value) return value;
} catch {
// ниже – запасной запрос
}
const infoResp = await authService.ws.request('GetServerInfo', {});
return String(infoResp?.payload?.version || '').trim();
}
// «О приложении»: версии клиента, сборки и сервера – и кнопка скопировать их для поддержки.
function openAboutSheet() {
let disposed = false;
return openSheet({
title: 'О приложении',
className: 'about-sheet',
onClose: () => { disposed = true; },
content: () => {
const list = document.createElement('div');
list.className = 'nav-list';
const rows = [
['Версия приложения', formatVersionForUi(window.__SHINE_CLIENT_VERSION__)],
['Сборка', formatVersionForUi(window.__SHINE_BUILD_HASH__)],
['Сервер', 'Узнаю…'],
['Сервер доступа', String(state.entrySettings?.shineServerLogin || '').trim() || '—'],
];
const values = rows.map(([label, value]) => {
const row = document.createElement('div');
row.className = 'nav-row nav-row--static';
row.innerHTML = '<span class="nav-row__hint"></span><span class="nav-row__label"></span>';
row.querySelector('.nav-row__hint').textContent = label;
row.querySelector('.nav-row__label').textContent = value;
list.append(row);
return row.querySelector('.nav-row__label');
});
void loadServerVersion()
.then((value) => { if (!disposed) values[2].textContent = formatVersionForUi(value) || '—'; })
.catch(() => { if (!disposed) values[2].textContent = 'Нет связи с сервером'; });
const copy = document.createElement('button');
copy.type = 'button';
copy.className = 'secondary-btn about-sheet__copy';
copy.textContent = 'Скопировать сведения';
copy.addEventListener('click', async () => {
const text = rows.map(([label], index) => `${label}: ${values[index].textContent}`).join('\n');
try {
await navigator.clipboard.writeText(text);
showToast('Сведения скопированы');
} catch {
showToast('Не удалось скопировать', { kind: 'error' });
}
});
const box = document.createElement('div');
box.className = 'stack';
box.append(list, copy);
return box;
},
});
}
const THEME_LABELS = { system: 'авто', light: 'светлая', dark: 'тёмная' };
export function render({navigate, chrome}) {
const screen = document.createElement('section');
screen.className = 'stack';
let isDisposed = false;
let aboutSheet = null;
const topbar = createTopBar({
title: 'Настройки',
back: { label: '←', onClick: () => navigate('profile-view') },
});
const themeButton = document.createElement('button');
themeButton.type = 'button';
themeButton.className = 'settings-theme-cycle';
themeButton.title = 'Переключить тему оформления';
themeButton.setAttribute('aria-label', 'Переключить тему оформления');
const modes = ['light', 'dark', 'system'];
const themeNames = { light: '☀️ Светлая', dark: '🌙 Тёмная', system: '◐ Авто' };
const updateThemeButton = () => {
const mode = getThemeMode();
themeButton.textContent = themeNames[mode] || themeNames.system;
themeButton.setAttribute('aria-label', `Тема: ${themeButton.textContent}. Нажмите для переключения`);
};
themeButton.addEventListener('click', () => {
const index = modes.indexOf(getThemeMode());
setThemeMode(modes[(index + 1) % modes.length]);
updateThemeButton();
});
updateThemeButton();
topbar.querySelector('.topbar__right')?.append(themeButton);
chrome?.setTopbar(topbar);
// Скрытый вход в «Дополнительные настройки»: пять быстрых нажатий на заголовок.
@@ -79,23 +119,36 @@ export function render({navigate, chrome}) {
const card = document.createElement('div');
card.className = 'stack settings-sections';
const row = (id, label, hint) => `<button class="nav-row" type="button" id="${id}"><span class="nav-row__label">${label}</span>${hint ? `<span class="nav-row__hint">${hint}</span>` : ''}</button>`;
const palette = PALETTE_PRESETS[getPaletteSettings().preset]?.label || '';
const appearanceHint = `Тема: ${THEME_LABELS[getThemeMode()] || 'авто'}${palette ? ` · цвета «${palette}»` : ''}`;
card.innerHTML = `
<div class="nav-list">
${row('settings-appearance', 'Оформление', appearanceHint)}
${row('settings-notifications', 'Уведомления', 'Звук, разрешение, чаты без звука')}
${row('settings-language', 'Язык / Language', 'Русский')}
</div>
<div class="nav-list">
${row('settings-device', 'Устройства', 'Сеансы и подключение устройств')}
${row('settings-my-blockchain', 'Мой блокчейн', 'История записей, файлы и внешнее устройство')}
${row('settings-servers', 'Настройки серверов', 'Сервер доступа и серверы блокчейнов')}
${row('settings-access-keys', 'Ключи и пароли', 'Просмотр ключей и смена пароля')}
${row('settings-language', 'Язык / Language', 'Русский')}
</div>
<div class="nav-list" id="settings-install-list" hidden></div>
<div class="nav-list">
${row('settings-developer', 'Настройки разработчика', 'Цветовая схема и инструменты разработчика')}
${row('settings-about', 'О приложении', `Версия ${window.__SHINE_CLIENT_VERSION__ || '—'}`)}
${row('settings-developer', 'Настройки разработчика', 'Инструменты и журнал приложения')}
</div>
<div class="nav-list">
<button class="nav-row nav-row--danger" type="button" id="settings-signout"><span class="nav-row__label">Выйти из аккаунта</span></button>
</div>
`;
card.querySelector('#settings-appearance').addEventListener('click', () => navigate('appearance-view'));
card.querySelector('#settings-notifications').addEventListener('click', () => navigate('notification-settings-view'));
card.querySelector('#settings-about').addEventListener('click', () => {
aboutSheet?.close();
aboutSheet = openAboutSheet();
});
card.querySelector('#settings-device').addEventListener('click', () => navigate('device-view'));
card.querySelector('#settings-my-blockchain').addEventListener('click', () => navigate('my-blockchain-view'));
card.querySelector('#settings-servers').addEventListener('click', () => navigate('settings-servers-view'));
@@ -160,56 +213,10 @@ export function render({navigate, chrome}) {
screen.append(card);
if (isDeveloperToolsEnabled()) {
const versionCard = document.createElement('div');
versionCard.className = 'card stack';
const title = document.createElement('p');
title.className = 'field-label';
title.textContent = 'Версии';
const clientVersion = document.createElement('p');
clientVersion.className = 'meta-muted';
clientVersion.textContent = `Клиент: ${formatVersionForUi(window.__SHINE_CLIENT_VERSION__)}`;
const uiBuild = document.createElement('p');
uiBuild.className = 'meta-muted';
uiBuild.textContent = `Сборка UI: ${formatVersionForUi(window.__SHINE_BUILD_HASH__)}`;
const serverVersion = document.createElement('p');
serverVersion.className = 'meta-muted';
serverVersion.textContent = 'Сервер: загружается...';
versionCard.append(title, clientVersion, uiBuild, serverVersion);
void (async () => {
try {
let value = '';
try {
const pingResp = await authService.ws.request('Ping', { ts: Date.now() }, 7000);
value = String(pingResp?.payload?.serverVersion || pingResp?.serverVersion || '').trim();
} catch {
// fallback below
}
if (!value) {
const infoResp = await authService.ws.request('GetServerInfo', {});
value = String(infoResp?.payload?.version || '').trim();
}
if (!isDisposed) serverVersion.textContent = `Сервер: ${formatVersionForUi(value)}`;
} catch {
if (!isDisposed) {
serverVersion.textContent = 'Сервер: недоступно';
}
}
})();
screen.append(versionCard);
}
screen.cleanup = () => {
if (isDisposed) return;
isDisposed = true;
aboutSheet?.close();
unsubscribeInstallAvailability();
};
return screen;
+6
View File
@@ -44,6 +44,8 @@ const PRETTY_PATHS = new Map([
['advanced-settings-view', 'settings/advanced'],
['trusted-device-login-settings-view', 'settings/device-login'],
['language-view', 'settings/language'],
['appearance-view', 'settings/appearance'],
['notification-settings-view', 'settings/notifications'],
['app-log-view', 'settings/app-log'],
['pwa-diagnostics-view', 'settings/pwa-diagnostics'],
['solana-users-init-view', 'settings/solana-users-init'],
@@ -347,6 +349,8 @@ export function parseRouteFromPath(pathname = '') {
if (sub === 'advanced') return { pageId: 'advanced-settings-view', params: {} };
if (sub === 'device-login') return { pageId: 'trusted-device-login-settings-view', params: {} };
if (sub === 'language') return { pageId: 'language-view', params: {} };
if (sub === 'appearance') return { pageId: 'appearance-view', params: {} };
if (sub === 'notifications') return { pageId: 'notification-settings-view', params: {} };
if (sub === 'app-log') return { pageId: 'app-log-view', params: {} };
if (sub === 'pwa-diagnostics') return { pageId: 'pwa-diagnostics-view', params: {} };
if (sub === 'solana-users-init') return { pageId: 'solana-users-init-view', params: {} };
@@ -584,6 +588,8 @@ function resolveToolbarTab(pageId) {
pageId === 'show-keys-view' ||
pageId === 'device-session-view' ||
pageId === 'language-view' ||
pageId === 'appearance-view' ||
pageId === 'notification-settings-view' ||
pageId === 'app-log-view' ||
pageId === 'pwa-diagnostics-view' ||
pageId === 'solana-users-init-view'
+33
View File
@@ -0,0 +1,33 @@
// Настройки этого устройства (не аккаунта): звук сообщений и т. п. Хранятся в localStorage;
// в приватном режиме живут до закрытия вкладки.
const STORAGE_KEY = 'shine-device-prefs-v1';
export const DEVICE_PREFS_EVENT = 'shine-device-prefs-updated';
let memory = null;
function readAll() {
if (memory) return memory;
try {
const raw = JSON.parse(localStorage.getItem(STORAGE_KEY) || '{}');
memory = raw && typeof raw === 'object' && !Array.isArray(raw) ? raw : {};
} catch {
memory = {};
}
return memory;
}
export function getDevicePref(name, fallback) {
const value = readAll()[name];
return value === undefined ? fallback : value;
}
export function setDevicePref(name, value) {
const all = { ...readAll(), [name]: value };
memory = all;
try {
localStorage.setItem(STORAGE_KEY, JSON.stringify(all));
} catch {
// Нет места или приватный режим – настройка действует до перезагрузки.
}
window.dispatchEvent(new CustomEvent(DEVICE_PREFS_EVENT, { detail: { name, value } }));
}
+5
View File
@@ -86,3 +86,8 @@ export function setDmChatPinned(chatId, pinned) {
export function getPinnedDmChats() {
return readPrefs().pinned;
}
// Чаты «без звука» – для списка в настройках уведомлений.
export function getMutedDmChats() {
return readPrefs().muted;
}
+16
View File
@@ -1,6 +1,7 @@
/* Меню-список: группа строк «название / подсказка / ›» — для переходов по разделам
* (кошелёк, настройки разработчика и т. п.). Для действий без перехода — обычные кнопки. */
.nav-list { display: grid; border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; }
.nav-list[hidden] { display: none; }
.nav-list__title { margin: var(--space-2) 0 var(--space-1); color: var(--text-secondary); font-size: var(--text-xs); line-height: var(--leading-xs); font-weight: var(--weight-bold); }
.nav-row {
width: 100%;
@@ -34,3 +35,18 @@
.language-row::after { content: none; }
.language-row[aria-checked='true']::after { content: '✓'; color: var(--accent); font-size: 18px; font-weight: var(--weight-bold); }
/* Строка с переключателем (<label class="nav-row nav-row--switch">): подпись слева,
* .switch справа, без «›». */
.nav-row--switch { grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; padding-right: 14px; }
.nav-row--switch::after { content: none; }
.nav-row__text { display: grid; gap: 2px; min-width: 0; }
/* Строка-сведение без перехода (версия, состояние разрешения). */
.nav-row--static { cursor: default; padding-right: 14px; }
.nav-row--static::after { content: none; }
.nav-row--static:hover { background: transparent; }
/* Строка с кнопкой справа («Разрешить», «Включить звук»). */
.nav-row--action { grid-template-columns: minmax(0, 1fr) auto; align-items: center; column-gap: 12px; padding-right: 10px; cursor: default; }
.nav-row--action::after { content: none; }
.nav-row--action:hover { background: transparent; }
.nav-row__button { min-height: 36px; padding: 0 14px; border-radius: var(--radius-pill); font-size: var(--text-sm); font-weight: var(--weight-bold); }
+44 -10
View File
@@ -482,16 +482,50 @@
}
}
/* Compact three-state theme control in settings topbar. */
.settings-theme-cycle {
border: 1px solid var(--border-control);
background: var(--surface-raised);
color: var(--text-primary);
border-radius: 999px;
padding: 7px 10px;
/* «Оформление»: тема и образцы палитр (js/pages/appearance-view.js). */
.appearance-hint { margin: calc(-1 * var(--space-1)) 0 var(--space-2); font-size: var(--text-xs); }
.palette-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
gap: 14px 10px;
margin-bottom: var(--space-3);
}
.palette-swatch {
display: grid;
justify-items: center;
gap: 6px;
padding: 0;
border: 0;
background: none;
color: var(--text-secondary);
font: inherit;
font-size: 12px;
white-space: nowrap;
font-size: var(--text-xs);
cursor: pointer;
}
.settings-theme-cycle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* Образец: фон палитры, полоска «поверхности», «пузырь» исходящего сообщения и точка акцента. */
.palette-swatch__sample {
position: relative;
width: 64px;
height: 64px;
border-radius: 18px;
background: var(--swatch-bg);
box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--text-primary) 14%, transparent);
overflow: hidden;
}
.palette-swatch__bar { position: absolute; left: 8px; right: 8px; top: 9px; height: 10px; border-radius: 5px; background: var(--swatch-surface); }
.palette-swatch__bubble { position: absolute; right: 8px; top: 26px; width: 30px; height: 14px; border-radius: 8px 8px 3px 8px; background: var(--swatch-bubble); }
.palette-swatch__dot { position: absolute; left: 9px; bottom: 9px; width: 16px; height: 16px; border-radius: 50%; background: var(--swatch-accent); }
.palette-swatch__check { position: absolute; right: 6px; bottom: 6px; display: none; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--swatch-accent); color: var(--swatch-on-accent); }
.palette-swatch__check svg { width: 13px; height: 13px; stroke-width: 2.6; }
.palette-swatch[aria-checked='true'] .palette-swatch__sample { box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--accent); }
.palette-swatch[aria-checked='true'] .palette-swatch__check { display: grid; }
.palette-swatch[aria-checked='true'] .palette-swatch__label { color: var(--text-primary); font-weight: var(--weight-bold); }
.palette-swatch:focus-visible { outline: none; }
.palette-swatch:focus-visible .palette-swatch__sample { box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--focus-ring); }
.palette-swatch__label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* «Уведомления» в настройках: чат «без звука» – ссылкой на чат. */
.notification-settings-chat { justify-self: start; padding: 0; color: var(--text-primary); font-weight: var(--weight-medium); text-align: left; }
.about-sheet__copy { width: 100%; }