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:
parent
198f2c3cbc
commit
f2608e8f16
9 changed files with 9 additions and 1 deletions
|
|
@ -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
|
||||
})
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue