profile-pane 1.2.1-d33b9fcd → 1.2.1-e1285559

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 (63) hide show
  1. package/README.md +1 -21
  2. package/lib/0SAVED-CVCard.d.ts +4 -0
  3. package/lib/0SAVED-CVCard.js +90 -0
  4. package/lib/CVCard.d.ts +4 -0
  5. package/lib/CVCard.js +87 -101
  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 -89
  10. package/lib/FriendList.d.ts +5 -0
  11. package/lib/FriendList.js +44 -32
  12. package/lib/ProfileCard.d.ts +3 -0
  13. package/lib/ProfileCard.js +41 -25
  14. package/lib/ProfileView.d.ts +4 -0
  15. package/lib/ProfileView.js +66 -81
  16. package/lib/QRCodeCard.d.ts +4 -0
  17. package/lib/QRCodeCard.js +57 -30
  18. package/lib/SocialCard.d.ts +4 -0
  19. package/lib/SocialCard.js +64 -34
  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 +55 -27
  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 +92 -104
  28. package/lib/addMeToYourFriendsHelper.d.ts +5 -0
  29. package/lib/addMeToYourFriendsHelper.js +26 -0
  30. package/lib/baseStyles.d.ts +70 -0
  31. package/lib/baseStyles.js +92 -0
  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 -13
  42. package/package.json +13 -13
  43. package/lib/CVCard.js.map +0 -1
  44. package/lib/CVPresenter.js.map +0 -1
  45. package/lib/ChatWithMe.js.map +0 -1
  46. package/lib/FriendList.js.map +0 -1
  47. package/lib/ProfileCard.js.map +0 -1
  48. package/lib/ProfileView.js.map +0 -1
  49. package/lib/QRCodeCard.js.map +0 -1
  50. package/lib/SocialCard.js.map +0 -1
  51. package/lib/SocialPresenter.js.map +0 -1
  52. package/lib/StuffCard.js.map +0 -1
  53. package/lib/StuffPresenter.js.map +0 -1
  54. package/lib/addMeToYourFriends.js.map +0 -1
  55. package/lib/buttonsHelper.js +0 -24
  56. package/lib/buttonsHelper.js.map +0 -1
  57. package/lib/editProfilePane/editProfile.view.js.map +0 -1
  58. package/lib/editProfilePane/profile.dom.js.map +0 -1
  59. package/lib/editProfilePane/wrapped-profileFormText.js +0 -752
  60. package/lib/editProfilePane/wrapped-profileFormText.js.map +0 -1
  61. package/lib/index.js.map +0 -1
  62. package/lib/presenter.js.map +0 -1
  63. 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;
