@ddd-qc/profiles-dvm 0.26.8 → 0.26.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/utils.d.ts +1 -2
- package/dist/utils.js +4 -13
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
package/dist/utils.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { ProfilesAltPerspective } from "./profilesAlt.zvm";
|
|
2
1
|
import { Profile as ProfileMat } from "./bindings/profiles.types";
|
|
3
2
|
import { TemplateResult } from "lit";
|
|
4
3
|
import { AgentId } from "@ddd-qc/cell-proxy";
|
|
5
4
|
/** */
|
|
6
5
|
export declare function getInitials(nickname: string): string;
|
|
7
6
|
/** */
|
|
8
|
-
export declare function agent2avatar(key: AgentId,
|
|
7
|
+
export declare function agent2avatar(key: AgentId, profile?: ProfileMat): [ProfileMat, TemplateResult<1>];
|
package/dist/utils.js
CHANGED
|
@@ -12,19 +12,10 @@ export function getInitials(nickname) {
|
|
|
12
12
|
return initials;
|
|
13
13
|
}
|
|
14
14
|
/** */
|
|
15
|
-
export function agent2avatar(key,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
throw Error("ProfileAh not found for agent");
|
|
20
|
-
}
|
|
21
|
-
let profile = { nickname: "unknown", fields: {} };
|
|
22
|
-
const maybeProfilePair = profilesPerspective.profiles.get(maybeProfileId);
|
|
23
|
-
if (maybeProfilePair) {
|
|
24
|
-
profile = maybeProfilePair[0];
|
|
25
|
-
}
|
|
26
|
-
else {
|
|
27
|
-
console.log("Profile not found for agent", key, profilesPerspective.profiles);
|
|
15
|
+
export function agent2avatar(key, profile) {
|
|
16
|
+
if (!profile) {
|
|
17
|
+
console.warn("agent2avatar() No Profile arg", key);
|
|
18
|
+
profile = { nickname: "unknown", fields: {} };
|
|
28
19
|
}
|
|
29
20
|
const initials = getInitials(profile.nickname);
|
|
30
21
|
const avatarUrl = profile.fields['avatar'];
|
package/dist/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAiB,MAAM,KAAK,CAAC;AAGzC,MAAM;AACN,MAAM,UAAU,WAAW,CAAC,QAAgB;IACxC,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAClC,IAAI,QAAQ,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;IACtD,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;QAClB,QAAQ,IAAI,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;KACrE;SAAM;QACH,QAAQ,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;KACxC;IACD,OAAO,QAAQ,CAAC;AACpB,CAAC;AAID,MAAM;AACN,MAAM,UAAU,YAAY,CAAC,GAAY,EAAE,OAAoB;IAC3D,IAAI,CAAC,OAAO,EAAE;QACV,OAAO,CAAC,IAAI,CAAC,+BAA+B,EAAE,GAAG,CAAC,CAAC;QACnD,OAAO,GAAG,EAAC,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAe,CAAC;KAC7D;IACD,MAAM,QAAQ,GAAG,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC/C,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC3C,MAAM,MAAM,GACR,SAAS,CAAA,CAAC,CAAC,IAAI,CAAA;;yBAEE,SAAS;;aAErB,CAAC,CAAC,CAAC,IAAI,CAAA;oEACgD,QAAQ;iBAC3D,CAAC;IACd,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["import {Profile as ProfileMat} from \"./bindings/profiles.types\";\nimport {html, TemplateResult} from \"lit\";\nimport {AgentId} from \"@ddd-qc/cell-proxy\";\n\n/** */\nexport function getInitials(nickname: string): string {\n const names = nickname.split(' ');\n let initials = names[0].substring(0, 1).toUpperCase();\n if (names.length > 1) {\n initials += names[names.length - 1].substring(0, 1).toUpperCase();\n } else {\n initials += names[0].substring(1, 2);\n }\n return initials;\n}\n\n\n\n/** */\nexport function agent2avatar(key: AgentId, profile?: ProfileMat): [ProfileMat, TemplateResult<1>] {\n if (!profile) {\n console.warn(\"agent2avatar() No Profile arg\", key);\n profile = {nickname: \"unknown\", fields: {}} as ProfileMat;\n }\n const initials = getInitials(profile.nickname);\n const avatarUrl = profile.fields['avatar'];\n const avatar =\n avatarUrl? html`\n <sl-avatar class=\"activityAvatar\" style=\"box-shadow: 1px 1px 1px 1px rgba(130, 122, 122, 0.88)\">\n <img src=${avatarUrl}>\n </sl-avatar> \n ` : html`\n <sl-avatar class=\"activityAvatar\" shape=\"circle\" initials=${initials} color-scheme=\"Accent2\"></sl-avatar>\n `;\n return [profile, avatar];\n}\n"]}
|