2024-09-29 13:56:38 +02:00
|
|
|
import * as plugins from '../plugins.js';
|
2024-09-29 16:48:06 +02:00
|
|
|
import * as elements from '../elements/index.js';
|
2024-09-29 13:56:38 +02:00
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
customElement,
|
|
|
|
|
DeesElement,
|
|
|
|
|
property,
|
|
|
|
|
html,
|
|
|
|
|
cssManager,
|
|
|
|
|
unsafeCSS,
|
|
|
|
|
css,
|
|
|
|
|
type TemplateResult,
|
2025-11-30 15:01:28 +00:00
|
|
|
directives
|
2024-09-29 13:56:38 +02:00
|
|
|
} from '@design.estate/dees-element';
|
2025-11-30 15:01:28 +00:00
|
|
|
|
2024-09-29 16:48:06 +02:00
|
|
|
import type { IdpViewcontainer } from '../views/viewcontainer.js';
|
2024-10-06 23:56:03 +02:00
|
|
|
import { IdpState } from '../states/idp.state.js';
|
2024-09-29 13:56:38 +02:00
|
|
|
|
|
|
|
|
@customElement('idp-welcome')
|
|
|
|
|
export class IdpWelcome extends DeesElement {
|
2024-09-29 16:48:06 +02:00
|
|
|
viewContainer: IdpViewcontainer;
|
2024-09-29 13:56:38 +02:00
|
|
|
|
|
|
|
|
constructor() {
|
|
|
|
|
super();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static styles = [
|
|
|
|
|
cssManager.defaultStyles,
|
|
|
|
|
css`
|
|
|
|
|
:host {
|
|
|
|
|
display: block;
|
|
|
|
|
color: #fff;
|
|
|
|
|
font-family: 'Geist Sans';
|
|
|
|
|
}
|
|
|
|
|
:host([hidden]) {
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-07 15:14:44 +02:00
|
|
|
.maincontainer {
|
|
|
|
|
padding: 0px 16px;
|
2024-09-29 13:56:38 +02:00
|
|
|
}
|
|
|
|
|
|
2024-10-07 15:14:44 +02:00
|
|
|
.greeting {
|
|
|
|
|
text-align: center;
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
font-weight: 600;
|
2024-09-29 13:56:38 +02:00
|
|
|
margin: 24px auto;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-07 15:14:44 +02:00
|
|
|
dees-button {
|
2024-09-29 13:56:38 +02:00
|
|
|
margin-top: 16px;
|
2024-10-07 15:14:44 +02:00
|
|
|
margin-bottom: 16px;
|
2024-09-29 13:56:38 +02:00
|
|
|
}
|
2024-10-07 10:26:21 +02:00
|
|
|
`,
|
2024-09-29 13:56:38 +02:00
|
|
|
];
|
|
|
|
|
|
|
|
|
|
public render(): TemplateResult {
|
|
|
|
|
return html`
|
|
|
|
|
<style></style>
|
2024-10-07 15:14:44 +02:00
|
|
|
<idp-centercontainer>
|
|
|
|
|
<div class="maincontainer">
|
2025-11-30 15:01:28 +00:00
|
|
|
${directives.resolveExec(async () => {
|
2024-10-04 15:43:36 +02:00
|
|
|
const idpState = await IdpState.getSingletonInstance();
|
2024-10-07 10:26:21 +02:00
|
|
|
await idpState.idpClient.determineLoginStatus();
|
|
|
|
|
const data = await idpState.idpClient.whoIs().catch();
|
|
|
|
|
if (data?.user) {
|
|
|
|
|
return html`
|
2024-10-07 15:14:44 +02:00
|
|
|
<div class="greeting">Hello ${data.user.data.name}!</div>
|
2024-10-07 10:26:21 +02:00
|
|
|
<dees-button
|
|
|
|
|
@click=${async () => {
|
|
|
|
|
const idpState = await IdpState.getSingletonInstance();
|
|
|
|
|
idpState.domtools.router.pushUrl('/account');
|
|
|
|
|
}}
|
|
|
|
|
>Manage your account</dees-button
|
|
|
|
|
>
|
|
|
|
|
<dees-button
|
|
|
|
|
@click=${async () => {
|
|
|
|
|
const idpState = await IdpState.getSingletonInstance();
|
|
|
|
|
idpState.domtools.router.pushUrl('/logout');
|
|
|
|
|
}}
|
|
|
|
|
>Logout</dees-button
|
|
|
|
|
>
|
2024-10-07 15:14:44 +02:00
|
|
|
`;
|
2024-10-07 10:26:21 +02:00
|
|
|
}
|
|
|
|
|
return html`
|
|
|
|
|
Do you want to sign in or register?
|
|
|
|
|
<dees-button
|
|
|
|
|
@click=${async () => {
|
|
|
|
|
const idpState = await IdpState.getSingletonInstance();
|
|
|
|
|
idpState.domtools.router.pushUrl('/login');
|
|
|
|
|
}}
|
|
|
|
|
>Sign In</dees-button
|
|
|
|
|
>
|
|
|
|
|
<dees-button
|
|
|
|
|
@click=${async () => {
|
|
|
|
|
const idpState = await IdpState.getSingletonInstance();
|
|
|
|
|
idpState.domtools.router.pushUrl('/register');
|
|
|
|
|
}}
|
|
|
|
|
>Register</dees-button
|
|
|
|
|
>
|
|
|
|
|
`;
|
|
|
|
|
})}
|
2024-12-11 01:19:54 +01:00
|
|
|
<dees-button @click=${() => {}}>Learn more about idp.global</dees-button>
|
2024-09-29 16:48:06 +02:00
|
|
|
<dees-button @click=${() => {}}>Open Developer Dashboard</dees-button>
|
2024-10-07 10:26:21 +02:00
|
|
|
<dees-button
|
|
|
|
|
@click=${() => {
|
|
|
|
|
window.open('https://code.foss.global/idp.global/idp.global', '_blank');
|
|
|
|
|
}}
|
2024-10-07 15:14:44 +02:00
|
|
|
>Get the Source Code</dees-button
|
2024-10-07 10:26:21 +02:00
|
|
|
>
|
2024-10-07 15:14:44 +02:00
|
|
|
</div>
|
|
|
|
|
</idp-centercontainer>
|
2024-09-29 13:56:38 +02:00
|
|
|
`;
|
|
|
|
|
}
|
2024-10-07 15:14:44 +02:00
|
|
|
|
|
|
|
|
public async show() {
|
|
|
|
|
await this.updateComplete;
|
|
|
|
|
const centerContainer = this.shadowRoot.querySelector('idp-centercontainer');
|
|
|
|
|
await centerContainer.show();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public async hide() {
|
|
|
|
|
await this.updateComplete;
|
|
|
|
|
const centerContainer = this.shadowRoot.querySelector('idp-centercontainer');
|
|
|
|
|
await centerContainer.hide();
|
|
|
|
|
}
|
2024-09-29 13:56:38 +02:00
|
|
|
}
|