blob: 959e163b0187e2690ba8a28ceadfca41bcb1be57 [file] [log] [blame]
Adrià Vilanova Martínez7cc63372022-05-15 23:16:25 +02001// 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
5import {LitElement, html, css} from 'lit-element';
6
7import {connectStore} from 'reducers/base.js';
8import * as projectV0 from 'reducers/projectV0.js';
9import * as sitewide from 'reducers/sitewide.js';
10
11const 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 */
20export 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
67customElements.define('mr-vulnz-banner', MrVulnzBanner);