From 0c9666ec580598f15a75283a24a886c862a5237a Mon Sep 17 00:00:00 2001 From: RVany Date: Wed, 22 Feb 2023 17:00:18 -0500 Subject: [PATCH 1/4] Chat Button Added and Display Name Changed --- .../components/DirectoryHook.tsx | 4 +++- .../components/PersonaCard/IUserProperties.ts | 2 +- .../components/PersonaCard/PersonaCard.tsx | 8 ++++++++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/webparts/spfxReactDirectoryWebpart/components/DirectoryHook.tsx b/src/webparts/spfxReactDirectoryWebpart/components/DirectoryHook.tsx index cb7bbbc..ab45df3 100644 --- a/src/webparts/spfxReactDirectoryWebpart/components/DirectoryHook.tsx +++ b/src/webparts/spfxReactDirectoryWebpart/components/DirectoryHook.tsx @@ -31,6 +31,7 @@ import { ISPServices } from "./SPServices/ISPServices"; import { spservices } from "./SPServices/spservices"; import { PersonaCard } from "./PersonaCard/PersonaCard"; import Paging from "./Pagination/Paging"; +import { UserBase } from "@pnp/sp/src/siteusers"; const wrapStackTokens: IStackTokens = { childrenGap: 30 }; @@ -120,7 +121,8 @@ const DirectoryHook: React.FC = (props) => { context={props.context} prefLang={props.prefLang} profileProperties={{ - DisplayName: user.PreferredName, + DisplayName: + user.FirstName && user.LastName ? `${user.FirstName} ${user.LastName}` : user.PreferredName, Title: user.JobTitle, PictureUrl: user.PictureURL, Email: user.WorkEmail, diff --git a/src/webparts/spfxReactDirectoryWebpart/components/PersonaCard/IUserProperties.ts b/src/webparts/spfxReactDirectoryWebpart/components/PersonaCard/IUserProperties.ts index ff03113..c532c35 100644 --- a/src/webparts/spfxReactDirectoryWebpart/components/PersonaCard/IUserProperties.ts +++ b/src/webparts/spfxReactDirectoryWebpart/components/PersonaCard/IUserProperties.ts @@ -1,7 +1,7 @@ export interface IUserProperties { Department: string; MobilePhone?: string; - PictureUrl: string; + PictureUrl?: string; Title: string; DisplayName: string; Email: string; diff --git a/src/webparts/spfxReactDirectoryWebpart/components/PersonaCard/PersonaCard.tsx b/src/webparts/spfxReactDirectoryWebpart/components/PersonaCard/PersonaCard.tsx index 5f0e1d7..417103e 100644 --- a/src/webparts/spfxReactDirectoryWebpart/components/PersonaCard/PersonaCard.tsx +++ b/src/webparts/spfxReactDirectoryWebpart/components/PersonaCard/PersonaCard.tsx @@ -191,8 +191,16 @@ export class PersonaCard extends React.Component + {strings.SendEmailLabel} + + Start chat + From 7dedebe7c37de37ad799696096a6ab998b89429e Mon Sep 17 00:00:00 2001 From: RVany Date: Thu, 23 Feb 2023 07:38:16 -0500 Subject: [PATCH 2/4] Localization added to Email and Chat buttons --- .../components/PersonaCard/PersonaCard.tsx | 2 +- .../components/SPServices/spservices.ts | 4 ++-- src/webparts/spfxReactDirectoryWebpart/loc/en-us.js | 1 + src/webparts/spfxReactDirectoryWebpart/loc/fr-fr.js | 1 + 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/webparts/spfxReactDirectoryWebpart/components/PersonaCard/PersonaCard.tsx b/src/webparts/spfxReactDirectoryWebpart/components/PersonaCard/PersonaCard.tsx index 417103e..5e9c65d 100644 --- a/src/webparts/spfxReactDirectoryWebpart/components/PersonaCard/PersonaCard.tsx +++ b/src/webparts/spfxReactDirectoryWebpart/components/PersonaCard/PersonaCard.tsx @@ -199,7 +199,7 @@ export class PersonaCard extends React.Component - Start chat + {strings.StartChatLabel} diff --git a/src/webparts/spfxReactDirectoryWebpart/components/SPServices/spservices.ts b/src/webparts/spfxReactDirectoryWebpart/components/SPServices/spservices.ts index 1257d13..1009a4a 100644 --- a/src/webparts/spfxReactDirectoryWebpart/components/SPServices/spservices.ts +++ b/src/webparts/spfxReactDirectoryWebpart/components/SPServices/spservices.ts @@ -52,13 +52,13 @@ export class spservices implements ISPServices { Querytext: qrytext, StartRow: startItem, RowLimit: endItem, - EnableInterleaving: true, + // EnableInterleaving: true, SelectProperties: searchProperties, SourceId: "b09a7990-05ea-4af9-81ef-edfab16c4e31", SortList: [{ Property: "FirstName", Direction: SortDirection.Ascending }], }); let n = users.PrimarySearchResults.length; - console.log("users",users) + console.log("users", users); if (users && n > 0) { for (let index = 0; index < n; index++) { let user: any = users.PrimarySearchResults[index]; diff --git a/src/webparts/spfxReactDirectoryWebpart/loc/en-us.js b/src/webparts/spfxReactDirectoryWebpart/loc/en-us.js index 1c06ce2..250e429 100644 --- a/src/webparts/spfxReactDirectoryWebpart/loc/en-us.js +++ b/src/webparts/spfxReactDirectoryWebpart/loc/en-us.js @@ -11,6 +11,7 @@ define([], function () { SearchBoxLabel: "Search for a colleague (Last Name)", SearchButtonLabel: "Search", SendEmailLabel: "Send Email", + StartChatLabel: "Start Chat", NoUserFoundLabelText: "Invite a colleague", NoUserFoundImageAltText: "A hiding yeti", NoUserFoundEmail: diff --git a/src/webparts/spfxReactDirectoryWebpart/loc/fr-fr.js b/src/webparts/spfxReactDirectoryWebpart/loc/fr-fr.js index 0df8ce8..b6117fb 100644 --- a/src/webparts/spfxReactDirectoryWebpart/loc/fr-fr.js +++ b/src/webparts/spfxReactDirectoryWebpart/loc/fr-fr.js @@ -11,6 +11,7 @@ define([], function () { SearchBoxLabel: "Rechercher un(e) collègue (Nom de famille)", SearchButtonLabel: "Recherche", SendEmailLabel: "Envoyer un courriel", + StartChatLabel: "Lancer une séance de clavardage", NoUserFoundLabelText: "Inviter un collègue", NoUserFoundImageAltText: "Un yeti qui se cache", NoUserFoundEmail: From b41c6ec0a52f4d00ba4bac74c96adabf0967c563 Mon Sep 17 00:00:00 2001 From: RVany Date: Thu, 23 Feb 2023 08:07:15 -0500 Subject: [PATCH 3/4] Start Chat Label declared in mystrings --- src/webparts/spfxReactDirectoryWebpart/loc/mystrings.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/webparts/spfxReactDirectoryWebpart/loc/mystrings.d.ts b/src/webparts/spfxReactDirectoryWebpart/loc/mystrings.d.ts index 3abbebd..747b50c 100644 --- a/src/webparts/spfxReactDirectoryWebpart/loc/mystrings.d.ts +++ b/src/webparts/spfxReactDirectoryWebpart/loc/mystrings.d.ts @@ -11,7 +11,6 @@ declare interface ISpfxReactDirectoryWebpartWebPartStrings { AppTeamsTabEnvironment: string; AppOfficeEnvironment: string; AppOutlookEnvironment: string; - SearchPlaceHolder: string; PropertyPaneDescription: string; BasicGroupName: string; @@ -21,16 +20,17 @@ declare interface ISpfxReactDirectoryWebpartWebPartStrings { LoadingText: string; SearchBoxLabel: string; SendEmailLabel: string; + StartChatLabel: string; NoUserFoundLabelText: string; NoUserFoundImageAltText: string; NoUserFoundEmailSubject: string; NoUserFoundEmailBody: string; NoUserFoundEmail: string; - SearchButtonLabel:String; + SearchButtonLabel: String; } -declare module 'SpfxReactDirectoryWebpartWebPartStrings' { +declare module "SpfxReactDirectoryWebpartWebPartStrings" { const strings: ISpfxReactDirectoryWebpartWebPartStrings; export = strings; } From f97f28afd591770535309b8a910b881079ab23f5 Mon Sep 17 00:00:00 2001 From: RVany Date: Mon, 27 Feb 2023 08:33:20 -0500 Subject: [PATCH 4/4] UserPrincipalName tested in deep linking --- .../spfxReactDirectoryWebpart/components/DirectoryHook.tsx | 1 + .../components/PersonaCard/IUserProperties.ts | 1 + .../components/SPServices/spservices.ts | 1 + src/webparts/spfxReactDirectoryWebpart/loc/en-us.js | 2 +- 4 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/webparts/spfxReactDirectoryWebpart/components/DirectoryHook.tsx b/src/webparts/spfxReactDirectoryWebpart/components/DirectoryHook.tsx index ab45df3..89b97c7 100644 --- a/src/webparts/spfxReactDirectoryWebpart/components/DirectoryHook.tsx +++ b/src/webparts/spfxReactDirectoryWebpart/components/DirectoryHook.tsx @@ -129,6 +129,7 @@ const DirectoryHook: React.FC = (props) => { Department: user.Department, WorkPhone: user.WorkPhone, Location: user.OfficeNumber ? user.OfficeNumber : user.BaseOfficeLocation, + UserID: "priyamvada.singh_tbs-sct.gc.ca#EXT#@gcxgce.onmicrosoft.com", }} /> ); diff --git a/src/webparts/spfxReactDirectoryWebpart/components/PersonaCard/IUserProperties.ts b/src/webparts/spfxReactDirectoryWebpart/components/PersonaCard/IUserProperties.ts index c532c35..11aef8e 100644 --- a/src/webparts/spfxReactDirectoryWebpart/components/PersonaCard/IUserProperties.ts +++ b/src/webparts/spfxReactDirectoryWebpart/components/PersonaCard/IUserProperties.ts @@ -7,4 +7,5 @@ export interface IUserProperties { Email: string; WorkPhone?: string; Location?: string; + UserID: string; } diff --git a/src/webparts/spfxReactDirectoryWebpart/components/SPServices/spservices.ts b/src/webparts/spfxReactDirectoryWebpart/components/SPServices/spservices.ts index 9c333b0..73a96dd 100644 --- a/src/webparts/spfxReactDirectoryWebpart/components/SPServices/spservices.ts +++ b/src/webparts/spfxReactDirectoryWebpart/components/SPServices/spservices.ts @@ -46,6 +46,7 @@ export class spservices implements ISPServices { "BaseOfficeLocation", "SPS-UserType", "GroupId", + "UserPrincipalName", ]; try { let users = await sp.search({ diff --git a/src/webparts/spfxReactDirectoryWebpart/loc/en-us.js b/src/webparts/spfxReactDirectoryWebpart/loc/en-us.js index 250e429..9063f28 100644 --- a/src/webparts/spfxReactDirectoryWebpart/loc/en-us.js +++ b/src/webparts/spfxReactDirectoryWebpart/loc/en-us.js @@ -1,6 +1,6 @@ define([], function () { return { - SearchPlaceHolder: "Search by last name", + SearchPlaceHolder: "Search by last name id", PropertyPaneDescription: "Search People from Organization Directory", BasicGroupName: "Properties", TitleFieldLabel: "Web Part Title",