Adrià Vilanova MartÃnez | 7cc6337 | 2022-05-15 23:16:25 +0200 | [diff] [blame] | 1 | // Copyright 2019 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | import {LitElement, html, css} from 'lit-element'; |
| 6 | |
| 7 | import {connectStore} from 'reducers/base.js'; |
| 8 | import * as projectV0 from 'reducers/projectV0.js'; |
| 9 | import * as sitewide from 'reducers/sitewide.js'; |
| 10 | |
| 11 | const OLD_VULNZ_URL = "https://vulnz.avm99963.com/"; |
| 12 | |
| 13 | /** |
| 14 | * `<mr-vulnz-banner>` |
| 15 | * |
| 16 | * A banner for the Vulnz project to state where old vulnerability |
| 17 | * reports can be found. |
| 18 | * |
| 19 | */ |
| 20 | export class MrVulnzBanner extends connectStore(LitElement) { |
| 21 | /** @override */ |
| 22 | static get styles() { |
| 23 | return css` |
| 24 | :host([hidden]) { |
| 25 | display: none; |
| 26 | } |
| 27 | :host { |
| 28 | display: block; |
| 29 | font-weight: bold; |
| 30 | color: var(--chops-black); |
| 31 | background: var(--chops-primary-accent-bg); |
| 32 | padding: 5px; |
| 33 | text-align: center; |
| 34 | } |
| 35 | `; |
| 36 | } |
| 37 | |
| 38 | /** @override */ |
| 39 | render() { |
| 40 | return html`Much older vulnerability reports can be found at |
| 41 | <a href="${OLD_VULNZ_URL}">${OLD_VULNZ_URL}</a>.`; |
| 42 | } |
| 43 | |
| 44 | /** @override */ |
| 45 | static get properties() { |
| 46 | return { |
| 47 | hidden: { |
| 48 | type: Boolean, |
| 49 | reflect: true, |
| 50 | }, |
| 51 | }; |
| 52 | } |
| 53 | |
| 54 | /** @override */ |
| 55 | constructor() { |
| 56 | super(); |
| 57 | |
| 58 | this.hidden = true; |
| 59 | } |
| 60 | |
| 61 | /** @override */ |
| 62 | stateChanged(state) { |
| 63 | this.hidden = projectV0.viewedProjectName(state) !== 'vulnz'; |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | customElements.define('mr-vulnz-banner', MrVulnzBanner); |