-
+
}
+ .apiService=${this.apiService}
+ >
diff --git a/packages/leavittbook/src/demos/profile-picture/profile-picture-playground.ts b/packages/leavittbook/src/demos/profile-picture/profile-picture-playground.ts
index 7edd945eb..13601d294 100644
--- a/packages/leavittbook/src/demos/profile-picture/profile-picture-playground.ts
+++ b/packages/leavittbook/src/demos/profile-picture/profile-picture-playground.ts
@@ -38,38 +38,38 @@ export class ProfilePicturePlayground extends LitElement {
Default
Default profile picture styles
Square
Square profile picture styles
Color ring
Color ring variant
Sizes
Sizes include 32, 64, 128, 256, and 512px
Responsive
Size can be adjusted further using responsive units
`;
}
diff --git a/packages/leavittbook/src/demos/titanium-chip/titanium-chip-playground.ts b/packages/leavittbook/src/demos/titanium-chip/titanium-chip-playground.ts
index ee05f092f..42932e343 100644
--- a/packages/leavittbook/src/demos/titanium-chip/titanium-chip-playground.ts
+++ b/packages/leavittbook/src/demos/titanium-chip/titanium-chip-playground.ts
@@ -65,7 +65,7 @@ export class TitaniumChipPlayground extends LitElement {
Profile pictures
Slot in the profile picture element
Icons
@@ -78,7 +78,7 @@ export class TitaniumChipPlayground extends LitElement {
Variable type
Examples using various chip types together without a flex container
-
+
bolt
diff --git a/packages/profile-picture/src/profile-picture-menu-popup.ts b/packages/profile-picture/src/profile-picture-menu-popup.ts
index 9bc57e781..06b81c953 100644
--- a/packages/profile-picture/src/profile-picture-menu-popup.ts
+++ b/packages/profile-picture/src/profile-picture-menu-popup.ts
@@ -4,15 +4,11 @@ import '@material/mwc-button';
import { TitaniumPopupSurfaceFoundation } from '@leavittsoftware/titanium-popup-surface';
import { GetUserManagerInstance } from '@leavittsoftware/user-manager';
import { css, html } from 'lit';
-import { property, customElement, query } from 'lit/decorators.js';
-import { ProfilePictureElement } from './profile-picture';
+import { property, customElement } from 'lit/decorators.js';
@customElement('profile-picture-menu-popup')
export class ProfilePictureMenuPopupElement extends TitaniumPopupSurfaceFoundation {
- /**
- * Person id of user
- */
- @property({ type: Number }) personId: number = 0;
+ @property({ type: String }) profilePictureFileName: string | null;
/**
* Email address of user
@@ -29,15 +25,6 @@ export class ProfilePictureMenuPopupElement extends TitaniumPopupSurfaceFoundati
*/
@property({ type: String }) name: string = '';
- @query('profile-picture') profilePicture: ProfilePictureElement;
-
- /**
- * Reloads profile picture from server
- */
- forceRefreshPicture() {
- this.profilePicture.refresh();
- }
-
static styles = [
...TitaniumPopupSurfaceFoundation.styles,
css`
@@ -119,7 +106,7 @@ export class ProfilePictureMenuPopupElement extends TitaniumPopupSurfaceFoundati
render() {
return html`
e.preventDefault()}>
-
+
${this.name}
${this.company ? html`${this.company}
` : ''}
${this.email}
diff --git a/packages/profile-picture/src/profile-picture-menu.ts b/packages/profile-picture/src/profile-picture-menu.ts
index 7e46a884c..64bf6bab3 100644
--- a/packages/profile-picture/src/profile-picture-menu.ts
+++ b/packages/profile-picture/src/profile-picture-menu.ts
@@ -7,7 +7,6 @@ import { css, html, LitElement } from 'lit';
import { property, customElement, query } from 'lit/decorators.js';
import { styleMap } from 'lit/directives/style-map.js';
import { ProfilePictureMenuPopupElement } from './profile-picture-menu-popup';
-import { ProfilePictureElement } from './profile-picture';
/**
* Profile picture menu for the Leavitt Group
@@ -25,6 +24,8 @@ export class ProfilePictureMenuElement extends LitElement {
*/
@property({ type: Number }) size: number = 40;
+ @property({ type: String }) profilePictureFileName: string | null;
+
/**
* Person id of user
*/
@@ -40,7 +41,6 @@ export class ProfilePictureMenuElement extends LitElement {
*/
@property({ type: String }) company: string = '';
- @query('profile-picture') profilePicture: ProfilePictureElement;
@query('profile-picture-menu-popup') popup: ProfilePictureMenuPopupElement;
/**
@@ -53,19 +53,12 @@ export class ProfilePictureMenuElement extends LitElement {
this.setUserProps();
}
- /**
- * Reloads profile picture from server
- */
- forceRefreshPicture() {
- this.profilePicture.refresh();
- this.popup.forceRefreshPicture();
- }
-
/**
* Sets properties based on user manager instance
*/
setUserProps() {
this.personId = GetUserManagerInstance().personId;
+ this.profilePictureFileName = GetUserManagerInstance().profilePictureFileName;
this.email = GetUserManagerInstance().email;
this.company = GetUserManagerInstance().company;
this.name = GetUserManagerInstance().fullname;
@@ -100,7 +93,7 @@ export class ProfilePictureMenuElement extends LitElement {
>
{
if (this.personId) {
@@ -113,7 +106,7 @@ export class ProfilePictureMenuElement extends LitElement {
0 ? this.cacheBust + 1 : 1;
}
static styles = css`
@@ -140,22 +135,12 @@ export class ProfilePictureElement extends LitElement {
`;
renderProfilePicture() {
- return html`
-
(this.hasError = true)}
- src="https://cdn.leavitt.com/user-${this.hasError ? 0 : this.personId}-${this.#determineSize(this.size)}.jpeg${this.cacheBust > 0
- ? `?c=${this.cacheBust}`
- : ''}"
- />
- `;
+ return html`
`;
}
render() {
- if (this.linkToProfile) {
- return html`${this.renderProfilePicture()} `;
}
diff --git a/packages/user-manager/src/LssJwtToken.ts b/packages/user-manager/src/LssJwtToken.ts
index 0f2eaa5e1..463e09ded 100644
--- a/packages/user-manager/src/LssJwtToken.ts
+++ b/packages/user-manager/src/LssJwtToken.ts
@@ -9,6 +9,7 @@ export interface LssJwtToken {
given_name: string;
Company?: string;
CompanyId?: string;
+ PicCdnFileName?: string;
iss: string;
nameid: string;
nbf: number;
diff --git a/packages/user-manager/src/user-manager.ts b/packages/user-manager/src/user-manager.ts
index a29b3974d..a708b4b99 100644
--- a/packages/user-manager/src/user-manager.ts
+++ b/packages/user-manager/src/user-manager.ts
@@ -34,6 +34,8 @@ export class UserManager extends LitElement {
@property({ type: Number }) companyId: number | null;
+ @property({ type: String }) profilePictureFileName: string | null;
+
@property({ type: String }) email: string;
@property({ type: Number }) personId: number = 0;
@@ -246,6 +248,7 @@ export class UserManager extends LitElement {
this.company = _jwtToken.Company ?? '';
this.companyId = _jwtToken.CompanyId ? Number(_jwtToken.CompanyId) : 0;
+ this.profilePictureFileName = _jwtToken.PicCdnFileName || null;
this.dispatchEvent(new UserManagerUpdatedEvent());
}
@@ -355,6 +358,7 @@ export class UserManager extends LitElement {
this.fullname = '';
this.company = '';
this.companyId = null;
+ this.profilePictureFileName = null;
this.firstName = '';
this.lastName = '';
this.email = '';