fix: status emoji accumulating in page title and add missing page titles

Fix JS regex in StatusTitle hook to use unicode flag so emoji are
properly matched and replaced instead of accumulating. Add page_title
to 8 LiveViews that were missing it, which caused "TowerOps | TowerOps"
duplication from the live_title suffix.
This commit is contained in:
Graham McIntire 2026-03-11 09:54:18 -05:00
parent 198f2c3cbc
commit f2608e8f16
No known key found for this signature in database
9 changed files with 9 additions and 1 deletions

View file

@ -1198,7 +1198,7 @@ const StatusTitle = {
mounted(this: any) {
this.handleEvent("update_status_emoji", ({ emoji }: { emoji: string }) => {
const currentTitle = document.title
const titleWithoutEmoji = currentTitle.replace(/^[🔴🟡🟢]\s/, "")
const titleWithoutEmoji = currentTitle.replace(/^(?:🔴|🟡|🟢)\s/u, "")
document.title = emoji ? `${emoji} ${titleWithoutEmoji}` : titleWithoutEmoji
})
}

View file

@ -24,6 +24,7 @@ defmodule ToweropsWeb.MobileQRLive do
socket =
socket
|> assign(:page_title, t("Mobile App"))
|> assign(:qr_token, qr_token)
|> assign(:completed, false)
|> assign(:mobile_session, nil)

View file

@ -13,6 +13,7 @@ defmodule ToweropsWeb.Org.GaiiaMappingLive do
{:ok,
socket
|> assign(:page_title, t("Gaiia Entity Mapping"))
|> assign(:organization, org)
|> assign(:tab, "sites")
|> assign(:filter, "all")

View file

@ -100,6 +100,7 @@ defmodule ToweropsWeb.Org.IntegrationsLive do
{:ok,
socket
|> assign(:page_title, t("Integrations"))
|> assign(:organization, organization)
|> assign(:timezone, socket.assigns.current_scope.timezone)
|> assign(:providers, @providers)

View file

@ -12,6 +12,7 @@ defmodule ToweropsWeb.Org.PreseemDevicesLive do
{:ok,
socket
|> assign(:page_title, t("Preseem Devices"))
|> assign(:organization, org)
|> assign(:filter, "all")
|> assign(:linking_ap_id, nil)

View file

@ -11,6 +11,7 @@ defmodule ToweropsWeb.Org.PreseemInsightsLive do
{:ok,
socket
|> assign(:page_title, t("Preseem Insights"))
|> assign(:organization, org)
|> assign(:selected_ids, MapSet.new())}
end

View file

@ -156,6 +156,7 @@ defmodule ToweropsWeb.Org.SettingsLive do
{:ok,
socket
|> assign(:page_title, t("Organization Settings"))
|> assign(:organization, organization)
|> assign(:membership, membership)
|> assign(:user_orgs_count, user_orgs_count)

View file

@ -22,6 +22,7 @@ defmodule ToweropsWeb.UserRegistrationLive do
{:ok,
socket
|> assign(:page_title, t("Register"))
|> assign(:form, to_form(changeset))
|> assign(:invitation, invitation)
|> assign(:invitation_token, invitation_token)

View file

@ -20,6 +20,7 @@ defmodule ToweropsWeb.UserResetPasswordLive do
{:ok,
socket
|> assign(:page_title, t("Reset Password"))
|> assign(:form, to_form(changeset))
|> assign(:token, token)
|> assign(:user, user)