profile-pane 1.2.1-5ceca1ce → 1.2.1-5f322a8d

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.
Files changed (64) hide show
  1. package/README.md +1 -21
  2. package/lib/0SAVED-CVCard.d.ts +4 -0
  3. package/lib/0SAVED-CVCard.js +52 -45
  4. package/lib/CVCard.d.ts +4 -0
  5. package/lib/CVCard.js +57 -46
  6. package/lib/CVPresenter.d.ts +24 -0
  7. package/lib/CVPresenter.js +92 -79
  8. package/lib/ChatWithMe.d.ts +4 -0
  9. package/lib/ChatWithMe.js +42 -61
  10. package/lib/FriendList.d.ts +5 -0
  11. package/lib/FriendList.js +36 -30
  12. package/lib/ProfileCard.d.ts +3 -0
  13. package/lib/ProfileCard.js +32 -12
  14. package/lib/ProfileView.d.ts +4 -0
  15. package/lib/ProfileView.js +58 -49
  16. package/lib/QRCodeCard.d.ts +4 -0
  17. package/lib/QRCodeCard.js +48 -28
  18. package/lib/SocialCard.d.ts +4 -0
  19. package/lib/SocialCard.js +42 -26
  20. package/lib/SocialPresenter.d.ts +11 -0
  21. package/lib/SocialPresenter.js +79 -70
  22. package/lib/StuffCard.d.ts +5 -0
  23. package/lib/StuffCard.js +41 -28
  24. package/lib/StuffPresenter.d.ts +13 -0
  25. package/lib/StuffPresenter.js +50 -39
  26. package/lib/addMeToYourFriends.d.ts +10 -0
  27. package/lib/addMeToYourFriends.js +88 -102
  28. package/lib/addMeToYourFriendsHelper.d.ts +5 -0
  29. package/lib/addMeToYourFriendsHelper.js +20 -13
  30. package/lib/baseStyles.d.ts +70 -0
  31. package/lib/baseStyles.js +78 -41
  32. package/lib/editProfilePane/editProfile.view.d.ts +12 -0
  33. package/lib/editProfilePane/editProfile.view.js +123 -116
  34. package/lib/editProfilePane/profile.dom.d.ts +3 -0
  35. package/lib/editProfilePane/profile.dom.js +32 -13
  36. package/lib/index.d.ts +11 -0
  37. package/lib/index.js +66 -74
  38. package/lib/presenter.d.ts +13 -0
  39. package/lib/presenter.js +57 -52
  40. package/lib/texts.d.ts +9 -0
  41. package/lib/texts.js +17 -10
  42. package/package.json +20 -10
  43. package/lib/0SAVED-CVCard.js.map +0 -1
  44. package/lib/CVCard.js.map +0 -1
  45. package/lib/CVPresenter.js.map +0 -1
  46. package/lib/ChatWithMe.js.map +0 -1
  47. package/lib/FriendList.js.map +0 -1
  48. package/lib/ProfileCard.js.map +0 -1
  49. package/lib/ProfileView.js.map +0 -1
  50. package/lib/QRCodeCard.js.map +0 -1
  51. package/lib/SocialCard.js.map +0 -1
  52. package/lib/SocialPresenter.js.map +0 -1
  53. package/lib/StuffCard.js.map +0 -1
  54. package/lib/StuffPresenter.js.map +0 -1
  55. package/lib/addMeToYourFriends.js.map +0 -1
  56. package/lib/addMeToYourFriendsHelper.js.map +0 -1
  57. package/lib/baseStyles.js.map +0 -1
  58. package/lib/editProfilePane/editProfile.view.js.map +0 -1
  59. package/lib/editProfilePane/profile.dom.js.map +0 -1
  60. package/lib/editProfilePane/wrapped-profileFormText.js +0 -752
  61. package/lib/editProfilePane/wrapped-profileFormText.js.map +0 -1
  62. package/lib/index.js.map +0 -1
  63. package/lib/presenter.js.map +0 -1
  64. package/lib/texts.js.map +0 -1
