bienvenida y Ajustes: el tipo de portada se guarda al tocarlo, sin boton de guardar; en Ajustes va justo despues del idioma

This commit is contained in:
hacklab 2026-10-19 15:39:01 +02:00
parent 05027031ef
commit 3238520891
5 changed files with 80 additions and 4 deletions

View file

@ -10,7 +10,7 @@
// i18n se lee al llamar (main_views lo cambia en cada peticion y este fichero se carga
// antes que el).
const { a, button, details, div, form, input, label, nav, p, progress, span, summary } = require("../server/node_modules/hyperaxe");
const { a, button, details, div, form, img, input, label, nav, p, progress, span, summary } = require("../server/node_modules/hyperaxe");
const { iconNode } = require("./mobile_icons");
const isMobile = () => process.env.OASIS_MOBILE === '1';
@ -109,7 +109,7 @@ const tribeTabs = (tribe, section, sections) => {
// primero lo que se toca (idioma, aspecto, tipo de uso, portada) y despues lo tecnico;
// se reordena por id de seccion, sin tocar las secciones
const SETTINGS_FIRST = ['update', 'language', 'theme', 'workflows', 'home-page'];
const SETTINGS_FIRST = ['update', 'language', 'ux', 'theme', 'workflows', 'home-page'];
const settingsOrder = (parts) => {
const list = parts.filter(Boolean);
const rank = (el) => { const i = SETTINGS_FIRST.indexOf(el && el.id); return i === -1 ? SETTINGS_FIRST.length : i; };
@ -128,6 +128,35 @@ const languagePick = () => {
);
};
// tipo de portada (ux): cada tarjeta es un boton que guarda al tocarlo. Antes eran
// radios y un boton de guardar debajo de seis tarjetas grandes, fuera de pantalla.
// Mismos modos y mismas condiciones que settings_view y welcome_view; las rutas
// (/settings/ux, /welcome/ux) son las del dev
const uxPick = (action, cfg, withHint) => {
const i18n = t();
const mods = (cfg && cfg.modules) || {};
const ux = cfg && cfg.ux && cfg.ux.current;
const modes = [
['blocks', i18n.uxModeMenus || 'Blocks', true],
['ainav', i18n.uxModeAINav || 'AI', mods.aiNavMod === 'on'],
['chats', i18n.uxModeChats || 'Conversations', mods.chatsMod === 'on'],
['feed', i18n.uxModeFeed || 'Microblogging', true],
['phone', i18n.phoneTitle || 'Phone', mods.phoneMod !== 'off'],
['rooms', i18n.roomsTitle || 'Rooms', mods.roomsMod !== 'off']
].filter(m => m[2]);
const cur = modes.some(m => m[0] === ux) ? ux : 'blocks';
return form({ method: 'POST', action, class: 'ux-pick' },
withHint ? p({ class: 'ux-pick-hint' }, i18n.uxPickHint || 'Tap one and it is saved. You can change it any time in Settings.') : null,
div({ class: 'ux-pick-grid' },
...modes.map(([value, title]) => button(Object.assign({ type: 'submit', name: 'ux', value, class: value === cur ? 'ux-pick-card is-current' : 'ux-pick-card' }, value === cur ? { 'aria-current': 'true' } : {}),
img({ src: `/assets/images/ux-${value}.png`, class: 'ux-pick-shot', alt: '' }),
span({ class: 'ux-pick-label' }, title),
value === cur ? span({ class: 'ux-pick-now' }, i18n.uxPickCurrent || 'In use') : null
))
)
);
};
// ---------- acciones de tarjeta ----------
// borrar pide un segundo toque: la X abre "¿Borrar? Si, borrar" y solo ese boton
@ -171,6 +200,6 @@ const welcomeBannerAction = () => t().welcomeBannerActionMobile || t().welcomeBa
module.exports = {
isMobile, VOTE_KINDS, voteKindPicker, voteBars, voteOwnNote, tribeRow, tribeTabs,
settingsOrder, languagePick, deleteConfirm, footerLine,
settingsOrder, languagePick, uxPick, deleteConfirm, footerLine,
welcomeBannerHere, welcomeBannerText, welcomeBannerAction
};

View file

@ -175,7 +175,7 @@ const settingsView = (params) => {
div({ class: "tags-header" },
h2(i18n.uxModeTitle || "UX"),
p(i18n.uxModeDescription || "Select which UX navigation mode you want for your GUI."),
form(
isMobile ? mobileUi.uxPick("/settings/ux", currentConfig) : form(
{ action: "/settings/ux", method: "POST" },
(() => {
const aiNavEnabled = currentConfig.modules && currentConfig.modules.aiNavMod === 'on';

View file

@ -39,6 +39,7 @@ const stepAction = (key, profile, status) => {
let cfg = {}
try { cfg = require("../configs/config-manager.js").getConfig() || {} } catch (_) {}
const cur = ["ainav", "chats", "feed", "phone", "rooms"].includes(cfg.ux?.current) ? cfg.ux.current : "blocks"
if (mobileUi.isMobile()) return mobileUi.uxPick("/welcome/ux", cfg, true)
return form({ method: "POST", action: "/welcome/ux", class: "welcome-ux-form" },
div({ class: "welcome-ux-grid" },
pickCard("ux", "blocks", cur, i18n.uxModeMenus, "/assets/images/ux-blocks.png"),