2024-10-06 23:56:03 +02:00
|
|
|
import {
|
|
|
|
|
customElement,
|
|
|
|
|
DeesElement,
|
|
|
|
|
property,
|
|
|
|
|
html,
|
|
|
|
|
cssManager,
|
|
|
|
|
unsafeCSS,
|
|
|
|
|
css,
|
|
|
|
|
type TemplateResult,
|
|
|
|
|
} from '@design.estate/dees-element';
|
|
|
|
|
|
|
|
|
|
import * as plugins from '../../plugins.js';
|
|
|
|
|
import * as states from '../../states/accountstate.js';
|
2024-10-07 10:26:21 +02:00
|
|
|
import { IdpState } from '../../states/idp.state.js';
|
2025-12-01 04:08:17 +00:00
|
|
|
import { accountDesignTokens } from './sharedstyles.js';
|
2024-10-07 10:26:21 +02:00
|
|
|
|
|
|
|
|
import { commitinfo } from '../../../dist_ts/00_commitinfo_data.js';
|
2024-10-06 23:56:03 +02:00
|
|
|
|
|
|
|
|
declare global {
|
|
|
|
|
interface HTMLElementTagNameMap {
|
|
|
|
|
'lele-accountnavigation': LeleAccountNavigation;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@customElement('lele-accountnavigation')
|
|
|
|
|
export class LeleAccountNavigation extends DeesElement {
|
|
|
|
|
constructor() {
|
|
|
|
|
super();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static styles = [
|
|
|
|
|
cssManager.defaultStyles,
|
2025-12-01 04:08:17 +00:00
|
|
|
accountDesignTokens,
|
2024-10-06 23:56:03 +02:00
|
|
|
css`
|
|
|
|
|
:host {
|
2025-12-01 04:08:17 +00:00
|
|
|
display: flex;
|
|
|
|
|
flex-direction: column;
|
|
|
|
|
background: var(--card);
|
|
|
|
|
border-right: 1px solid var(--border);
|
|
|
|
|
height: 100%;
|
2024-10-06 23:56:03 +02:00
|
|
|
}
|
|
|
|
|
:host([hidden]) {
|
|
|
|
|
display: none;
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-01 04:08:17 +00:00
|
|
|
.logoArea {
|
|
|
|
|
padding: 20px 16px;
|
|
|
|
|
border-bottom: 1px solid var(--border);
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-07 15:14:44 +02:00
|
|
|
.logo {
|
2025-12-01 04:08:17 +00:00
|
|
|
font-family: 'Cal Sans', 'Geist Sans', sans-serif;
|
|
|
|
|
letter-spacing: -0.02em;
|
|
|
|
|
font-size: 20px;
|
|
|
|
|
font-weight: 600;
|
|
|
|
|
color: var(--foreground);
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
transition: opacity 0.15s ease;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 8px;
|
2024-10-07 15:14:44 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.logo:hover {
|
2025-12-01 04:08:17 +00:00
|
|
|
opacity: 0.8;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.logo dees-icon {
|
|
|
|
|
font-size: 24px;
|
|
|
|
|
opacity: 0.9;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.navContent {
|
|
|
|
|
flex: 1;
|
|
|
|
|
overflow-y: auto;
|
|
|
|
|
padding-bottom: 16px;
|
2024-10-07 15:14:44 +02:00
|
|
|
}
|
|
|
|
|
|
2024-10-07 10:26:21 +02:00
|
|
|
.commitinfo {
|
2025-12-01 04:08:17 +00:00
|
|
|
flex-shrink: 0;
|
2024-10-07 10:26:21 +02:00
|
|
|
text-align: center;
|
2025-12-01 04:08:17 +00:00
|
|
|
font-family: 'Geist Mono', monospace;
|
|
|
|
|
font-size: 10px;
|
|
|
|
|
padding: 12px 16px;
|
|
|
|
|
border-top: 1px solid var(--border);
|
|
|
|
|
color: var(--muted-foreground);
|
|
|
|
|
opacity: 0.6;
|
|
|
|
|
background: var(--card);
|
2024-10-07 10:26:21 +02:00
|
|
|
}
|
|
|
|
|
|
2024-10-06 23:56:03 +02:00
|
|
|
.navigationGroupLabel {
|
2025-12-01 04:08:17 +00:00
|
|
|
font-size: 10px;
|
|
|
|
|
font-weight: 600;
|
2024-10-06 23:56:03 +02:00
|
|
|
text-transform: uppercase;
|
2025-12-01 04:08:17 +00:00
|
|
|
letter-spacing: 0.08em;
|
|
|
|
|
color: var(--muted-foreground);
|
|
|
|
|
padding: 20px 16px 8px;
|
|
|
|
|
opacity: 0.7;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.navigationGroupLabel:first-of-type {
|
|
|
|
|
padding-top: 16px;
|
2024-10-06 23:56:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.navigationOption {
|
2025-12-01 04:08:17 +00:00
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
gap: 10px;
|
|
|
|
|
padding: 10px 12px;
|
|
|
|
|
margin: 2px 8px;
|
|
|
|
|
border-radius: 8px;
|
|
|
|
|
font-size: 13px;
|
2024-10-06 23:56:03 +02:00
|
|
|
font-weight: 500;
|
2025-12-01 04:08:17 +00:00
|
|
|
color: var(--muted-foreground);
|
|
|
|
|
transition: all 0.15s ease;
|
|
|
|
|
cursor: pointer;
|
2024-10-06 23:56:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.navigationOption:hover {
|
2025-12-01 04:08:17 +00:00
|
|
|
background: var(--muted);
|
|
|
|
|
color: var(--foreground);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.navigationOption dees-icon {
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
opacity: 0.7;
|
|
|
|
|
flex-shrink: 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.navigationOption:hover dees-icon {
|
|
|
|
|
opacity: 1;
|
2024-10-06 23:56:03 +02:00
|
|
|
}
|
2025-12-01 04:08:17 +00:00
|
|
|
|
|
|
|
|
.divider {
|
|
|
|
|
height: 1px;
|
|
|
|
|
background: var(--border);
|
|
|
|
|
margin: 8px 16px;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-06 23:56:03 +02:00
|
|
|
dees-input-dropdown {
|
2025-12-01 04:08:17 +00:00
|
|
|
margin: 8px;
|
2024-10-06 23:56:03 +02:00
|
|
|
}
|
|
|
|
|
`,
|
|
|
|
|
];
|
|
|
|
|
|
2024-10-07 15:14:44 +02:00
|
|
|
public async getAccountRouter() {
|
|
|
|
|
const host = (this.getRootNode() as any).host;
|
|
|
|
|
return (host as any).subrouter;
|
|
|
|
|
}
|
|
|
|
|
|
2024-10-06 23:56:03 +02:00
|
|
|
public render(): TemplateResult {
|
|
|
|
|
return html`
|
2025-12-01 04:08:17 +00:00
|
|
|
<div class="logoArea">
|
|
|
|
|
<div class="logo">
|
|
|
|
|
<dees-icon .icon=${'lucide:fingerprint'}></dees-icon>
|
|
|
|
|
idp.global
|
|
|
|
|
</div>
|
2024-10-07 10:26:21 +02:00
|
|
|
</div>
|
2025-12-01 04:08:17 +00:00
|
|
|
|
|
|
|
|
<div class="navContent">
|
|
|
|
|
<div class="navigationGroupLabel">Account</div>
|
|
|
|
|
<div
|
|
|
|
|
class="navigationOption"
|
|
|
|
|
@click=${async () => {
|
|
|
|
|
const subrouter = await this.getAccountRouter();
|
|
|
|
|
subrouter.pushUrl('');
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<dees-icon .icon=${'lucide:home'}></dees-icon>
|
|
|
|
|
Overview
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
class="navigationOption"
|
|
|
|
|
@click=${async () => {
|
|
|
|
|
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<dees-icon .icon=${'lucide:shield'}></dees-icon>
|
|
|
|
|
Manage Roles
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
class="navigationOption"
|
|
|
|
|
@click=${async () => {
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<dees-icon .icon=${'lucide:plus'}></dees-icon>
|
|
|
|
|
Create Organization
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
class="navigationOption"
|
|
|
|
|
@click=${async () => {
|
|
|
|
|
const idpState = await IdpState.getSingletonInstance();
|
|
|
|
|
idpState.domtools.router.pushUrl('/logout');
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<dees-icon .icon=${'lucide:power'}></dees-icon>
|
|
|
|
|
Log Out
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div class="divider"></div>
|
|
|
|
|
|
|
|
|
|
<div class="navigationGroupLabel">Organization</div>
|
|
|
|
|
<dees-input-dropdown
|
|
|
|
|
.label=${'Select organization'}
|
|
|
|
|
@selectedOption=${(eventArg: CustomEvent) => {
|
|
|
|
|
const currentState = states.accountState.getState();
|
|
|
|
|
states.accountState.dispatchAction(
|
|
|
|
|
states.setSelectedOrg,
|
|
|
|
|
currentState.organizations.find((org) => org.data.slug === eventArg.detail.payload)
|
|
|
|
|
);
|
|
|
|
|
}}
|
|
|
|
|
></dees-input-dropdown>
|
|
|
|
|
|
|
|
|
|
<div
|
|
|
|
|
class="navigationOption"
|
|
|
|
|
@click=${async () => {}}
|
|
|
|
|
>
|
|
|
|
|
<dees-icon .icon=${'lucide:box'}></dees-icon>
|
|
|
|
|
Apps
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
class="navigationOption"
|
|
|
|
|
@click=${async () => {}}
|
|
|
|
|
>
|
|
|
|
|
<dees-icon .icon=${'lucide:users'}></dees-icon>
|
|
|
|
|
Users
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
class="navigationOption"
|
|
|
|
|
@click=${async () => {}}
|
|
|
|
|
>
|
|
|
|
|
<dees-icon .icon=${'lucide:activity'}></dees-icon>
|
|
|
|
|
Activity
|
|
|
|
|
</div>
|
|
|
|
|
<div
|
|
|
|
|
class="navigationOption"
|
|
|
|
|
@click=${async () => {}}
|
|
|
|
|
>
|
|
|
|
|
<dees-icon .icon=${'lucide:wallet'}></dees-icon>
|
|
|
|
|
Billing
|
|
|
|
|
</div>
|
2024-10-07 10:26:21 +02:00
|
|
|
</div>
|
2025-12-01 04:08:17 +00:00
|
|
|
|
|
|
|
|
<div class="commitinfo">v${commitinfo.version}</div>
|
2024-10-06 23:56:03 +02:00
|
|
|
`;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public firstUpdated() {
|
|
|
|
|
const deesInputDropdown = this.shadowRoot.querySelector('dees-input-dropdown');
|
|
|
|
|
const orgToMenuEntry = (orgArg?: plugins.idpInterfaces.data.IOrganization) => {
|
|
|
|
|
if (!orgArg) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return {
|
|
|
|
|
option: orgArg.data.name,
|
|
|
|
|
key: orgArg.data.slug,
|
|
|
|
|
payload: orgArg.data.slug,
|
2024-10-07 10:26:21 +02:00
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
states.accountState
|
|
|
|
|
.select((stateArg) => stateArg.organizations)
|
|
|
|
|
.pipe(
|
|
|
|
|
plugins.deesDomtools.plugins.smartrx.rxjs.ops.map((orgArrayArg) => {
|
|
|
|
|
return orgArrayArg.map(orgToMenuEntry);
|
|
|
|
|
})
|
|
|
|
|
)
|
|
|
|
|
.subscribe((menuEntries) => {
|
|
|
|
|
deesInputDropdown.options = menuEntries;
|
|
|
|
|
});
|
|
|
|
|
states.accountState
|
|
|
|
|
.select((stateArg) => stateArg.selectedOrg)
|
|
|
|
|
.pipe(plugins.deesDomtools.plugins.smartrx.rxjs.ops.map(orgToMenuEntry))
|
|
|
|
|
.subscribe((selectedOrgArg) => {
|
|
|
|
|
deesInputDropdown.selectedOption = selectedOrgArg;
|
|
|
|
|
});
|
2024-10-06 23:56:03 +02:00
|
|
|
}
|
|
|
|
|
}
|