From a4b051fcc12cd20cabfeae3c1d8ac4a93daf80e4 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Fri, 23 Jul 2021 20:57:06 +0200 Subject: [PATCH] web: fix icon flashing in header, fix notification header icon in dark mode Signed-off-by: Jens Langhammer --- web/src/authentik.css | 3 ++- web/src/elements/PageHeader.ts | 45 +++++++++++++++++++--------------- 2 files changed, 27 insertions(+), 21 deletions(-) diff --git a/web/src/authentik.css b/web/src/authentik.css index 312af5a08..486dac231 100644 --- a/web/src/authentik.css +++ b/web/src/authentik.css @@ -127,7 +127,8 @@ body { .pf-c-page__main-section { --pf-c-page__main-section--BackgroundColor: var(--ak-dark-background); } - .sidebar-trigger { + .sidebar-trigger, + .notification-trigger { background-color: var(--ak-dark-background-light) !important; } .pf-c-page__main-section.pf-m-light { diff --git a/web/src/elements/PageHeader.ts b/web/src/elements/PageHeader.ts index b3dd34b58..4da4d8308 100644 --- a/web/src/elements/PageHeader.ts +++ b/web/src/elements/PageHeader.ts @@ -6,7 +6,6 @@ import PFBase from "@patternfly/patternfly/patternfly-base.css"; import PFButton from "@patternfly/patternfly/components/Button/button.css"; import { EVENT_NOTIFICATION_TOGGLE, EVENT_SIDEBAR_TOGGLE, TITLE_DEFAULT } from "../constants"; import { DEFAULT_CONFIG, tenant } from "../api/Config"; -import { until } from "lit-html/directives/until"; import { EventsApi } from "../../api/dist"; @customElement("ak-page-header") @@ -18,6 +17,9 @@ export class PageHeader extends LitElement { @property({type: Boolean}) iconImage = false + @property({type: Boolean}) + hasNotifications = false; + @property() set header(value: string) { tenant().then(tenant => { @@ -79,6 +81,16 @@ export class PageHeader extends LitElement { return html``; } + firstUpdated(): void { + new EventsApi(DEFAULT_CONFIG).eventsNotificationsList({ + seen: false, + ordering: "-created", + pageSize: 1, + }).then(r => { + this.hasNotifications = r.pagination.count > 0; + }); + } + render(): TemplateResult { return html``; - }))}`; + `; } }