package/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # profile-pane
2
2
  SolidOS pane that displays a personal profile page
3
3
 
4
- This is a re-write that is going to replace the current profile pane
5
-
6
4
  ![CI](https://github.com/solid/profile-pane/workflows/CI/badge.svg)
7
5
 
8
6
  ## Contribute
@@ -29,10 +27,6 @@ If this is the case, simply run "npm audit fix" and upgrade the repository. It s
29
27
 
30
28
  Unit tests use `jest` and are placed next to the tested file as `*.spec.ts` files.
31
29
 
32
- #### Integration tests
33
-
34
- Integration tests verify the rendering of the whole pane (with mocked HTTP requests) and are placed under `./src/integration-tests`.
35
-
36
30
  ### Dev Server
37
31
 
38
32
  Start a webpack dev server:
@@ -41,8 +35,7 @@ Start a webpack dev server:
41
35
  npm start
42
36
  ```
43
37
 
44
- Visit `http://localhost:8080/` to render the pane. Adjust `const webIdToShow` in `./dev/index.ts` to show a
45
- different profile.
38
+ Visit `http://localhost:8080/` to render the pane. Adjust `const webIdToShow` in `./dev/index.ts` to show a different profile.
46
39
 
47
40
  ### Build
48
41
 
@@ -52,16 +45,3 @@ npm run build
52
45
 
53
46
  The build is done by `tsc`, webpack is only used as dev server and not for production build.
54
47
 
55
- ### Check before committing
56
-
57
- ```
58
- npm run check
59
- ```
60
-
61
- This does lint, build and test.
62
-
63
- ### Notes
64
-
65
- If suddenly many tests fail, it may be that the installation has ended up with
66
- two different instances of solid-logic. Run `npm list solid-logic` and make sure there is only one.
67
- Otherwise `rm -rf node_modules package-lock.json && npm install` should fix it.
@@ -0,0 +1,4 @@
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;
@@ -1,20 +1,37 @@
1
- import { html } from 'lit-html';
2
- import { fullWidth, heading, paddingSmall, textCenter, textLeft, textGray, } from './baseStyles';
3
- import { styleMap } from 'lit-html/directives/style-map.js';
4
- import { card } from './baseStyles';
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");
5
10
  const styles = {
6
- image: styleMap(fullWidth()),
7
- intro: styleMap(Object.assign(Object.assign({}, textGray()), textCenter())),
8
- card: styleMap(card()),
9
- info: styleMap(Object.assign(Object.assign({}, paddingSmall()), textLeft())),
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
+ })
10
21
  };
