diff --git a/addons/beyond_base/static/src/webclient/beyond_launcher.js b/addons/beyond_base/static/src/webclient/beyond_launcher.js index 464e621..90f6535 100644 --- a/addons/beyond_base/static/src/webclient/beyond_launcher.js +++ b/addons/beyond_base/static/src/webclient/beyond_launcher.js @@ -3,6 +3,7 @@ import { patch } from "@web/core/utils/patch"; import { useBus } from "@web/core/utils/hooks"; import { useRef } from "@odoo/owl"; import { useDropdownState } from "@web/core/dropdown/dropdown_hooks"; +import { browser } from "@web/core/browser/browser"; import { NavBar } from "@web/webclient/navbar/navbar"; import { WebClient } from "@web/webclient/webclient"; @@ -28,6 +29,18 @@ patch(NavBar.prototype, { this.beyondLauncherToggle.el?.focus(); }); }, + + /** + * Cerrar sesión desde el lanzador. + * + * El enlace ya lleva su `href`, así que si esto no corriera la salida + * funcionaría igual. Lo único que agrega es avisarle al service worker, + * que es lo que hace el menú de usuario de Odoo: sin ese aviso, una + * aplicación instalada se queda con la sesión vieja en caché. + */ + cerrarSesion() { + browser.navigator.serviceWorker?.controller?.postMessage("user_logout"); + }, }); patch(WebClient.prototype, { diff --git a/addons/beyond_base/static/src/webclient/beyond_launcher.scss b/addons/beyond_base/static/src/webclient/beyond_launcher.scss index fe7c1f0..1de2853 100644 --- a/addons/beyond_base/static/src/webclient/beyond_launcher.scss +++ b/addons/beyond_base/static/src/webclient/beyond_launcher.scss @@ -209,9 +209,39 @@ $beyond-launcher-vidrio-bajo: rgba(255, 255, 255, 0.35); .beyond_launcher_brand { flex: none; display: flex; - justify-content: flex-end; + // La firma se queda a la derecha y cerrar sesión ocupa la izquierda: + // `space-between` en vez de empujar la firma, para que la salida no + // quede pegada a la marca. + justify-content: space-between; + align-items: center; padding: 4px 22px 14px; + .beyond_launcher_salir { + display: flex; + align-items: center; + gap: 8px; + // Alto de dedo: esta pantalla se usa en tableta de mostrador. + min-height: 44px; + padding: 0 14px; + border-radius: 10px; + font-size: 14px; + font-weight: 600; + color: $beyond-ink; + text-decoration: none; + opacity: 0.75; + + svg { + width: 20px; + height: 20px; + } + + &:hover, &:focus-visible { + opacity: 1; + background: rgba(35, 32, 29, 0.06); + color: $beyond-ink; + } + } + span { font-size: 13px; font-weight: 600; diff --git a/addons/beyond_base/static/src/webclient/beyond_launcher.xml b/addons/beyond_base/static/src/webclient/beyond_launcher.xml index 963b2b1..3fe0cf1 100644 --- a/addons/beyond_base/static/src/webclient/beyond_launcher.xml +++ b/addons/beyond_base/static/src/webclient/beyond_launcher.xml @@ -212,7 +212,29 @@ +