blob: ed27db7289c68b9affda8217a449f51fc5dca764 [file] [log] [blame]
Adrià Vilanova Martínezf19ea432024-01-23 20:20:52 +01001// Copyright 2019 The Chromium Authors
Copybara854996b2021-09-07 19:36:02 +00002// 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 './mr-dropdown.js';
8
9/**
10 * `<mr-account-dropdown>`
11 *
12 * Account dropdown menu for Monorail.
13 *
14 */
15export class MrAccountDropdown extends LitElement {
16 /** @override */
17 static get styles() {
18 return css`
19 :host {
20 position: relative;
21 display: inline-block;
22 height: 100%;
23 font-size: inherit;
24 }
25 `;
26 }
27
28 /** @override */
29 render() {
30 return html`
31 <mr-dropdown
32 .text=${this.userDisplayName}
33 .items=${this.items}
34 .icon="arrow_drop_down"
35 ></mr-dropdown>
36 `;
37 }
38
39 /** @override */
40 static get properties() {
41 return {
42 userDisplayName: String,
43 logoutUrl: String,
44 loginUrl: String,
45 };
46 }
47
48 get items() {
49 return [
50 {text: 'Switch accounts', url: this.loginUrl},
51 {separator: true},
52 {text: 'Profile', url: `/u/${this.userDisplayName}`},
Adrià Vilanova Martínez535e7312021-10-17 00:48:12 +020053 {text: 'History', url: `/u/${this.userDisplayName}/updates`},
Copybara854996b2021-09-07 19:36:02 +000054 {text: 'Settings', url: '/hosting/settings'},
55 {text: 'Saved queries', url: `/u/${this.userDisplayName}/queries`},
56 {text: 'Hotlists', url: `/u/${this.userDisplayName}/hotlists`},
57 {separator: true},
58 {text: 'Sign out', url: this.logoutUrl},
59 ];
60 }
61}
62
63customElements.define('mr-account-dropdown', MrAccountDropdown);