11
- export const CVCard = (profileBasics, cvData) => {
12
- const { rolesByType, skills, languages } = cvData;
13
- const nameStyle = styleMap(Object.assign(Object.assign({}, heading()), {
14
- // "text-decoration": "underline",
15
- color: profileBasics.highlightColor }));
16
- if (renderRoles(rolesByType['FutureRole']) || renderRoles(rolesByType['CurrentRole']) || renderRoles(rolesByType['PastRole']) || renderSkills(skills) || renderLanguages(languages)) {
17
- return html `
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)`
18
35
  <div data-testid="curriculum-vitae" style="${styles.card}">
19
36
  <div style=${styles.info}>
20
37
  <h3 style=${nameStyle}>Bio</h3>
@@ -31,53 +48,43 @@ export const CVCard = (profileBasics, cvData) => {
31
48
  </div>
32
49
  </div>
33
50
  `;
34
- }
35
- return html ``;
51
+ }
52
+ return (0, _litHtml.html)``;
36
53
  };
54
+ exports.CVCard = CVCard;
37
55
  function renderRole(role) {
38
- return role
39
- ? html `<div style="margin-top: 0.3em; margin-bottom: 0.3em;">
56
+ return role ? (0, _litHtml.html)`<div style="margin-top: 0.3em; margin-bottom: 0.3em;">
40
57
  <b>${role.orgName}</b>
41
58
  <span>${strToUpperCase(role.roleText)}</span>
42
59
  <span>${role.dates}</span>
43
- </div> `
44
- : html ``;
60
+ </div> ` : (0, _litHtml.html)``;
45
61
  }
46
62
  function renderRoles(roles) {
47
- if (roles[0] > '')
48
- return html `${renderRole(roles[0])}${roles.length > 1 ? renderRoles(roles.slice(1)) : html ``}`;
63
+ if (roles[0] > '') return (0, _litHtml.html)`${renderRole(roles[0])}${roles.length > 1 ? renderRoles(roles.slice(1)) : (0, _litHtml.html)``}`;
49
64
  }
50
65
  function renderSkill(skill) {
51
- return skill
52
- ? html `<div style="margin: 0.5em;">
66
+ return skill ? (0, _litHtml.html)`<div style="margin: 0.5em;">
53
67
  <p style="text-align: center;">${skill}</p>
54
- </div> `
55
- : html ``;
68
+ </div> ` : (0, _litHtml.html)``;
56
69
  }
57
70
  function renderSkills(skills) {
58
- if (skills[0] > '')
59
- return html `${renderSkill(strToUpperCase(skills[0]))} ${skills.length > 1 ? renderSkills(skills.slice(1)) : html ``}`;
71
+ if (skills[0] > '') return (0, _litHtml.html)`${renderSkill(strToUpperCase(skills[0]))} ${skills.length > 1 ? renderSkills(skills.slice(1)) : (0, _litHtml.html)``}`;
60
72
  }
61
73
  function renderLan(language) {
62
- return language
63
- ? html `<div style="margin: 0.5em;">
74
+ return language ? (0, _litHtml.html)`<div style="margin: 0.5em;">
64
75
  <p style="text-align: center;">${language}</p>
65
- </div> `
66
- : html ``;
76
+ </div> ` : (0, _litHtml.html)``;
67
77
  }
68
78
  function renderLanguages(languages) {
69
- if (languages[0] > '')
70
- return html `${renderLan(languages[0])}${languages.length > 1 ? renderLanguages(languages.slice(1)) : html ``}`;
79
+ if (languages[0] > '') return (0, _litHtml.html)`${renderLan(languages[0])}${languages.length > 1 ? renderLanguages(languages.slice(1)) : (0, _litHtml.html)``}`;
71
80
  }
72
81
  function strToUpperCase(str) {
73
- if (str && str[0] > '') {
74
- const strCase = str.split(' ');
75
- for (let i = 0; i < strCase.length; i++) {
76
- strCase[i] = strCase[i].charAt(0).toUpperCase() +
77
- strCase[i].substring(1);
78
- }
79
- return strCase.join(' ');
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);
80
86
  }
81
- return '';
82
- }
83
- //# sourceMappingURL=0SAVED-CVCard.js.map
87
+ return strCase.join(' ');
88
+ }
89
+ return '';
90
+ }
@@ -0,0 +1,4 @@
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;
package/lib/CVCard.js CHANGED
@@ -1,21 +1,41 @@
1
- import { html } from 'lit-html';
2
- import { fullWidth, heading, paddingSmall, textCenter, textLeft, textRight, textGray, } from './baseStyles';
3
- import { styleMap } from 'lit-html/directives/style-map.js';
4
- import { card } from './baseStyles';
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");
5
10
  const styles = {
6
- image: styleMap(fullWidth()),
7
- intro: styleMap(Object.assign(Object.assign({}, textGray()), textCenter())),
8
- card: styleMap(card()),
9
- info: styleMap(Object.assign(Object.assign({}, paddingSmall()), textLeft())),
10
- tools: styleMap(Object.assign(Object.assign({}, paddingSmall()), textRight())),
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
+ })
11
25
  };
12
- export const CVCard = (profileBasics, cvData) => {
13
- const { rolesByType, skills, languages } = cvData;
14
- const nameStyle = styleMap(Object.assign(Object.assign({}, heading()), {
15
- // "text-decoration": "underline",
16
- color: profileBasics.highlightColor }));
17
- if (renderRoles(rolesByType['FutureRole']) || renderRoles(rolesByType['CurrentRole']) || renderRoles(rolesByType['PastRole']) || renderSkills(skills) || renderLanguages(languages)) {
18
- return html `
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)`
19
39
  <div>
20
40
  <div data-testid="curriculum-vitae" style="${styles.card}">
21
41
  <div style=${styles.info}>
@@ -35,54 +55,45 @@ export const CVCard = (profileBasics, cvData) => {
35
55
  </div>
36
56
  </div>
37
57
  `;
38
- }
39
- return html ``;
58
+ }
59
+ return (0, _litHtml.html)``;
40
60
  };