@@ -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
+ }
@@ -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,113 +1,99 @@
1
- import { html } from 'lit-html';
2
- import * as styles from './styles/CVCard.module.css';
3
- export const CVCard = (cvData) => {
4
- const { rolesByType, skills, languages } = cvData;
5
- const futureRolesArr = rolesByType['FutureRole'] || [];
6
- const currentRolesArr = rolesByType['CurrentRole'] || [];
7
- const pastRolesArr = rolesByType['PastRole'] || [];
8
- const skillsArr = skills || [];
9
- const languagesArr = languages || [];
10
- const hasFutureRole = Array.isArray(futureRolesArr) && futureRolesArr.length > 0;
11
- const hasCurrentRole = Array.isArray(currentRolesArr) && currentRolesArr.length > 0;
12
- const hasPastRole = Array.isArray(pastRolesArr) && pastRolesArr.length > 0;
13
- const hasSkills = Array.isArray(skillsArr) && skillsArr.length > 0;
14
- const hasLanguages = Array.isArray(languagesArr) && languagesArr.length > 0;
15
- if (!(hasFutureRole || hasCurrentRole || hasPastRole || hasSkills || hasLanguages))
16
- return html ``;
17
- return html `
18
- <section class="${styles.cvCard}" aria-label="Curriculum Vitae" data-testid="curriculum-vitae">
19
- ${hasFutureRole ? html `
20
- <section class="${styles.cvSection}" aria-labelledby="cv-future-heading">
21
- <h3 id="cv-future-heading">Future Roles</h3>
22
- <ul>
23
- ${renderRoles(futureRolesArr, true)}
24
- </ul>
25
- </section>
26
- ` : ''}
27
- ${hasCurrentRole ? html `
28
- <section class="${styles.cvSection}" aria-labelledby="cv-current-heading">
29
- <h3 id="cv-current-heading">Current Roles</h3>
30
- <ul>
31
- ${renderRoles(currentRolesArr, true)}
32
- </ul>
33
- </section>
34
- ` : ''}
35
- ${hasPastRole ? html `
36
- <section class="${styles.cvSection}" aria-labelledby="cv-past-heading">
37
- <h3 id="cv-past-heading">Past Roles</h3>
38
- <ul>
39
- ${renderRoles(pastRolesArr, true)}
40
- </ul>
41
- </section>
42
- ` : ''}
43
- ${hasSkills ? html `
44
- <section class="${styles.cvSection}" aria-labelledby="cv-skills-heading">
45
- <h3 id="cv-skills-heading">Skills</h3>
46
- <ul>
47
- ${renderSkills(skillsArr, true)}
48
- </ul>
49
- </section>
50
- ` : ''}
51
- ${hasLanguages ? html `
52
- <section aria-labelledby="cv-languages-heading">
53
- <h3 id="cv-languages-heading">Languages</h3>
54
- <ul>
55
- ${renderLanguages(languagesArr, true)}
56
- </ul>
57
- </section>
58
- ` : ''}
59
- </section>
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>
60
57
  `;
58
+ }
59
+ return (0, _litHtml.html)``;
61
60
  };
62
- function renderRole(role, asList = false) {
63
- if (!role)
64
- return html ``;
65
- return asList
66
- ? html `<li class="${styles.cvRole}">
67
- <span class="${styles.cvOrg}">${role.orgName}</span>
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>
68
65
  <span>${strToUpperCase(role.roleText)}</span>
69
- <span>${role.dates}</span>
70
- </li>`
71
- : html ``;
66
+ <span>${role.dates}</span>
67
+ </div> ` : (0, _litHtml.html)``;
72
68
  }
73
- function renderRoles(roles, asList = false) {
74
- if (!roles || !roles.length || !roles[0])
75
- return html ``;
76
- 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)``}`;
77
71
  }
78
- function renderSkill(skill, asList = false) {
79
- if (!skill)
80
- return html ``;
81
- return asList
82
- ? html `<li class="${styles.cvSkill}">${strToUpperCase(skill)}</li>`
83
- : 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)``;
84
76
  }
85
- function renderSkills(skills, asList = false) {
86
- if (!skills || !skills.length || !skills[0])
87
- return html ``;
88
- 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)``}`;
89
79
  }
90
- function renderLan(language, asList = false) {
91
- if (!language)
92
- return html ``;
93
- return asList
94
- ? html `<li class="${styles.cvLanguage}">${language}</li>`
95
- : 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)``;
96
84
  }
97
- function renderLanguages(languages, asList = false) {
98
- if (!languages || !languages.length || !languages[0])
99
- return html ``;
100
- 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)``}`;
101
87
  }
102
88
  function strToUpperCase(str) {
103
- if (str && str[0] > '') {
104
- const strCase = str.split(' ');
105
- for (let i = 0; i < strCase.length; i++) {
106
- strCase[i] = strCase[i].charAt(0).toUpperCase() +
107
- strCase[i].substring(1);
108
- }
109
- 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);
110
93
  }
111
- return '';
94
+ return strCase.join(' ');
95
+ }
96
+ return '';
112
97
  }
113
- //# 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;