diff --git a/src/elements/pages/dev-dash.ts b/src/elements/pages/dev-dash.ts index a4672067..cde43822 100644 --- a/src/elements/pages/dev-dash.ts +++ b/src/elements/pages/dev-dash.ts @@ -1,21 +1,80 @@ import { LitElement, html } from 'lit'; -import { customElement } from 'lit/decorators.js'; +import { customElement, property } from 'lit/decorators.js'; import { cssify } from '../../utils/css'; import styles from './dev-dash.scss'; - +import global from '../../utils/global'; +import { when } from 'lit/directives/when.js'; +import { IdentityChangeEvent, globalEventGroups } from '../../utils/global-events'; +import { isDeveloper } from '../../utils/identity'; +import routes from '../../routes'; +import UIRouter from '../root/ui-router'; +import UIRoot from '../root/ui-root'; @customElement('dev-dash') export default class DeveloperDash extends LitElement { static styles = cssify(styles); + @property({ type: Object }) + loadError?: any; + + /// === EVENTS === + handleIdentityChange: (e: IdentityChangeEvent) => void; + + connectedCallback() { + super.connectedCallback(); + + this.handleIdentityChange = this.onIdentityChange.bind(this); + globalEventGroups.add('identity-change', this.handleIdentityChange); + } + + disconnectedCallback() { + super.disconnectedCallback(); + + globalEventGroups.remove('identity-change', this.handleIdentityChange); + } + + onIdentityChange() { + if (isDeveloper(global.currentIdentity)) { + UIRouter.shared.navigate(routes.home.build({}), { + replaceHistory: true, + forceSamePage: true + }); + } else { + this.requestUpdate(); + } + } + render() { return html` -
- - -
- -
-
+ ${ + when(global.currentIdentity.groups.find((group) => group.group.isDeveloper), + () => html` +
+ +
+ +
+
+ `, + () => html` +
+

Private Beta

+

Rivet is still in private beta. Join the waitlist to get early access.

+
+ + Beta Access Form + +
+
+

Have access and just got logged out?

+
+ UIRoot.shared.openRegisterPanel()}> + Login + +
+ ` + ) + } `; } }