61
+ exports.CVCard = CVCard;
41
62
  function renderRole(role) {
42
- return role
43
- ? html `<div style="margin-top: 0.3em; margin-bottom: 0.3em;">
63
+ return role ? (0, _litHtml.html)`<div style="margin-top: 0.3em; margin-bottom: 0.3em;">
44
64
  <b>${role.orgName}</b>
45
65
  <span>${strToUpperCase(role.roleText)}</span>
46
66
  <span>${role.dates}</span>
47
- </div> `
48
- : html ``;
67
+ </div> ` : (0, _litHtml.html)``;
49
68
  }
50
69
  function renderRoles(roles) {
51
- if (roles[0] > '')
52
- return html `${renderRole(roles[0])}${roles.length > 1 ? renderRoles(roles.slice(1)) : html ``}`;
70
+ if (roles[0] > '') return (0, _litHtml.html)`${renderRole(roles[0])}${roles.length > 1 ? renderRoles(roles.slice(1)) : (0, _litHtml.html)``}`;
53
71
  }
54
72
  function renderSkill(skill) {
55
- return skill
56
- ? html `<div style="margin: 0.5em;">
73
+ return skill ? (0, _litHtml.html)`<div style="margin: 0.5em;">
57
74
  <p style="text-align: center;">${skill}</p>
58
- </div> `
59
- : html ``;
75
+ </div> ` : (0, _litHtml.html)``;
60
76
  }
61
77
  function renderSkills(skills) {
62
- if (skills[0] > '')
63
- return html `${renderSkill(strToUpperCase(skills[0]))} ${skills.length > 1 ? renderSkills(skills.slice(1)) : html ``}`;
78
+ if (skills[0] > '') return (0, _litHtml.html)`${renderSkill(strToUpperCase(skills[0]))} ${skills.length > 1 ? renderSkills(skills.slice(1)) : (0, _litHtml.html)``}`;
64
79
  }
65
80
  function renderLan(language) {
66
- return language
67
- ? html `<div style="margin: 0.5em;">
81
+ return language ? (0, _litHtml.html)`<div style="margin: 0.5em;">
68
82
  <p style="text-align: center;">${language}</p>
69
- </div> `
70
- : html ``;
83
+ </div> ` : (0, _litHtml.html)``;
71
84
  }
72
85
  function renderLanguages(languages) {
73
- if (languages[0] > '')
74
- return html `${renderLan(languages[0])}${languages.length > 1 ? renderLanguages(languages.slice(1)) : html ``}`;
86
+ if (languages[0] > '') return (0, _litHtml.html)`${renderLan(languages[0])}${languages.length > 1 ? renderLanguages(languages.slice(1)) : (0, _litHtml.html)``}`;
75
87
  }
