profile-pane 2.0.0-newStyle-ca717ed2 → 2.0.0
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/lib/0SAVED-CVCard.d.ts +5 -0
- package/lib/0SAVED-CVCard.d.ts.map +1 -0
- package/lib/0SAVED-CVCard.js +90 -0
- package/lib/CVCard.d.ts +3 -1
- package/lib/CVCard.d.ts.map +1 -1
- package/lib/CVCard.js +88 -107
- package/lib/CVPresenter.js +92 -79
- package/lib/ChatWithMe.d.ts.map +1 -1
- package/lib/ChatWithMe.js +39 -82
- package/lib/FriendList.d.ts +2 -1
- package/lib/FriendList.d.ts.map +1 -1
- package/lib/FriendList.js +44 -38
- package/lib/ProfileCard.d.ts +2 -3
- package/lib/ProfileCard.d.ts.map +1 -1
- package/lib/ProfileCard.js +41 -41
- package/lib/ProfileView.d.ts.map +1 -1
- package/lib/ProfileView.js +65 -138
- package/lib/QRCodeCard.d.ts +2 -1
- package/lib/QRCodeCard.d.ts.map +1 -1
- package/lib/QRCodeCard.js +58 -46
- package/lib/SocialCard.d.ts +2 -1
- package/lib/SocialCard.d.ts.map +1 -1
- package/lib/SocialCard.js +64 -49
- package/lib/SocialPresenter.js +78 -70
- package/lib/StuffCard.d.ts.map +1 -1
- package/lib/StuffCard.js +54 -34
- package/lib/StuffPresenter.d.ts.map +1 -1
- package/lib/StuffPresenter.js +50 -28
- package/lib/addMeToYourFriends.d.ts +2 -1
- package/lib/addMeToYourFriends.d.ts.map +1 -1
- package/lib/addMeToYourFriends.js +90 -95
- package/lib/{buttonsHelper.d.ts → addMeToYourFriendsHelper.d.ts} +2 -4
- package/lib/addMeToYourFriendsHelper.d.ts.map +1 -0
- package/lib/addMeToYourFriendsHelper.js +26 -0
- package/lib/baseStyles.d.ts +71 -0
- package/lib/baseStyles.d.ts.map +1 -0
- package/lib/baseStyles.js +92 -0
- package/lib/editProfilePane/editProfile.view.js +123 -116
- package/lib/editProfilePane/profile.dom.js +32 -28
- package/lib/index.js +64 -61
- package/lib/presenter.js +57 -52
- package/lib/texts.d.ts +3 -5
- package/lib/texts.d.ts.map +1 -1
- package/lib/texts.js +17 -13
- package/package.json +10 -17
- package/lib/CVCard.js.map +0 -1
- package/lib/CVPresenter.js.map +0 -1
- package/lib/ChatWithMe.js.map +0 -1
- package/lib/FriendList.js.map +0 -1
- package/lib/ProfileCard.js.map +0 -1
- package/lib/ProfileView.js.map +0 -1
- package/lib/QRCodeCard.js.map +0 -1
- package/lib/SocialCard.js.map +0 -1
- package/lib/SocialPresenter.js.map +0 -1
- package/lib/StuffCard.js.map +0 -1
- package/lib/StuffPresenter.js.map +0 -1
- package/lib/addMeToYourFriends.js.map +0 -1
- package/lib/buttonsHelper.d.ts.map +0 -1
- package/lib/buttonsHelper.js +0 -38
- package/lib/buttonsHelper.js.map +0 -1
- package/lib/editProfilePane/editProfile.view.js.map +0 -1
- package/lib/editProfilePane/profile.dom.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/presenter.js.map +0 -1
- package/lib/profile-pane.js +0 -5163
- package/lib/profile-pane.js.map +0 -1
- package/lib/profile-pane.min.js +0 -299
- package/lib/profile-pane.min.js.map +0 -1
- package/lib/texts.js.map +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { TemplateResult } from 'lit-html';
|
|
2
|
+
import { ProfilePresentation } from './presenter';
|
|
3
|
+
import { CVPresentation } from './CVPresenter';
|
|
4
|
+
export declare const CVCard: (profileBasics: ProfilePresentation, cvData: CVPresentation) => TemplateResult;
|
|
5
|
+
//# sourceMappingURL=0SAVED-CVCard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"0SAVED-CVCard.d.ts","sourceRoot":"","sources":["../src/0SAVED-CVCard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,cAAc,EAAE,MAAM,UAAU,CAAA;AAS/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAW9C,eAAO,MAAM,MAAM,GACjB,eAAe,mBAAmB,EAClC,QAAQ,cAAc,KACrB,cA6BF,CAAA"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CVCard = void 0;
|
|
7
|
+
var _litHtml = require("lit-html");
|
|
8
|
+
var _baseStyles = require("./baseStyles");
|
|
9
|
+
var _styleMap = require("lit-html/directives/style-map.js");
|
|
10
|
+
const styles = {
|
|
11
|
+
image: (0, _styleMap.styleMap)((0, _baseStyles.fullWidth)()),
|
|
12
|
+
intro: (0, _styleMap.styleMap)({
|
|
13
|
+
...(0, _baseStyles.textGray)(),
|
|
14
|
+
...(0, _baseStyles.textCenter)()
|
|
15
|
+
}),
|
|
16
|
+
card: (0, _styleMap.styleMap)((0, _baseStyles.card)()),
|
|
17
|
+
info: (0, _styleMap.styleMap)({
|
|
18
|
+
...(0, _baseStyles.paddingSmall)(),
|
|
19
|
+
...(0, _baseStyles.textLeft)()
|
|
20
|
+
})
|
|
21
|
+
};
|
|
22
|
+
const CVCard = (profileBasics, cvData) => {
|
|
23
|
+
const {
|
|
24
|
+
rolesByType,
|
|
25
|
+
skills,
|
|
26
|
+
languages
|
|
27
|
+
} = cvData;
|
|
28
|
+
const nameStyle = (0, _styleMap.styleMap)({
|
|
29
|
+
...(0, _baseStyles.heading)(),
|
|
30
|
+
// "text-decoration": "underline",
|
|
31
|
+
color: profileBasics.highlightColor // was "text-decoration-color"
|
|
32
|
+
});
|
|
33
|
+
if (renderRoles(rolesByType['FutureRole']) || renderRoles(rolesByType['CurrentRole']) || renderRoles(rolesByType['PastRole']) || renderSkills(skills) || renderLanguages(languages)) {
|
|
34
|
+
return (0, _litHtml.html)`
|
|
35
|
+
<div data-testid="curriculum-vitae" style="${styles.card}">
|
|
36
|
+
<div style=${styles.info}>
|
|
37
|
+
<h3 style=${nameStyle}>Bio</h3>
|
|
38
|
+
<div style=${styles.info}>${renderRoles(rolesByType['FutureRole'])}</div>
|
|
39
|
+
<hr />
|
|
40
|
+
<div style=${styles.info}>${renderRoles(rolesByType['CurrentRole'])}</div>
|
|
41
|
+
<hr />
|
|
42
|
+
<div style=${styles.info}>${renderRoles(rolesByType['PastRole'])}</div>
|
|
43
|
+
<hr />
|
|
44
|
+
<h3 style=${nameStyle}>Skills</h3>
|
|
45
|
+
<div style=${styles.info}>${renderSkills(skills)}</div>
|
|
46
|
+
<h3 style=${nameStyle}>Languages</h3>
|
|
47
|
+
<div style=${styles.info}>${renderLanguages(languages)}</div>
|
|
48
|
+
</div>
|
|
49
|
+
</div>
|
|
50
|
+
`;
|
|
51
|
+
}
|
|
52
|
+
return (0, _litHtml.html)``;
|
|
53
|
+
};
|
|
54
|
+
exports.CVCard = CVCard;
|
|
55
|
+
function renderRole(role) {
|
|
56
|
+
return role ? (0, _litHtml.html)`<div style="margin-top: 0.3em; margin-bottom: 0.3em;">
|
|
57
|
+
<b>${role.orgName}</b>
|
|
58
|
+
<span>${strToUpperCase(role.roleText)}</span>
|
|
59
|
+
<span>${role.dates}</span>
|
|
60
|
+
</div> ` : (0, _litHtml.html)``;
|
|
61
|
+
}
|
|
62
|
+
function renderRoles(roles) {
|
|
63
|
+
if (roles[0] > '') return (0, _litHtml.html)`${renderRole(roles[0])}${roles.length > 1 ? renderRoles(roles.slice(1)) : (0, _litHtml.html)``}`;
|
|
64
|
+
}
|
|
65
|
+
function renderSkill(skill) {
|
|
66
|
+
return skill ? (0, _litHtml.html)`<div style="margin: 0.5em;">
|
|
67
|
+
<p style="text-align: center;">${skill}</p>
|
|
68
|
+
</div> ` : (0, _litHtml.html)``;
|
|
69
|
+
}
|
|
70
|
+
function renderSkills(skills) {
|
|
71
|
+
if (skills[0] > '') return (0, _litHtml.html)`${renderSkill(strToUpperCase(skills[0]))} ${skills.length > 1 ? renderSkills(skills.slice(1)) : (0, _litHtml.html)``}`;
|
|
72
|
+
}
|
|
73
|
+
function renderLan(language) {
|
|
74
|
+
return language ? (0, _litHtml.html)`<div style="margin: 0.5em;">
|
|
75
|
+
<p style="text-align: center;">${language}</p>
|
|
76
|
+
</div> ` : (0, _litHtml.html)``;
|
|
77
|
+
}
|
|
78
|
+
function renderLanguages(languages) {
|
|
79
|
+
if (languages[0] > '') return (0, _litHtml.html)`${renderLan(languages[0])}${languages.length > 1 ? renderLanguages(languages.slice(1)) : (0, _litHtml.html)``}`;
|
|
80
|
+
}
|
|
81
|
+
function strToUpperCase(str) {
|
|
82
|
+
if (str && str[0] > '') {
|
|
83
|
+
const strCase = str.split(' ');
|
|
84
|
+
for (let i = 0; i < strCase.length; i++) {
|
|
85
|
+
strCase[i] = strCase[i].charAt(0).toUpperCase() + strCase[i].substring(1);
|
|
86
|
+
}
|
|
87
|
+
return strCase.join(' ');
|
|
88
|
+
}
|
|
89
|
+
return '';
|
|
90
|
+
}
|
package/lib/CVCard.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { TemplateResult } from 'lit-html';
|
|
2
|
+
import { ProfilePresentation } from './presenter';
|
|
1
3
|
import { CVPresentation } from './CVPresenter';
|
|
2
|
-
export declare const CVCard: (cvData: CVPresentation) =>
|
|
4
|
+
export declare const CVCard: (profileBasics: ProfilePresentation, cvData: CVPresentation) => TemplateResult;
|
|
3
5
|
//# sourceMappingURL=CVCard.d.ts.map
|
package/lib/CVCard.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CVCard.d.ts","sourceRoot":"","sources":["../src/CVCard.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CVCard.d.ts","sourceRoot":"","sources":["../src/CVCard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,cAAc,EAAE,MAAM,UAAU,CAAA;AAS/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAa9C,eAAO,MAAM,MAAM,GACjB,eAAe,mBAAmB,EAClC,QAAQ,cAAc,KACrB,cAgCF,CAAA"}
|
package/lib/CVCard.js
CHANGED
|
@@ -1,118 +1,99 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
</
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
<
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
</
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
<h3 id="cv-languages-heading">Languages</h3>
|
|
58
|
-
<ul role="list" aria-label="Known languages">
|
|
59
|
-
${renderLanguages(languagesArr, true)}
|
|
60
|
-
</ul>
|
|
61
|
-
</section>
|
|
62
|
-
` : ''}
|
|
63
|
-
</article>
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CVCard = void 0;
|
|
7
|
+
var _litHtml = require("lit-html");
|
|
8
|
+
var _baseStyles = require("./baseStyles");
|
|
9
|
+
var _styleMap = require("lit-html/directives/style-map.js");
|
|
10
|
+
const styles = {
|
|
11
|
+
image: (0, _styleMap.styleMap)((0, _baseStyles.fullWidth)()),
|
|
12
|
+
intro: (0, _styleMap.styleMap)({
|
|
13
|
+
...(0, _baseStyles.textGray)(),
|
|
14
|
+
...(0, _baseStyles.textCenter)()
|
|
15
|
+
}),
|
|
16
|
+
card: (0, _styleMap.styleMap)((0, _baseStyles.card)()),
|
|
17
|
+
info: (0, _styleMap.styleMap)({
|
|
18
|
+
...(0, _baseStyles.paddingSmall)(),
|
|
19
|
+
...(0, _baseStyles.textLeft)()
|
|
20
|
+
}),
|
|
21
|
+
tools: (0, _styleMap.styleMap)({
|
|
22
|
+
...(0, _baseStyles.paddingSmall)(),
|
|
23
|
+
...(0, _baseStyles.textRight)()
|
|
24
|
+
})
|
|
25
|
+
};
|
|
26
|
+
const CVCard = (profileBasics, cvData) => {
|
|
27
|
+
const {
|
|
28
|
+
rolesByType,
|
|
29
|
+
skills,
|
|
30
|
+
languages
|
|
31
|
+
} = cvData;
|
|
32
|
+
const nameStyle = (0, _styleMap.styleMap)({
|
|
33
|
+
...(0, _baseStyles.heading)(),
|
|
34
|
+
// "text-decoration": "underline",
|
|
35
|
+
color: profileBasics.highlightColor // was "text-decoration-color"
|
|
36
|
+
});
|
|
37
|
+
if (renderRoles(rolesByType['FutureRole']) || renderRoles(rolesByType['CurrentRole']) || renderRoles(rolesByType['PastRole']) || renderSkills(skills) || renderLanguages(languages)) {
|
|
38
|
+
return (0, _litHtml.html)`
|
|
39
|
+
<div>
|
|
40
|
+
<div data-testid="curriculum-vitae" style="${styles.card}">
|
|
41
|
+
<div style=${styles.info}>
|
|
42
|
+
<h3 style=${nameStyle}>Bio</h3>
|
|
43
|
+
<div style=${styles.info}>${renderRoles(rolesByType['FutureRole'])}</div>
|
|
44
|
+
<hr />
|
|
45
|
+
<div style=${styles.info}>${renderRoles(rolesByType['CurrentRole'])}</div>
|
|
46
|
+
<hr />
|
|
47
|
+
<div style=${styles.info}>${renderRoles(rolesByType['PastRole'])}</div>
|
|
48
|
+
<hr />
|
|
49
|
+
<h3 style=${nameStyle}>Skills</h3>
|
|
50
|
+
<div style=${styles.info}>${renderSkills(skills)}</div>
|
|
51
|
+
<h3 style=${nameStyle}>Languages</h3>
|
|
52
|
+
<div style=${styles.info}>${renderLanguages(languages)}</div>
|
|
53
|
+
|
|
54
|
+
</div>
|
|
55
|
+
</div>
|
|
56
|
+
</div>
|
|
64
57
|
`;
|
|
58
|
+
}
|
|
59
|
+
return (0, _litHtml.html)``;
|
|
65
60
|
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
<span aria-label="Role title">${strToUpperCase(role.roleText)}</span>
|
|
74
|
-
<time aria-label="Employment period">${role.dates}</time>
|
|
75
|
-
</li>`
|
|
76
|
-
: html ``;
|
|
61
|
+
exports.CVCard = CVCard;
|
|
62
|
+
function renderRole(role) {
|
|
63
|
+
return role ? (0, _litHtml.html)`<div style="margin-top: 0.3em; margin-bottom: 0.3em;">
|
|
64
|
+
<b>${role.orgName}</b>
|
|
65
|
+
<span>${strToUpperCase(role.roleText)}</span>
|
|
66
|
+
<span>${role.dates}</span>
|
|
67
|
+
</div> ` : (0, _litHtml.html)``;
|
|
77
68
|
}
|
|
78
|
-
function renderRoles(roles
|
|
79
|
-
|
|
80
|
-
return html ``;
|
|
81
|
-
return html `${renderRole(roles[0], asList)}${roles.length > 1 ? renderRoles(roles.slice(1), asList) : html ``}`;
|
|
69
|
+
function renderRoles(roles) {
|
|
70
|
+
if (roles[0] > '') return (0, _litHtml.html)`${renderRole(roles[0])}${roles.length > 1 ? renderRoles(roles.slice(1)) : (0, _litHtml.html)``}`;
|
|
82
71
|
}
|
|
83
|
-
function renderSkill(skill
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
? html `<li class="${styles.cvSkill}">${strToUpperCase(skill)}</li>`
|
|
88
|
-
: html ``;
|
|
72
|
+
function renderSkill(skill) {
|
|
73
|
+
return skill ? (0, _litHtml.html)`<div style="margin: 0.5em;">
|
|
74
|
+
<p style="text-align: center;">${skill}</p>
|
|
75
|
+
</div> ` : (0, _litHtml.html)``;
|
|
89
76
|
}
|
|
90
|
-
function renderSkills(skills
|
|
91
|
-
|
|
92
|
-
return html ``;
|
|
93
|
-
return html `${renderSkill(skills[0], asList)}${skills.length > 1 ? renderSkills(skills.slice(1), asList) : html ``}`;
|
|
77
|
+
function renderSkills(skills) {
|
|
78
|
+
if (skills[0] > '') return (0, _litHtml.html)`${renderSkill(strToUpperCase(skills[0]))} ${skills.length > 1 ? renderSkills(skills.slice(1)) : (0, _litHtml.html)``}`;
|
|
94
79
|
}
|
|
95
|
-
function renderLan(language
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
? html `<li class="${styles.cvLanguage}">${language}</li>`
|
|
100
|
-
: html ``;
|
|
80
|
+
function renderLan(language) {
|
|
81
|
+
return language ? (0, _litHtml.html)`<div style="margin: 0.5em;">
|
|
82
|
+
<p style="text-align: center;">${language}</p>
|
|
83
|
+
</div> ` : (0, _litHtml.html)``;
|
|
101
84
|
}
|
|
102
|
-
function renderLanguages(languages
|
|
103
|
-
|
|
104
|
-
return html ``;
|
|
105
|
-
return html `${renderLan(languages[0], asList)}${languages.length > 1 ? renderLanguages(languages.slice(1), asList) : html ``}`;
|
|
85
|
+
function renderLanguages(languages) {
|
|
86
|
+
if (languages[0] > '') return (0, _litHtml.html)`${renderLan(languages[0])}${languages.length > 1 ? renderLanguages(languages.slice(1)) : (0, _litHtml.html)``}`;
|
|
106
87
|
}
|
|
107
88
|
function strToUpperCase(str) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
strCase[i].substring(1);
|
|
113
|
-
}
|
|
114
|
-
return strCase.join(' ');
|
|
89
|
+
if (str && str[0] > '') {
|
|
90
|
+
const strCase = str.split(' ');
|
|
91
|
+
for (let i = 0; i < strCase.length; i++) {
|
|
92
|
+
strCase[i] = strCase[i].charAt(0).toUpperCase() + strCase[i].substring(1);
|
|
115
93
|
}
|
|
116
|
-
return '';
|
|
94
|
+
return strCase.join(' ');
|
|
95
|
+
}
|
|
96
|
+
return '';
|
|
117
97
|
}
|
|
118
|
-
|
|
98
|
+
|
|
99
|
+
// ends
|
package/lib/CVPresenter.js
CHANGED
|
@@ -1,87 +1,100 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.datesAsText = datesAsText;
|
|
7
|
+
exports.languageAsText = languageAsText;
|
|
8
|
+
exports.presentCV = presentCV;
|
|
9
|
+
exports.skillAsText = skillAsText;
|
|
10
|
+
exports.typesOfRole = void 0;
|
|
11
|
+
var _rdflib = require("rdflib");
|
|
12
|
+
var _solidUi = require("solid-ui");
|
|
13
|
+
const ORG = (0, _rdflib.Namespace)('http://www.w3.org/ns/org#');
|
|
14
|
+
const typesOfRole = exports.typesOfRole = ['PastRole', 'CurrentRole', 'FutureRole'];
|
|
15
|
+
function skillAsText(store, sk) {
|
|
16
|
+
if (sk.termType === 'Literal') return sk.value; // Not normal but allow this
|
|
17
|
+
const publicId = store.anyJS(sk, _solidUi.ns.solid('publicId'));
|
|
18
|
+
if (publicId) {
|
|
19
|
+
const name = store.anyJS(publicId, _solidUi.ns.schema('name'));
|
|
20
|
+
if (name) return name; // @@ check language and get name in diff language if necessary
|
|
21
|
+
}
|
|
22
|
+
const manual = store.anyJS(sk, _solidUi.ns.vcard('role'));
|
|
23
|
+
if (manual && manual[0] > '') return manual;
|
|
24
|
+
return '¿¿¿ skill ???';
|
|
18
25
|
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return utils.label(publicId, true); // @@ check language and get name in diff language if necessary
|
|
25
|
-
return '-';
|
|
26
|
+
function languageAsText(store, lan) {
|
|
27
|
+
if (lan.termType === 'Literal') return lan.value; // Not normal but allow this
|
|
28
|
+
const publicId = store.anyJS(lan, _solidUi.ns.solid('publicId'));
|
|
29
|
+
if (publicId) return _solidUi.utils.label(publicId, true); // @@ check language and get name in diff language if necessary
|
|
30
|
+
return '-';
|
|
26
31
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
(endDate ? endDate.value.slice(0, 10) : '') + ')'
|
|
30
|
-
: '';
|
|
32
|
+
function datesAsText(startDate, endDate) {
|
|
33
|
+
return startDate ? '(' + startDate.value.slice(0, 10) + ' to ' + (endDate ? endDate.value.slice(0, 10) : '') + ')' : '';
|
|
31
34
|
}
|
|
32
35
|
function getRolesByType(store, subject) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
const orgName = publicIdName || orgNameGiven;
|
|
51
|
-
const escoRole = store.any(membership, ORG('role'));
|
|
52
|
-
if (escoRole) {
|
|
53
|
-
roleName = store.anyJS(escoRole, ns.schema('name'));
|
|
54
|
-
}
|
|
55
|
-
const roleText0 = store.anyJS(membership, ns.vcard('role'));
|
|
56
|
-
const roleText = (roleText0 && roleName) ? roleName + ' - ' + roleText0
|
|
57
|
-
: roleText0 || roleName;
|
|
58
|
-
const item = {
|
|
59
|
-
startDate: startDate, endDate, orgName, roleText, dates, orgHomePage
|
|
60
|
-
};
|
|
61
|
-
for (const t of typesOfRole) {
|
|
62
|
-
if (store.holds(membership, ns.rdf('type'), ns.solid(t))) {
|
|
63
|
-
rolesByType[t].push(item);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
36
|
+
const memberships = store.each(null, ORG('member'), subject, null);
|
|
37
|
+
const rolesByType = {
|
|
38
|
+
PastRole: [],
|
|
39
|
+
CurrentRole: [],
|
|
40
|
+
FutureRole: []
|
|
41
|
+
};
|
|
42
|
+
for (const membership of memberships) {
|
|
43
|
+
let orgHomePage, orgNameGiven, publicIdName, roleName, publicId;
|
|
44
|
+
// Things should have start dates but we will be very lenient in this view
|
|
45
|
+
const startDate = store.any(membership, _solidUi.ns.schema('startDate'));
|
|
46
|
+
const endDate = store.any(membership, _solidUi.ns.schema('endDate'));
|
|
47
|
+
const dates = datesAsText(startDate, endDate);
|
|
48
|
+
const organization = store.any(membership, ORG('organization'));
|
|
49
|
+
if (organization) {
|
|
50
|
+
orgNameGiven = store.anyJS(organization, _solidUi.ns.schema('name'));
|
|
51
|
+
orgHomePage = store.any(organization, _solidUi.ns.schema('uri'));
|
|
52
|
+
publicId = store.any(organization, _solidUi.ns.solid('publicId'));
|
|
66
53
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
71
|
-
|
|
54
|
+
if (publicId) {
|
|
55
|
+
publicIdName = store.anyJS(publicId, _solidUi.ns.schema('name'));
|
|
56
|
+
}
|
|
57
|
+
const orgName = publicIdName || orgNameGiven;
|
|
58
|
+
const escoRole = store.any(membership, ORG('role'));
|
|
59
|
+
if (escoRole) {
|
|
60
|
+
roleName = store.anyJS(escoRole, _solidUi.ns.schema('name'));
|
|
61
|
+
}
|
|
62
|
+
const roleText0 = store.anyJS(membership, _solidUi.ns.vcard('role'));
|
|
63
|
+
const roleText = roleText0 && roleName ? roleName + ' - ' + roleText0 : roleText0 || roleName;
|
|
64
|
+
const item = {
|
|
65
|
+
startDate: startDate,
|
|
66
|
+
endDate,
|
|
67
|
+
orgName,
|
|
68
|
+
roleText,
|
|
69
|
+
dates,
|
|
70
|
+
orgHomePage
|
|
71
|
+
};
|
|
72
72
|
for (const t of typesOfRole) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
return x.startDate > y.startDate ? -1 : 1;
|
|
78
|
-
});
|
|
73
|
+
if (store.holds(membership, _solidUi.ns.rdf('type'), _solidUi.ns.solid(t))) {
|
|
74
|
+
rolesByType[t].push(item);
|
|
75
|
+
}
|
|
79
76
|
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
let languages = [];
|
|
83
|
-
if (languagesInStore)
|
|
84
|
-
languages = languagesInStore.map(lan => languageAsText(store, lan));
|
|
85
|
-
return { rolesByType, skills, languages };
|
|
77
|
+
}
|
|
78
|
+
return rolesByType;
|
|
86
79
|
}
|
|
87
|
-
|
|
80
|
+
function presentCV(subject, store) {
|
|
81
|
+
const rolesByType = getRolesByType(store, subject);
|
|
82
|
+
// Most recent thing most relevant -> sort by end date
|
|
83
|
+
for (const t of typesOfRole) {
|
|
84
|
+
rolesByType[t].sort(function (x, y) {
|
|
85
|
+
if (x.endDate && y.endDate) {
|
|
86
|
+
return x.endDate > y.endDate ? -1 : 1;
|
|
87
|
+
}
|
|
88
|
+
return x.startDate > y.startDate ? -1 : 1;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
const skills = store.each(subject, _solidUi.ns.schema('skills')).map(sk => skillAsText(store, sk));
|
|
92
|
+
const languagesInStore = store.anyJS(subject, _solidUi.ns.schema('knowsLanguage'));
|
|
93
|
+
let languages = [];
|
|
94
|
+
if (languagesInStore) languages = languagesInStore.map(lan => languageAsText(store, lan));
|
|
95
|
+
return {
|
|
96
|
+
rolesByType,
|
|
97
|
+
skills,
|
|
98
|
+
languages
|
|
99
|
+
};
|
|
100
|
+
}
|
package/lib/ChatWithMe.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChatWithMe.d.ts","sourceRoot":"","sources":["../src/ChatWithMe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,cAAc,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"ChatWithMe.d.ts","sourceRoot":"","sources":["../src/ChatWithMe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,cAAc,EAAE,MAAM,UAAU,CAAA;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAClD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAA;AAKlC,eAAO,MAAM,UAAU,GACrB,SAAS,SAAS,EAClB,SAAS,kBAAkB,KAC1B,cAwCF,CAAA"}
|
package/lib/ChatWithMe.js
CHANGED
|
@@ -1,86 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ChatWithMe = void 0;
|
|
7
|
+
var _litHtml = require("lit-html");
|
|
8
|
+
var _solidUi = require("solid-ui");
|
|
9
|
+
var _asyncReplace = require("lit-html/directives/async-replace.js");
|
|
10
|
+
var _texts = require("./texts");
|
|
11
|
+
const ChatWithMe = (subject, context) => {
|
|
12
|
+
const logic = context.session.logic;
|
|
13
|
+
const longChatPane = context.session.paneRegistry.byName('long chat');
|
|
14
|
+
async function* chatContainer() {
|
|
15
|
+
const chatContainer = context.dom.createElement('div');
|
|
16
|
+
let exists;
|
|
17
|
+
try {
|
|
18
|
+
yield _texts.loadingMessage, exists = await logic.chat.getChat(subject, false);
|
|
19
|
+
} catch (e) {
|
|
20
|
+
exists = false;
|
|
21
|
+
}
|
|
22
|
+
if (exists) {
|
|
23
|
+
chatContainer.appendChild(longChatPane.render(exists, context, {}));
|
|
24
|
+
yield chatContainer;
|
|
25
|
+
} else {
|
|
26
|
+
const button = _solidUi.widgets.button(context.dom, undefined, _texts.chatWithMeButtonText, async () => {
|
|
24
27
|
try {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
exists = await logic.chat.getChat(subject, false);
|
|
31
|
-
}
|
|
32
|
-
catch (e) {
|
|
33
|
-
exists = false;
|
|
34
|
-
}
|
|
35
|
-
if (exists) {
|
|
36
|
-
const chatArea = context.dom.createElement('div');
|
|
37
|
-
chatArea.setAttribute('role', 'log');
|
|
38
|
-
chatArea.setAttribute('aria-label', 'Chat conversation');
|
|
39
|
-
chatArea.appendChild(longChatPane.render(exists, context, {}));
|
|
40
|
-
chatContainer.appendChild(chatArea);
|
|
41
|
-
yield chatContainer;
|
|
42
|
-
}
|
|
43
|
-
else {
|
|
44
|
-
const me = authn.currentUser();
|
|
45
|
-
let label = checkIfAnyUserLoggedIn(me) ? chatWithMeButtonText.toUpperCase() : logInToChatWithMeButtonText.toUpperCase();
|
|
46
|
-
const button = widgets.button(context.dom, undefined, label, setButtonHandler, { needsBorder: true });
|
|
47
|
-
async function setButtonHandler(event) {
|
|
48
|
-
event.preventDefault();
|
|
49
|
-
try {
|
|
50
|
-
const chat = await logic.chat.getChat(subject, true);
|
|
51
|
-
chatContainer.innerHTML = '';
|
|
52
|
-
chatContainer.appendChild(longChatPane.render(chat, context, {}));
|
|
53
|
-
}
|
|
54
|
-
catch (error) {
|
|
55
|
-
complain(chatContainer, context, error);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
button.refresh = refreshButton();
|
|
59
|
-
function refreshButton() {
|
|
60
|
-
const me = authn.currentUser();
|
|
61
|
-
if (checkIfAnyUserLoggedIn(me)) {
|
|
62
|
-
button.innerHTML = chatWithMeButtonText.toUpperCase();
|
|
63
|
-
button.className = 'button';
|
|
64
|
-
button.setAttribute('class', style.primaryButton);
|
|
65
|
-
}
|
|
66
|
-
else {
|
|
67
|
-
//not logged in
|
|
68
|
-
button.innerHTML = logInToChatWithMeButtonText.toUpperCase();
|
|
69
|
-
button.className = 'button';
|
|
70
|
-
button.setAttribute('class', style.primaryButton);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
button.setAttribute('type', 'button');
|
|
74
|
-
button.setAttribute('aria-describedby', 'chat-button-description');
|
|
75
|
-
const description = context.dom.createElement('span');
|
|
76
|
-
description.id = 'chat-button-description';
|
|
77
|
-
description.className = 'sr-only';
|
|
78
|
-
description.textContent = 'Start a new conversation or sign in to continue existing chat';
|
|
79
|
-
chatContainer.appendChild(button);
|
|
80
|
-
chatContainer.appendChild(description);
|
|
81
|
-
yield chatContainer;
|
|
28
|
+
const chat = await logic.chat.getChat(subject, true);
|
|
29
|
+
chatContainer.innerHTML = '';
|
|
30
|
+
chatContainer.appendChild(longChatPane.render(chat, context, {}));
|
|
31
|
+
} catch (e) {
|
|
32
|
+
chatContainer.appendChild(_solidUi.widgets.errorMessageBlock(context.dom, e.message));
|
|
82
33
|
}
|
|
34
|
+
}, {
|
|
35
|
+
needsBorder: true
|
|
36
|
+
});
|
|
37
|
+
chatContainer.appendChild(button);
|
|
38
|
+
yield chatContainer;
|
|
83
39
|
}
|
|
84
|
-
|
|
40
|
+
}
|
|
41
|
+
return (0, _litHtml.html)` ${(0, _asyncReplace.asyncReplace)(chatContainer())} `;
|
|
85
42
|
};
|
|
86
|
-
|
|
43
|
+
exports.ChatWithMe = ChatWithMe;
|