From e17772145e0319c804fd9194fbf23d52acdf2f69 Mon Sep 17 00:00:00 2001 From: Emma Segal-Grossman Date: Tue, 13 May 2025 16:32:35 -0400 Subject: [PATCH] Add minimized superadmin banner (#2598) --- frontend/src/features/admin/index.ts | 1 + .../src/features/admin/super-admin-banner.ts | 67 +++++++++++++++++++ frontend/src/index.ts | 22 ++---- 3 files changed, 72 insertions(+), 18 deletions(-) create mode 100644 frontend/src/features/admin/super-admin-banner.ts diff --git a/frontend/src/features/admin/index.ts b/frontend/src/features/admin/index.ts index 526b8901..1bf1a4e1 100644 --- a/frontend/src/features/admin/index.ts +++ b/frontend/src/features/admin/index.ts @@ -1 +1,2 @@ import "./stats"; +import "./super-admin-banner"; diff --git a/frontend/src/features/admin/super-admin-banner.ts b/frontend/src/features/admin/super-admin-banner.ts new file mode 100644 index 00000000..2b3929a3 --- /dev/null +++ b/frontend/src/features/admin/super-admin-banner.ts @@ -0,0 +1,67 @@ +import { localized, msg } from "@lit/localize"; +import { html } from "lit"; +import { customElement, state } from "lit/decorators.js"; + +import { TailwindElement } from "@/classes/TailwindElement"; + +@customElement("btrix-super-admin-banner") +@localized() +export class SuperAdminBanner extends TailwindElement { + @state() + hide = false; + + render() { + if (this.hide) { + return html`
+ + + ${msg("You are logged in as a superadmin")} – + ${msg("please be careful.")} + +
+ +
+
+
`; + } else { + return html`
+
+ + + ${msg("You are logged in as a superadmin")} – + ${msg("please be careful.")} + +
+
`; + } + } +} diff --git a/frontend/src/index.ts b/frontend/src/index.ts index cbef0b7d..57deb6ee 100644 --- a/frontend/src/index.ts +++ b/frontend/src/index.ts @@ -336,7 +336,7 @@ export class App extends BtrixElement { render() { return html` -
+
${this.renderSuperadminBanner()} ${this.renderNavBar()} ${this.renderAlertBanner()}
-
- - - ${msg("You are logged in as a superadmin")} – - ${msg("please be careful.")} - -
-
`; + return html``; } }