76
88
  function strToUpperCase(str) {
77
- if (str && str[0] > '') {
78
- const strCase = str.split(' ');
79
- for (let i = 0; i < strCase.length; i++) {
80
- strCase[i] = strCase[i].charAt(0).toUpperCase() +
81
- strCase[i].substring(1);
82
- }
83
- 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);
84
93
  }
85
- return '';
94
+ return strCase.join(' ');
95
+ }
96
+ return '';
86
97
  }
87
- // ends
88
- //# sourceMappingURL=CVCard.js.map
98
+
99
+ // ends
@@ -0,0 +1,24 @@
1
+ import { LiveStore, NamedNode, Literal, Node, Store } from 'rdflib';
2
+ export interface Role {
3
+ startDate?: Literal;
4
+ endDate: Literal;
5
+ dates: string;
6
+ orgName: string;
7
+ roleText: string;
8
+ orgHomePage?: string;
9
+ }
10
+ export interface CVPresentation {
11
+ rolesByType: RolesByType;
12
+ skills: string[];
13
+ languages: string[];
14
+ }
15
+ export interface RolesByType {
16
+ PastRole: Role[];
17
+ CurrentRole: Role[];
18
+ FutureRole: Role[];
19
+ }
20
+ export declare const typesOfRole: string[];
21
+ export declare function skillAsText(store: Store, sk: Node): string;
22
+ export declare function languageAsText(store: Store, lan: Node): string;
23
+ export declare function datesAsText(startDate?: Literal, endDate?: Literal): string;
24
+ export declare function presentCV(subject: NamedNode, store: LiveStore): CVPresentation;
@@ -1,87 +1,100 @@
1
- import { Namespace } from 'rdflib';
2
- import { ns, utils } from 'solid-ui';
3
- const ORG = Namespace('http://www.w3.org/ns/org#');
4
- export const typesOfRole = ['PastRole', 'CurrentRole', 'FutureRole'];
5
- export function skillAsText(store, sk) {
6
- if (sk.termType === 'Literal')
7
- return sk.value; // Not normal but allow this
8
- const publicId = store.anyJS(sk, ns.solid('publicId'));
9
- if (publicId) {
10
- const name = store.anyJS(publicId, ns.schema('name'));
11
- if (name)
12
- return name; // @@ check language and get name in diff language if necessary
13
- }
14
- const manual = store.anyJS(sk, ns.vcard('role'));
15
- if (manual && manual[0] > '')
16
- return manual;
17
- return '¿¿¿ skill ???';
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
- export function languageAsText(store, lan) {
20
- if (lan.termType === 'Literal')
21
- return lan.value; // Not normal but allow this
22
- const publicId = store.anyJS(lan, ns.solid('publicId'));
23
- if (publicId)
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
- export function datesAsText(startDate, endDate) {
28
- return startDate ? '(' + startDate.value.slice(0, 10) + ' to ' +
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
- const memberships = store.each(null, ORG('member'), subject, null);
34
- const rolesByType = { PastRole: [], CurrentRole: [], FutureRole: [] };
35
- for (const membership of memberships) {
36
- let orgHomePage, orgNameGiven, publicIdName, roleName, publicId;
37
- // Things should have start dates but we will be very lenient in this view
38
- const startDate = store.any(membership, ns.schema('startDate'));
39
- const endDate = store.any(membership, ns.schema('endDate'));
40
- const dates = datesAsText(startDate, endDate);
41
- const organization = store.any(membership, ORG('organization'));
42
- if (organization) {
43
- orgNameGiven = store.anyJS(organization, ns.schema('name'));
44
- orgHomePage = store.any(organization, ns.schema('uri'));
45
- publicId = store.any(organization, ns.solid('publicId'));
46
- }
47
- if (publicId) {
48
- publicIdName = store.anyJS(publicId, ns.schema('name'));
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
- return rolesByType;
68
- }
69
- export function presentCV(subject, store) {
70
- const rolesByType = getRolesByType(store, subject);
71
- // Most recent thing most relevant -> sort by end date
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
- rolesByType[t].sort(function (x, y) {
74
- if (x.endDate && y.endDate) {
75
- return x.endDate > y.endDate ? -1 : 1;
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
- const skills = store.each(subject, ns.schema('skills')).map(sk => skillAsText(store, sk));
81
- const languagesInStore = store.anyJS(subject, ns.schema('knowsLanguage'));
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
- //# sourceMappingURL=CVPresenter.js.map
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
+ }
@@ -0,0 +1,4 @@
1
+ import { TemplateResult } from 'lit-html';
2
+ import { DataBrowserContext } from 'pane-registry';
3
+ import { NamedNode } from 'rdflib';
4
+ export declare const ChatWithMe: (subject: NamedNode, context: DataBrowserContext) => TemplateResult;
package/lib/ChatWithMe.js CHANGED
@@ -1,63 +1,44 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
- var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
11
- var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
12
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
13
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
14
- return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
15
- function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
16
- function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
17
- function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
18
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
19
- function fulfill(value) { resume("next", value); }
20
- function reject(value) { resume("throw", value); }
21
- function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
22
- };
23
- import { html } from 'lit-html';
24
- import { widgets } from 'solid-ui';
25
- import { asyncReplace } from 'lit-html/directives/async-replace.js';
26
- import { chatWithMeButtonText, loadingMessage } from './texts';
27
- export const ChatWithMe = (subject, context) => {
28
- const logic = context.session.logic;
29
- const longChatPane = context.session.paneRegistry.byName('long chat');
30
- function chatContainer() {
31
- return __asyncGenerator(this, arguments, function* chatContainer_1() {
32
- const chatContainer = context.dom.createElement('div');
33
- let exists;
34
- try {
35
- yield yield __await(loadingMessage), (exists = yield __await(logic.chat.getChat(subject, false)));
36
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
37
- }
38
- catch (e) {
39
- exists = false;
40
- }
41
- if (exists) {
42
- chatContainer.appendChild(longChatPane.render(exists, context, {}));
43
- yield yield __await(chatContainer);
44
- }
45
- else {
46
- const button = widgets.button(context.dom, undefined, chatWithMeButtonText, () => __awaiter(this, void 0, void 0, function* () {
47
- try {
48
- const chat = yield logic.chat.getChat(subject, true);
49
- chatContainer.innerHTML = '';
50
- chatContainer.appendChild(longChatPane.render(chat, context, {}));
51
- }
52
- catch (e) {
53
- chatContainer.appendChild(widgets.errorMessageBlock(context.dom, e.message));
54
- }
55
- }), { needsBorder: true });
56
- chatContainer.appendChild(button);
57
- yield yield __await(chatContainer);
58
- }
59
- });
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
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
20
+ } catch (e) {
21
+ exists = false;
22
+ }
23
+ if (exists) {
24
+ chatContainer.appendChild(longChatPane.render(exists, context, {}));
25
+ yield chatContainer;
26
+ } else {
27
+ const button = _solidUi.widgets.button(context.dom, undefined, _texts.chatWithMeButtonText, async () => {
28
+ try {
29
+ const chat = await logic.chat.getChat(subject, true);
30
+ chatContainer.innerHTML = '';
31
+ chatContainer.appendChild(longChatPane.render(chat, context, {}));
32
+ } catch (e) {
33
+ chatContainer.appendChild(_solidUi.widgets.errorMessageBlock(context.dom, e.message));
34
+ }
35
+ }, {
36
+ needsBorder: true
37
+ });
38
+ chatContainer.appendChild(button);
39
+ yield chatContainer;
60
40
  }
61
- return html ` ${asyncReplace(chatContainer())} `;
41
+ }
42
+ return (0, _litHtml.html)` ${(0, _asyncReplace.asyncReplace)(chatContainer())} `;
62
43
  };
63
- //# sourceMappingURL=ChatWithMe.js.map
44
+ exports.ChatWithMe = ChatWithMe;