From 9bef1b289d365aecdbb1ace27cd1adfa6cc47801 Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Fri, 6 Mar 2026 14:45:02 -0600 Subject: [PATCH] feat: add status emoji to page titles MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add colored circle emoji (🔴/🟡/🟢) to page titles based on organization health status: - 🔴 Red: Critical alerts (device_down, agent_offline, severity 1) - 🟡 Yellow: Warning alerts (severity 2 or any active alerts) - 🟢 Green: No active alerts Provides at-a-glance status visibility in browser tabs. Note: Favicon remains static stoplight, only page title is dynamic. --- lib/towerops_web/components/layouts.ex | 15 +++++ .../components/layouts/root.html.heex | 2 +- lib/towerops_web/helpers/status_helpers.ex | 63 +++++++++++++++++++ 3 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 lib/towerops_web/helpers/status_helpers.ex diff --git a/lib/towerops_web/components/layouts.ex b/lib/towerops_web/components/layouts.ex index 7b7f56e6..c1bec5a7 100644 --- a/lib/towerops_web/components/layouts.ex +++ b/lib/towerops_web/components/layouts.ex @@ -7,6 +7,7 @@ defmodule ToweropsWeb.Layouts do alias ToweropsWeb.Components.ConsentPrompt alias ToweropsWeb.Components.CookieConsent + alias ToweropsWeb.Helpers.StatusHelpers alias ToweropsWeb.Live.Components.GlobalSearchComponent require Logger @@ -1046,4 +1047,18 @@ defmodule ToweropsWeb.Layouts do """ end + + @doc """ + Returns the page title with status emoji prepended based on organization health. + """ + def status_title(assigns) do + page_title = assigns[:page_title] || "TowerOps" + organization = get_in(assigns, [:current_scope, Access.key(:organization)]) + + if organization do + StatusHelpers.title_with_status(page_title, organization) + else + page_title + end + end end diff --git a/lib/towerops_web/components/layouts/root.html.heex b/lib/towerops_web/components/layouts/root.html.heex index 0587578b..698fd994 100644 --- a/lib/towerops_web/components/layouts/root.html.heex +++ b/lib/towerops_web/components/layouts/root.html.heex @@ -27,7 +27,7 @@ <.live_title suffix=" | TowerOps"> - {assigns[:page_title] || "TowerOps"} + {status_title(assigns)}