{# SPDX-License-Identifier: Apache-2.0 Copyright (c) 2026 evoila Group The top bar (P3.1): the MEHO logo, the product name, the app switcher, the user menu with sign-out, and a notification slot. One bar across meho, automation and Knowledge. The logo is the MEHO wordmark -- "meho" and the slanted caret, as in meho's side menu -- set as text in the display font, not an image. So it follows the theme like any other text, and no artwork ships. The caret is static here: the bar is on every page, and a blinking caret on every page is a distraction, not a brand. It sits beside `_components.html` rather than inside it: the component set is ten macros with a contract of its own, and the bar is page chrome, not a building block. Usage: {% from "_top_bar.html" import top_bar %} {{ top_bar("MEHO", home_url="/ui/", apps=switcher_entries, user_name=display_name, sign_out_url="/ui/auth/logout", account_url="/ui/account", notifications=approvals_bell("topbar")) }} The app also links `meho-topbar.css` (meho_ui.shell.top_bar_css_path()) after `evoila-tokens.css`. The bar's look comes from that one precompiled file and the `--evoila-*` tokens, so it needs no Tailwind and no DaisyUI -- which is what lets Knowledge use it. ## It renders what it is given, and reads nothing `apps` is the switcher, already resolved by the app: P3.2's setting, filtered to what is installed and what this person may use. The bar does not filter, sort or add to it. Each entry has `name` and `url`, and optionally `current` (true for the app this page belongs to). An entry may be a mapping or an object (a dataclass, a pydantic model): Jinja reads `entry.name` from either. An empty list renders no switcher at all, so the bar can ship before the setting does. `user_name` is a person's display name, supplied by the app (#1434). The bar never reaches into a session or a token. With no name it renders the neutral "Account" and a person glyph -- never an identifier, and never initials taken from one. The label, its title and the initials derive from `user_name` and nothing else. The initials are the first letters of the first two words that start with a letter and do not end in a dot: "Dr. Ada Lovelace" is AL, and "(extern) Bob Smith" is BS. A name with no such word shows the glyph. ## Every link is checked `home_url`, each entry's `url`, `account_url` and `sign_out_url` must start with `/`, `#`, `?`, `./`, `../`, `http://` or `https://`. Anything else -- `javascript:`, `data:`, a bare `page.html` -- is refused loudly, the way `attrs()` in `_components.html` refuses an unsafe attribute name: by rendering an undefined variable, which under `StrictUndefined` raises. Autoescape stops a quote from closing the attribute; it does not stop `javascript:` from running when the link is clicked, and the switcher's entries come from a setting people can edit. `notifications` is rendered markup, the way `empty_state(action=...)` takes it: the app fills the slot with whatever it needs (meho's approvals bell). A plain string is escaped. Slot content that has no styling of its own can use `meho-topbar__action` for an icon button and `meho-topbar__count` for a count on it. ## The menus are popovers, and there is no script Both menus are a real
{% endif %}
{% if notifications %}
{{ notifications }}
{% endif %}
{% if _name %}

{{ _name }}

{% endif %} {% if theme_switch %}
Theme {% for _value, _label, _glyph in [("light", "Light", "sun"), ("dark", "Dark", "moon"), ("system", "Same as my computer", "monitor")] %} {% endfor %}
{% endif %}
{%- endmacro %}