@internetarchive/collection-browser 0.2.5 → 0.2.6-alpha1

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 (49) hide show
  1. package/dist/src/{tiles/grid → assets/img}/icons/favorite-filled.d.ts +0 -0
  2. package/dist/src/{tiles/grid → assets/img}/icons/favorite-filled.js +0 -0
  3. package/dist/src/{tiles/grid → assets/img}/icons/favorite-filled.js.map +1 -1
  4. package/dist/src/{tiles/grid → assets/img}/icons/reviews.d.ts +0 -0
  5. package/dist/src/{tiles/grid → assets/img}/icons/reviews.js +0 -0
  6. package/dist/src/{tiles/grid → assets/img}/icons/reviews.js.map +1 -1
  7. package/dist/src/{tiles/grid → assets/img}/icons/upload.d.ts +0 -0
  8. package/dist/src/{tiles/grid → assets/img}/icons/upload.js +0 -0
  9. package/dist/src/{tiles/grid → assets/img}/icons/upload.js.map +1 -1
  10. package/dist/src/assets/img/icons/views.d.ts +1 -0
  11. package/dist/src/{tiles/grid → assets/img}/icons/views.js +1 -1
  12. package/dist/src/assets/img/icons/views.js.map +1 -0
  13. package/dist/src/tiles/grid/account-tile.d.ts +1 -0
  14. package/dist/src/tiles/grid/account-tile.js +45 -78
  15. package/dist/src/tiles/grid/account-tile.js.map +1 -1
  16. package/dist/src/tiles/grid/item-tile.d.ts +6 -0
  17. package/dist/src/tiles/grid/item-tile.js +96 -124
  18. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  19. package/dist/src/tiles/grid/tile-stats.d.ts +10 -0
  20. package/dist/src/tiles/grid/tile-stats.js +134 -0
  21. package/dist/src/tiles/grid/tile-stats.js.map +1 -0
  22. package/dist/src/tiles/mediatype-icon.js +4 -0
  23. package/dist/src/tiles/mediatype-icon.js.map +1 -1
  24. package/dist/src/tiles/tile-dispatcher.js +1 -0
  25. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  26. package/dist/test/tile-stats.test.d.ts +1 -0
  27. package/dist/test/tile-stats.test.js +42 -0
  28. package/dist/test/tile-stats.test.js.map +1 -0
  29. package/dist/test/tiles/grid/item-tile.test.d.ts +1 -0
  30. package/dist/test/tiles/grid/item-tile.test.js +96 -0
  31. package/dist/test/tiles/grid/item-tile.test.js.map +1 -0
  32. package/package.json +1 -1
  33. package/src/{tiles/grid → assets/img}/icons/favorite-filled.ts +0 -0
  34. package/src/{tiles/grid → assets/img}/icons/reviews.ts +0 -0
  35. package/src/{tiles/grid → assets/img}/icons/upload.ts +0 -0
  36. package/src/{tiles/grid → assets/img}/icons/views.ts +1 -1
  37. package/src/tiles/grid/account-tile.ts +44 -77
  38. package/src/tiles/grid/item-tile.ts +103 -125
  39. package/src/tiles/grid/tile-stats.ts +132 -0
  40. package/src/tiles/mediatype-icon.ts +4 -0
  41. package/src/tiles/tile-dispatcher.ts +1 -0
  42. package/test/tile-stats.test.ts +57 -0
  43. package/test/tiles/grid/item-tile.test.ts +116 -0
  44. package/dist/src/tiles/grid/icons/account.d.ts +0 -1
  45. package/dist/src/tiles/grid/icons/account.js +0 -12
  46. package/dist/src/tiles/grid/icons/account.js.map +0 -1
  47. package/dist/src/tiles/grid/icons/views.d.ts +0 -2
  48. package/dist/src/tiles/grid/icons/views.js.map +0 -1
  49. package/src/tiles/grid/icons/account.ts +0 -12
@@ -1 +1 @@
1
- {"version":3,"file":"favorite-filled.js","sourceRoot":"","sources":["../../../../../src/tiles/grid/icons/favorite-filled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAA;;;;;;;;CAQpC,CAAC","sourcesContent":["import { svg } from 'lit';\n\nexport const favoriteFilledIcon = svg`\n <svg viewBox=\"0 0 100 100\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"m81.0388846 100-30.9636029-22.5595033-30.7410319 22.5595033 10.6670595-37.3922042-30.0013093-25.2155916h37.5556428l12.5196389-37.3922042 12.3690754 37.3922042h37.5556429l-29.7034563 25.2155916z\"\n fill=\"#333\"\n />\n <title>Icon of a star, filled in</title>\n </svg>\n`;\n"]}
1
+ {"version":3,"file":"favorite-filled.js","sourceRoot":"","sources":["../../../../../src/assets/img/icons/favorite-filled.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,CAAA;;;;;;;;CAQpC,CAAC","sourcesContent":["import { svg } from 'lit';\n\nexport const favoriteFilledIcon = svg`\n <svg viewBox=\"0 0 100 100\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"m81.0388846 100-30.9636029-22.5595033-30.7410319 22.5595033 10.6670595-37.3922042-30.0013093-25.2155916h37.5556428l12.5196389-37.3922042 12.3690754 37.3922042h37.5556429l-29.7034563 25.2155916z\"\n fill=\"#333\"\n />\n <title>Icon of a star, filled in</title>\n </svg>\n`;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"reviews.js","sourceRoot":"","sources":["../../../../../src/tiles/grid/icons/reviews.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAA;;;;;;;;CAQ7B,CAAC","sourcesContent":["import { svg } from 'lit';\n\nexport const reviewsIcon = svg`\n <svg viewBox=\"0 0 100 100\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"m100 7.78013601c0-2.14552613-.7593357-3.978597-2.278007-5.4992126-1.5186713-1.52061561-3.3493984-2.28092341-5.4921813-2.28092341h-84.54977287c-2.08268321 0-3.88336049.7603078-5.40203183 2.28092341-1.51867133 1.5206156-2.278007 3.35368647-2.278007 5.4992126v51.49262709c0 2.0853495.75933567 3.8883321 2.278007 5.4089477 1.51867134 1.5206156 3.31934862 2.2809234 5.40203183 2.2809234h10.53361537l.3571304 33.0373658 32.4087237-33.0373658h41.2468361c2.1427829 0 3.97351-.7603078 5.4921813-2.2809234s2.278007-3.3235982 2.278007-5.4089477z\"\n fill=\"#333\"\n />\n <title>Icon of a speech bubble</title>\n </svg>\n`;\n"]}
1
+ {"version":3,"file":"reviews.js","sourceRoot":"","sources":["../../../../../src/assets/img/icons/reviews.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAA;;;;;;;;CAQ7B,CAAC","sourcesContent":["import { svg } from 'lit';\n\nexport const reviewsIcon = svg`\n <svg viewBox=\"0 0 100 100\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"m100 7.78013601c0-2.14552613-.7593357-3.978597-2.278007-5.4992126-1.5186713-1.52061561-3.3493984-2.28092341-5.4921813-2.28092341h-84.54977287c-2.08268321 0-3.88336049.7603078-5.40203183 2.28092341-1.51867133 1.5206156-2.278007 3.35368647-2.278007 5.4992126v51.49262709c0 2.0853495.75933567 3.8883321 2.278007 5.4089477 1.51867134 1.5206156 3.31934862 2.2809234 5.40203183 2.2809234h10.53361537l.3571304 33.0373658 32.4087237-33.0373658h41.2468361c2.1427829 0 3.97351-.7603078 5.4921813-2.2809234s2.278007-3.3235982 2.278007-5.4089477z\"\n fill=\"#333\"\n />\n <title>Icon of a speech bubble</title>\n </svg>\n`;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"upload.js","sourceRoot":"","sources":["../../../../../src/tiles/grid/icons/upload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,CAAA;;;;;;;;;CAS5B,CAAC","sourcesContent":["import { svg } from 'lit';\n\nexport const uploadIcon = svg`\n <svg viewBox=\"0 0 100 100\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"m50 20 33.3333333 43.3333333h-20v36.6666667h-26.6666666v-36.6666667h-20zm50-20v13.3333333h-100v-13.3333333z\"\n fill=\"#333\"\n fill-rule=\"evenodd\"\n />\n <title>Icon of an arrow pointing upwards</title>\n </svg>\n`;\n"]}
1
+ {"version":3,"file":"upload.js","sourceRoot":"","sources":["../../../../../src/assets/img/icons/upload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,CAAA;;;;;;;;;CAS5B,CAAC","sourcesContent":["import { svg } from 'lit';\n\nexport const uploadIcon = svg`\n <svg viewBox=\"0 0 100 100\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"m50 20 33.3333333 43.3333333h-20v36.6666667h-26.6666666v-36.6666667h-20zm50-20v13.3333333h-100v-13.3333333z\"\n fill=\"#333\"\n fill-rule=\"evenodd\"\n />\n <title>Icon of an arrow pointing upwards</title>\n </svg>\n`;\n"]}
@@ -0,0 +1 @@
1
+ export declare const viewsIcon: import("lit-html").TemplateResult<2>;
@@ -1,5 +1,5 @@
1
1
  import { svg } from 'lit';
2
- export default svg `
2
+ export const viewsIcon = svg `
3
3
  <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
4
4
  <path
5
5
  d="m98 50.5704143c-.2830293-.471515-.671154-1.1088947-1.1643742-1.9121392s-1.6003642-2.3617474-3.3214321-4.6755089c-1.7210678-2.3137614-3.522258-4.5325939-5.4035703-6.6564975-1.8813124-2.1239037-4.2828993-4.473133-7.2047606-7.0476881-2.9218612-2.5745551-5.8895067-4.7933876-8.9029363-6.6564976-3.0134295-1.86311-6.4628491-3.4330878-10.3482587-4.7099336-3.8854095-1.2768458-7.7822651-1.9142256-11.6905667-1.9121443-3.9083017.0020914-7.8051573.6154781-11.6905668 1.8401652-3.8854096 1.2246871-7.3702078 2.8301329-10.4543947 4.8163375-3.0841869 1.9862045-6.0278997 4.1695691-8.8311384 6.5500937s-5.2048256 4.7652219-7.2047605 7.1540919c-1.99993501 2.38887-3.75430043 4.5722346-5.26309632 6.5500938s-2.63883199 3.583305-3.39010829 4.8163374l-1.13003609 1.8401602c.2830293.4715149.67115403 1.1088946 1.16437421 1.9121391.49322017.8032445 1.5878776 2.3617475 3.28397229 4.6755089s3.47439274 4.521119 5.3348942 6.6220728c1.8605014 2.1009538 4.2506422 4.4387083 7.1704224 7.0132633 2.9197801 2.5745551 5.8874256 4.7819127 8.9029363 6.6220729 3.0155106 1.8401601 6.4774168 3.398663 10.3857184 4.6755088 3.9083017 1.2768458 7.8176438 1.9142256 11.7280266 1.9121443 3.9103827-.0020914 7.7957922-.6154781 11.6562286-1.8401652s7.3337886-2.818658 10.4200566-4.7819127 6.0299808-4.1351444 8.8311384-6.515669 5.2152311-4.7652219 7.2422203-7.1540919 3.8052873-4.5607597 5.3348942-6.515669c1.5296068-1.9549093 2.6721295-3.5488802 3.427568-4.7819127zm-24.5142913 0c0 6.467683-2.3079374 12.0152859-6.9238123 16.6428087s-10.1495139 6.9412843-16.600917 6.9412843c-6.4992683 0-12.0453939-2.3137615-16.6383767-6.9412843s-6.8894742-10.1751257-6.8894742-16.6428087 2.2964914-12.003811 6.8894742-16.608384 10.1391084-6.9068595 16.6383767-6.9068595c6.4534842 0 11.9871232 2.3022865 16.600917 6.9068595s6.9217312 10.140701 6.9238123 16.608384zm-23.5247293-10.552755c2.8261308 0 5.2870289 1.0619518 7.3826944 3.1858555 2.0956655 2.1239036 3.1434982 4.5795368 3.1434982 7.3668995 0 2.8332624-1.0478327 5.2888956-3.1434982 7.3668995-2.0956655 2.078004-4.5565636 3.1170059-7.3826944 3.1170059-2.873996 0-5.3348941-1.0264838-7.3826944-3.0794516-2.0478002-2.0529677-3.0717003-4.5200758-3.0717003-7.4013243 0-2.8332624 1.0239001-5.3003705 3.0717003-7.4013243 2.0478003-2.1009538 4.5086984-3.1514307 7.3826944-3.1514307z"
@@ -0,0 +1 @@
1
+ {"version":3,"file":"views.js","sourceRoot":"","sources":["../../../../../src/assets/img/icons/views.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAA;;;;;;;;CAQ3B,CAAC","sourcesContent":["import { svg } from 'lit';\n\nexport const viewsIcon = svg`\n <svg viewBox=\"0 0 100 100\" xmlns=\"http://www.w3.org/2000/svg\">\n <path\n d=\"m98 50.5704143c-.2830293-.471515-.671154-1.1088947-1.1643742-1.9121392s-1.6003642-2.3617474-3.3214321-4.6755089c-1.7210678-2.3137614-3.522258-4.5325939-5.4035703-6.6564975-1.8813124-2.1239037-4.2828993-4.473133-7.2047606-7.0476881-2.9218612-2.5745551-5.8895067-4.7933876-8.9029363-6.6564976-3.0134295-1.86311-6.4628491-3.4330878-10.3482587-4.7099336-3.8854095-1.2768458-7.7822651-1.9142256-11.6905667-1.9121443-3.9083017.0020914-7.8051573.6154781-11.6905668 1.8401652-3.8854096 1.2246871-7.3702078 2.8301329-10.4543947 4.8163375-3.0841869 1.9862045-6.0278997 4.1695691-8.8311384 6.5500937s-5.2048256 4.7652219-7.2047605 7.1540919c-1.99993501 2.38887-3.75430043 4.5722346-5.26309632 6.5500938s-2.63883199 3.583305-3.39010829 4.8163374l-1.13003609 1.8401602c.2830293.4715149.67115403 1.1088946 1.16437421 1.9121391.49322017.8032445 1.5878776 2.3617475 3.28397229 4.6755089s3.47439274 4.521119 5.3348942 6.6220728c1.8605014 2.1009538 4.2506422 4.4387083 7.1704224 7.0132633 2.9197801 2.5745551 5.8874256 4.7819127 8.9029363 6.6220729 3.0155106 1.8401601 6.4774168 3.398663 10.3857184 4.6755088 3.9083017 1.2768458 7.8176438 1.9142256 11.7280266 1.9121443 3.9103827-.0020914 7.7957922-.6154781 11.6562286-1.8401652s7.3337886-2.818658 10.4200566-4.7819127 6.0299808-4.1351444 8.8311384-6.515669 5.2152311-4.7652219 7.2422203-7.1540919 3.8052873-4.5607597 5.3348942-6.515669c1.5296068-1.9549093 2.6721295-3.5488802 3.427568-4.7819127zm-24.5142913 0c0 6.467683-2.3079374 12.0152859-6.9238123 16.6428087s-10.1495139 6.9412843-16.600917 6.9412843c-6.4992683 0-12.0453939-2.3137615-16.6383767-6.9412843s-6.8894742-10.1751257-6.8894742-16.6428087 2.2964914-12.003811 6.8894742-16.608384 10.1391084-6.9068595 16.6383767-6.9068595c6.4534842 0 11.9871232 2.3022865 16.600917 6.9068595s6.9217312 10.140701 6.9238123 16.608384zm-23.5247293-10.552755c2.8261308 0 5.2870289 1.0619518 7.3826944 3.1858555 2.0956655 2.1239036 3.1434982 4.5795368 3.1434982 7.3668995 0 2.8332624-1.0478327 5.2888956-3.1434982 7.3668995-2.0956655 2.078004-4.5565636 3.1170059-7.3826944 3.1170059-2.873996 0-5.3348941-1.0264838-7.3826944-3.0794516-2.0478002-2.0529677-3.0717003-4.5200758-3.0717003-7.4013243 0-2.8332624 1.0239001-5.3003705 3.0717003-7.4013243 2.0478003-2.1009538 4.5086984-3.1514307 7.3826944-3.1514307z\"\n fill=\"#333\"\n />\n <title>Eye icon</title>\n </svg>\n`;\n"]}
@@ -1,5 +1,6 @@
1
1
  import { LitElement } from 'lit';
2
2
  import { TileModel } from '../../models';
3
+ import './tile-stats';
3
4
  export declare class AccountTile extends LitElement {
4
5
  model?: TileModel;
5
6
  render(): import("lit-html").TemplateResult<1>;
@@ -1,52 +1,37 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { css, html, LitElement } from 'lit';
3
3
  import { customElement, property } from 'lit/decorators.js';
4
- import { accountIcon } from './icons/account';
5
- import { favoriteFilledIcon } from './icons/favorite-filled';
6
- import { reviewsIcon } from './icons/reviews';
7
- import { uploadIcon } from './icons/upload';
4
+ import './tile-stats';
8
5
  let AccountTile = class AccountTile extends LitElement {
9
6
  render() {
10
- var _a, _b, _c, _d, _e, _f, _g;
7
+ var _a, _b, _c, _d, _e, _f, _g, _h;
11
8
  return html `
12
- <div class="outer-holder">
13
- <div class="inner-holder">
14
- <div id="header-holder">
15
- <div id="title-holder">
16
- <h1 class="truncated">${(_a = this.model) === null || _a === void 0 ? void 0 : _a.identifier}</h1>
17
- </div>
18
- <div id="avatar-holder">
19
- <div
20
- id="avatar"
21
- style="background-image: url('https://archive.org/services/img/${(_b = this
22
- .model) === null || _b === void 0 ? void 0 : _b.identifier}')"
23
- ></div>
24
- </div>
25
- </div>
26
- <div id="year-holder">
27
- <div id="archivist-since">
28
- <h3>Archivist Since</h3>
29
- </div>
30
- <div id="year-holder">
31
- <h3>${(_d = (_c = this.model) === null || _c === void 0 ? void 0 : _c.dateAdded) === null || _d === void 0 ? void 0 : _d.getFullYear()}</h3>
32
- </div>
33
- </div>
34
- <div id="status-holder">
35
- <div id="patron-icon">${accountIcon}</div>
36
- <div class="stat-icon">
37
- ${uploadIcon}
38
- <h3>${(_e = this.model) === null || _e === void 0 ? void 0 : _e.itemCount}</h3>
39
- </div>
40
- <div class="stat-icon">
41
- ${favoriteFilledIcon}
42
- <h3>${(_f = this.model) === null || _f === void 0 ? void 0 : _f.favCount}</h3>
43
- </div>
44
- <div class="stat-icon">
45
- ${reviewsIcon}
46
- <h3>${(_g = this.model) === null || _g === void 0 ? void 0 : _g.commentCount}</h3>
47
- </div>
9
+ <div class="account-tile-main">
10
+ <div id="title">
11
+ <h1 class="truncated">${(_a = this.model) === null || _a === void 0 ? void 0 : _a.identifier}</h1>
12
+ </div>
13
+
14
+ <div class="account-info">
15
+ <div id="avatar-info">
16
+ <img
17
+ id="avatar"
18
+ alt="patron-avatar"
19
+ src="https://archive.org/services/img/${(_b = this.model) === null || _b === void 0 ? void 0 : _b.identifier}"
20
+ />
48
21
  </div>
22
+
23
+ <span id="archivist-since">
24
+ Archivist since ${(_d = (_c = this.model) === null || _c === void 0 ? void 0 : _c.dateAdded) === null || _d === void 0 ? void 0 : _d.getFullYear()}
25
+ </span>
49
26
  </div>
27
+
28
+ <tile-stats
29
+ .mediatype=${(_e = this.model) === null || _e === void 0 ? void 0 : _e.mediatype}
30
+ .itemCount=${(_f = this.model) === null || _f === void 0 ? void 0 : _f.itemCount}
31
+ .favCount=${(_g = this.model) === null || _g === void 0 ? void 0 : _g.favCount}
32
+ .commentCount=${(_h = this.model) === null || _h === void 0 ? void 0 : _h.commentCount}
33
+ >
34
+ </tile-stats>
50
35
  </div>
51
36
  `;
52
37
  }
@@ -58,41 +43,45 @@ let AccountTile = class AccountTile extends LitElement {
58
43
  margin: 0;
59
44
  }
60
45
 
61
- h3 {
46
+ span {
62
47
  font-size: 14px;
63
- font-weight: bold;
64
48
  color: #2c2c2c;
65
49
  margin: 0px;
66
50
  }
67
51
 
68
- .outer-holder {
52
+ .account-tile-main {
69
53
  background-color: #fcf5e6;
70
54
  border: 1px #2c2c2c;
71
55
  border-radius: 4px;
72
56
  box-shadow: 1px 1px 2px 0px;
73
57
  height: 100%;
74
58
  display: flex;
59
+ flex-direction: column;
75
60
  text-align: center;
76
61
  width: 100%;
77
62
  }
78
63
 
79
- .inner-holder {
80
- padding: 5px;
81
- width: 100%;
82
- display: flex;
83
- flex-direction: column;
64
+ .account-info {
65
+ flex-grow: 1;
84
66
  }
85
67
 
86
- #header-holder {
87
- flex: 1;
68
+ #title {
69
+ padding: 5px 5px 0px 5px;
70
+ flex-shrink: 0;
71
+ height: 40px;
88
72
  }
89
73
 
90
- #title-holder {
91
- height: 40px;
92
- margin-bottom: 5px;
74
+ .account-tile-main:hover > #title > .truncated {
75
+ text-decoration: underline;
76
+ }
77
+
78
+ /** this is a workaround for Safari 15 where the hover effects are not working */
79
+ #title:hover > .truncated {
80
+ text-decoration: underline;
93
81
  }
94
82
 
95
- #avatar-holder {
83
+ #avatar-info {
84
+ margin-top: 5px;
96
85
  margin-bottom: 5px;
97
86
  display: flex;
98
87
  align-items: center;
@@ -107,27 +96,11 @@ let AccountTile = class AccountTile extends LitElement {
107
96
  box-shadow: 1px 1px 2px #888888;
108
97
  }
109
98
 
110
- #year-holder {
99
+ #archivist-since {
111
100
  margin-bottom: 5px;
112
101
  height: 40px;
113
102
  }
114
103
 
115
- #year-holder {
116
- margin: 0px;
117
- }
118
-
119
- #status-holder {
120
- height: 25px;
121
- display: flex;
122
- justify-content: space-evenly;
123
- line-height: initial;
124
- }
125
-
126
- #patron-icon {
127
- height: 25px;
128
- width: 25px;
129
- }
130
-
131
104
  .truncated {
132
105
  flex: 1;
133
106
  min-width: 0; /* Important for long words! */
@@ -137,15 +110,9 @@ let AccountTile = class AccountTile extends LitElement {
137
110
  display: -webkit-box;
138
111
  -webkit-box-orient: vertical;
139
112
  word-wrap: break-word;
140
- word-break: break-all;
141
113
  line-height: 2rem;
142
114
  text-align: center;
143
115
  }
144
-
145
- .stat-icon {
146
- height: 10px;
147
- width: 10px;
148
- }
149
116
  `;
150
117
  }
151
118
  };
@@ -1 +1 @@
1
- {"version":3,"file":"account-tile.js","sourceRoot":"","sources":["../../../../src/tiles/grid/account-tile.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG5D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG5C,IAAa,WAAW,GAAxB,MAAa,WAAY,SAAQ,UAAU;IAGzC,MAAM;;QACJ,OAAO,IAAI,CAAA;;;;;sCAKuB,MAAA,IAAI,CAAC,KAAK,0CAAE,UAAU;;;;;iFAKqB,MAAA,IAAI;aAClE,KAAK,0CAAE,UAAU;;;;;;;;;oBAShB,MAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,SAAS,0CAAE,WAAW,EAAE;;;;oCAIpB,WAAW;;gBAE/B,UAAU;oBACN,MAAA,IAAI,CAAC,KAAK,0CAAE,SAAS;;;gBAGzB,kBAAkB;oBACd,MAAA,IAAI,CAAC,KAAK,0CAAE,QAAQ;;;gBAGxB,WAAW;oBACP,MAAA,IAAI,CAAC,KAAK,0CAAE,YAAY;;;;;KAKvC,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA+FT,CAAC;IACJ,CAAC;CACF,CAAA;AAhJ6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAmB;AADnC,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAiJvB;SAjJY,WAAW","sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { TileModel } from '../../models';\n\nimport { accountIcon } from './icons/account';\nimport { favoriteFilledIcon } from './icons/favorite-filled';\nimport { reviewsIcon } from './icons/reviews';\nimport { uploadIcon } from './icons/upload';\n\n@customElement('account-tile')\nexport class AccountTile extends LitElement {\n @property({ type: Object }) model?: TileModel;\n\n render() {\n return html`\n <div class=\"outer-holder\">\n <div class=\"inner-holder\">\n <div id=\"header-holder\">\n <div id=\"title-holder\">\n <h1 class=\"truncated\">${this.model?.identifier}</h1>\n </div>\n <div id=\"avatar-holder\">\n <div\n id=\"avatar\"\n style=\"background-image: url('https://archive.org/services/img/${this\n .model?.identifier}')\"\n ></div>\n </div>\n </div>\n <div id=\"year-holder\">\n <div id=\"archivist-since\">\n <h3>Archivist Since</h3>\n </div>\n <div id=\"year-holder\">\n <h3>${this.model?.dateAdded?.getFullYear()}</h3>\n </div>\n </div>\n <div id=\"status-holder\">\n <div id=\"patron-icon\">${accountIcon}</div>\n <div class=\"stat-icon\">\n ${uploadIcon}\n <h3>${this.model?.itemCount}</h3>\n </div>\n <div class=\"stat-icon\">\n ${favoriteFilledIcon}\n <h3>${this.model?.favCount}</h3>\n </div>\n <div class=\"stat-icon\">\n ${reviewsIcon}\n <h3>${this.model?.commentCount}</h3>\n </div>\n </div>\n </div>\n </div>\n `;\n }\n\n static get styles() {\n return css`\n h1 {\n color: black;\n font-size: 16px;\n margin: 0;\n }\n\n h3 {\n font-size: 14px;\n font-weight: bold;\n color: #2c2c2c;\n margin: 0px;\n }\n\n .outer-holder {\n background-color: #fcf5e6;\n border: 1px #2c2c2c;\n border-radius: 4px;\n box-shadow: 1px 1px 2px 0px;\n height: 100%;\n display: flex;\n text-align: center;\n width: 100%;\n }\n\n .inner-holder {\n padding: 5px;\n width: 100%;\n display: flex;\n flex-direction: column;\n }\n\n #header-holder {\n flex: 1;\n }\n\n #title-holder {\n height: 40px;\n margin-bottom: 5px;\n }\n\n #avatar-holder {\n margin-bottom: 5px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n #avatar {\n background-position: 50% 50%;\n border-radius: 50%;\n width: 160px;\n height: 160px;\n box-shadow: 1px 1px 2px #888888;\n }\n\n #year-holder {\n margin-bottom: 5px;\n height: 40px;\n }\n\n #year-holder {\n margin: 0px;\n }\n\n #status-holder {\n height: 25px;\n display: flex;\n justify-content: space-evenly;\n line-height: initial;\n }\n\n #patron-icon {\n height: 25px;\n width: 25px;\n }\n\n .truncated {\n flex: 1;\n min-width: 0; /* Important for long words! */\n -webkit-line-clamp: 2;\n text-overflow: ellipsis;\n overflow: hidden;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n word-wrap: break-word;\n word-break: break-all;\n line-height: 2rem;\n text-align: center;\n }\n\n .stat-icon {\n height: 10px;\n width: 10px;\n }\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"account-tile.js","sourceRoot":"","sources":["../../../../src/tiles/grid/account-tile.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG5D,OAAO,cAAc,CAAC;AAGtB,IAAa,WAAW,GAAxB,MAAa,WAAY,SAAQ,UAAU;IAGzC,MAAM;;QACJ,OAAO,IAAI,CAAA;;;kCAGmB,MAAA,IAAI,CAAC,KAAK,0CAAE,UAAU;;;;;;;;sDAQF,MAAA,IAAI,CAAC,KAAK,0CAAE,UAAU;;;;;8BAK9C,MAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,SAAS,0CAAE,WAAW,EAAE;;;;;uBAK3C,MAAA,IAAI,CAAC,KAAK,0CAAE,SAAS;uBACrB,MAAA,IAAI,CAAC,KAAK,0CAAE,SAAS;sBACtB,MAAA,IAAI,CAAC,KAAK,0CAAE,QAAQ;0BAChB,MAAA,IAAI,CAAC,KAAK,0CAAE,YAAY;;;;KAI7C,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KA6ET,CAAC;IACJ,CAAC;CACF,CAAA;AAlH6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0CAAmB;AADnC,WAAW;IADvB,aAAa,CAAC,cAAc,CAAC;GACjB,WAAW,CAmHvB;SAnHY,WAAW","sourcesContent":["import { css, html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { TileModel } from '../../models';\n\nimport './tile-stats';\n\n@customElement('account-tile')\nexport class AccountTile extends LitElement {\n @property({ type: Object }) model?: TileModel;\n\n render() {\n return html`\n <div class=\"account-tile-main\">\n <div id=\"title\">\n <h1 class=\"truncated\">${this.model?.identifier}</h1>\n </div>\n\n <div class=\"account-info\">\n <div id=\"avatar-info\">\n <img\n id=\"avatar\"\n alt=\"patron-avatar\"\n src=\"https://archive.org/services/img/${this.model?.identifier}\"\n />\n </div>\n\n <span id=\"archivist-since\">\n Archivist since ${this.model?.dateAdded?.getFullYear()}\n </span>\n </div>\n\n <tile-stats\n .mediatype=${this.model?.mediatype}\n .itemCount=${this.model?.itemCount}\n .favCount=${this.model?.favCount}\n .commentCount=${this.model?.commentCount}\n >\n </tile-stats>\n </div>\n `;\n }\n\n static get styles() {\n return css`\n h1 {\n color: black;\n font-size: 16px;\n margin: 0;\n }\n\n span {\n font-size: 14px;\n color: #2c2c2c;\n margin: 0px;\n }\n\n .account-tile-main {\n background-color: #fcf5e6;\n border: 1px #2c2c2c;\n border-radius: 4px;\n box-shadow: 1px 1px 2px 0px;\n height: 100%;\n display: flex;\n flex-direction: column;\n text-align: center;\n width: 100%;\n }\n\n .account-info {\n flex-grow: 1;\n }\n\n #title {\n padding: 5px 5px 0px 5px;\n flex-shrink: 0;\n height: 40px;\n }\n\n .account-tile-main:hover > #title > .truncated {\n text-decoration: underline;\n }\n\n /** this is a workaround for Safari 15 where the hover effects are not working */\n #title:hover > .truncated {\n text-decoration: underline;\n }\n\n #avatar-info {\n margin-top: 5px;\n margin-bottom: 5px;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n #avatar {\n background-position: 50% 50%;\n border-radius: 50%;\n width: 160px;\n height: 160px;\n box-shadow: 1px 1px 2px #888888;\n }\n\n #archivist-since {\n margin-bottom: 5px;\n height: 40px;\n }\n\n .truncated {\n flex: 1;\n min-width: 0; /* Important for long words! */\n -webkit-line-clamp: 2;\n text-overflow: ellipsis;\n overflow: hidden;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n word-wrap: break-word;\n line-height: 2rem;\n text-align: center;\n }\n `;\n }\n}\n"]}
@@ -1,10 +1,16 @@
1
1
  import { CSSResultGroup, LitElement } from 'lit';
2
+ import { SortParam } from '@internetarchive/search-service';
2
3
  import { TileModel } from '../../models';
3
4
  import '../mediatype-icon';
4
5
  import '../item-image';
6
+ import './tile-stats';
5
7
  export declare class ItemTile extends LitElement {
6
8
  model?: TileModel;
7
9
  baseImageUrl?: string;
10
+ sortParam?: SortParam;
8
11
  render(): import("lit-html").TemplateResult<1>;
12
+ private get doesSortedByDate();
13
+ private get sortedDateInfoTemplate();
14
+ private get creatorTemplate();
9
15
  static get styles(): CSSResultGroup;
10
16
  }
@@ -2,189 +2,158 @@ import { __decorate } from "tslib";
2
2
  /* eslint-disable import/no-duplicates */
3
3
  import { css, html, LitElement, nothing } from 'lit';
4
4
  import { customElement, property } from 'lit/decorators.js';
5
- import { formatCount } from '../../utils/format-count';
6
- import { favoriteFilledIcon } from './icons/favorite-filled';
7
- import { reviewsIcon } from './icons/reviews';
8
- import viewsIcon from './icons/views';
5
+ import { ifDefined } from 'lit/directives/if-defined.js';
6
+ import { formatDate } from '../../utils/format-date';
9
7
  import '../mediatype-icon';
10
8
  import '../item-image';
9
+ import './tile-stats';
11
10
  let ItemTile = class ItemTile extends LitElement {
12
11
  render() {
13
- var _a, _b, _c, _d, _e, _f, _g;
14
- const itemTitle = ((_a = this.model) === null || _a === void 0 ? void 0 : _a.title) || nothing;
15
- const itemCreator = (_b = this.model) === null || _b === void 0 ? void 0 : _b.creator;
12
+ var _a, _b, _c, _d, _e;
13
+ const itemTitle = (_a = this.model) === null || _a === void 0 ? void 0 : _a.title;
16
14
  return html `
17
- <div id="container">
18
- <div id="title-image-container">
19
- <h1 id="item-title" title=${itemTitle}>${itemTitle}</h1>
20
- <div id="item-image-container">
21
- <item-image .model=${this.model} .baseImageUrl=${this.baseImageUrl}>
22
- </item-image>
15
+ <div class="container">
16
+ <div class="item-info">
17
+ <div id="title">
18
+ <h1 class="truncated" title=${ifDefined(itemTitle)}>${itemTitle}</h1>
23
19
  </div>
24
- <div class="item-creator">
25
- <div class="truncated">
26
- ${itemCreator
27
- ? html `<span>by&nbsp;${itemCreator}</span>`
28
- : nothing}
29
- </div>
20
+
21
+ <div id="image">
22
+ <item-image
23
+ .model=${this.model}
24
+ .baseImageUrl=${this.baseImageUrl}>
25
+ </item-image>
30
26
  </div>
27
+ ${this.doesSortedByDate
28
+ ? this.sortedDateInfoTemplate
29
+ : this.creatorTemplate}
31
30
  </div>
32
31
 
33
- <div class="hr"></div>
34
-
35
- <div id="item-stats-container">
36
- <div id="stats-holder">
37
- <div class="col">
38
- <mediatype-icon
39
- .mediatype=${(_c = this.model) === null || _c === void 0 ? void 0 : _c.mediatype}
40
- .collection=${(_d = this.model) === null || _d === void 0 ? void 0 : _d.collections}
41
- style="--iconHeight:25px; --iconWidth:25px;"
42
- >
43
- </mediatype-icon>
44
- </div>
45
- <div class="col">
46
- ${viewsIcon}
47
- <p class="status-text">
48
- ${formatCount((_e = this.model) === null || _e === void 0 ? void 0 : _e.viewCount, 'short', 'short')}
49
- </p>
50
- </div>
51
- <div class="col">
52
- ${favoriteFilledIcon}
53
- <p class="status-text">
54
- ${formatCount((_f = this.model) === null || _f === void 0 ? void 0 : _f.itemCount, 'short', 'short')}
55
- </p>
56
- </div>
57
- <div class="col">
58
- ${reviewsIcon}
59
- <p class="status-text">
60
- ${formatCount((_g = this.model) === null || _g === void 0 ? void 0 : _g.favCount, 'short', 'short')}
61
- </p>
62
- </div>
63
- </div>
32
+ <tile-stats
33
+ .mediatype=${(_b = this.model) === null || _b === void 0 ? void 0 : _b.mediatype}
34
+ .viewCount=${(_c = this.model) === null || _c === void 0 ? void 0 : _c.viewCount}
35
+ .favCount=${(_d = this.model) === null || _d === void 0 ? void 0 : _d.favCount}
36
+ .commentCount=${(_e = this.model) === null || _e === void 0 ? void 0 : _e.commentCount}>
37
+ </tile-stats>
64
38
  </div>
65
39
  </div>
66
40
  `;
67
41
  }
42
+ get doesSortedByDate() {
43
+ var _a;
44
+ return ['date', 'reviewdate', 'addeddate', 'publicdate'].includes((_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field);
45
+ }
46
+ get sortedDateInfoTemplate() {
47
+ var _a, _b, _c, _d, _e;
48
+ let sortedValue;
49
+ switch ((_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field) {
50
+ case 'date':
51
+ sortedValue = { field: 'published', value: (_b = this.model) === null || _b === void 0 ? void 0 : _b.datePublished };
52
+ break;
53
+ case 'reviewdate':
54
+ sortedValue = { field: 'reviewed', value: (_c = this.model) === null || _c === void 0 ? void 0 : _c.dateReviewed };
55
+ break;
56
+ case 'addeddate':
57
+ sortedValue = { field: 'added', value: (_d = this.model) === null || _d === void 0 ? void 0 : _d.dateAdded };
58
+ break;
59
+ case 'publicdate':
60
+ sortedValue = { field: 'archived', value: (_e = this.model) === null || _e === void 0 ? void 0 : _e.dateArchived };
61
+ break;
62
+ default:
63
+ break;
64
+ }
65
+ return html `
66
+ <div class="date-sorted-by truncated">
67
+ <span>
68
+ ${sortedValue === null || sortedValue === void 0 ? void 0 : sortedValue.field} ${formatDate(sortedValue === null || sortedValue === void 0 ? void 0 : sortedValue.value, 'long')}
69
+ </span>
70
+ </div>
71
+ `;
72
+ }
73
+ get creatorTemplate() {
74
+ var _a, _b;
75
+ return html `
76
+ <div class="created-by truncated">
77
+ ${((_a = this.model) === null || _a === void 0 ? void 0 : _a.creator)
78
+ ? html `<span>by&nbsp;${(_b = this.model) === null || _b === void 0 ? void 0 : _b.creator}</span>`
79
+ : nothing}
80
+ </div>
81
+ `;
82
+ }
68
83
  static get styles() {
69
- const cornerRadiusCss = css `var(--collectionTileCornerRadius, 4px)`;
70
84
  return css `
71
- #container {
85
+ .container {
72
86
  background-color: #ffffff;
73
- border-radius: ${cornerRadiusCss};
87
+ border-radius: var(--collectionTileCornerRadius, 4px);
74
88
  box-shadow: 1px 1px 2px 0px;
75
89
  display: flex;
76
90
  flex-direction: column;
77
91
  height: 100%;
78
- position: relative;
79
92
  }
80
93
 
81
- #title-image-container {
82
- display: flex;
83
- flex: 1;
84
- flex-direction: column;
85
- padding: 0.5rem 0.5rem 0 0.5rem;
94
+ .item-info {
95
+ padding: 5px 5px 0 5px;
96
+ flex-grow: 1;
86
97
  }
87
98
 
88
- #item-title {
89
- color: #2c2c2c;
90
- font-size: 1.6rem;
91
- text-align: center;
92
- margin-top: 0rem;
93
- margin-bottom: 0.5rem;
94
- overflow: hidden;
95
- text-overflow: ellipsis;
96
- display: -webkit-box;
97
- -webkit-line-clamp: 2;
98
- -webkit-box-orient: vertical;
99
- line-height: 2rem;
100
- height: 4rem;
99
+ #title {
100
+ flex-shrink: 0;
101
101
  }
102
102
 
103
- #item-image-container {
103
+ #image {
104
104
  display: flex;
105
105
  justify-content: center;
106
106
  flex: 1;
107
+ height: 16rem;
107
108
  }
108
109
 
109
110
  .hidden {
110
111
  display: none;
111
112
  }
112
113
 
113
- #container:hover > #title-image-container > .item-title {
114
+ .container:hover > .item-info > #title > .truncated {
114
115
  text-decoration: underline;
115
116
  }
116
117
 
117
118
  /** this is a workaround for Safari 15 where the hover effects are not working */
118
- #title-image-container:hover > #item-title {
119
+ #title:hover > .truncated {
119
120
  text-decoration: underline;
120
121
  }
121
122
 
122
- #container:hover > #item-title {
123
- background-color: #fcfcfc;
124
- }
125
-
126
- .item-creator {
123
+ .created-by,
124
+ .date-sorted-by {
127
125
  display: flex;
128
126
  justify-content: center;
129
127
  align-items: flex-end; /* Important to start text from bottom */
130
128
  height: 3rem;
131
129
  padding-top: 1rem;
130
+ margin-top: 5px;
132
131
  }
133
132
 
134
133
  .truncated {
135
134
  flex: 1;
136
- min-width: 0; /* Important for long words! */
137
- }
138
-
139
- .truncated span {
140
- font-size: 1.4rem;
141
135
  color: #2c2c2c;
142
- -webkit-line-clamp: 2;
136
+ min-width: 0; /* Important for long words! */
137
+ text-align: center;
138
+ line-height: 2rem;
143
139
  text-overflow: ellipsis;
144
140
  overflow: hidden;
145
- display: -webkit-box;
146
- -webkit-box-orient: vertical;
147
141
  word-wrap: break-word;
148
- line-height: 2rem;
149
- text-align: center;
150
- }
151
-
152
- .hr {
153
- border: 0.5px solid #ccc;
154
- }
155
-
156
- #item-stats-container {
157
- align-items: center;
158
- display: flex;
159
- height: 5.5rem;
160
- padding-left: 1rem;
161
- padding-right: 0.5rem;
162
- }
163
-
164
- #stats-holder {
165
- align-items: center;
166
- display: flex;
167
- flex: 1;
168
- justify-content: space-evenly;
169
- text-align: center;
170
- width: 100%;
171
- }
172
-
173
- svg {
174
- height: 10px;
175
- width: 10px;
142
+ -webkit-line-clamp: 2;
143
+ -webkit-box-orient: vertical;
176
144
  }
177
145
 
178
- .status-text {
179
- font-size: 14px;
180
- color: #2c2c2c;
181
- margin: auto;
182
- display: block;
183
- text-align: center;
146
+ .truncated span {
147
+ font-size: 1.4rem;
148
+ display: -webkit-box;
184
149
  }
185
150
 
186
- .col {
187
- width: 25%;
151
+ h1.truncated {
152
+ margin-top: 0rem;
153
+ margin-bottom: 0.5rem;
154
+ font-size: 1.6rem;
155
+ height: 4rem;
156
+ display: -webkit-box;
188
157
  }
189
158
  `;
190
159
  }
@@ -195,6 +164,9 @@ __decorate([
195
164
  __decorate([
196
165
  property({ type: String })
197
166
  ], ItemTile.prototype, "baseImageUrl", void 0);
167
+ __decorate([
168
+ property({ type: Object })
169
+ ], ItemTile.prototype, "sortParam", void 0);
198
170
  ItemTile = __decorate([
199
171
  customElement('item-tile')
200
172
  ], ItemTile);
@@ -1 +1 @@
1
- {"version":3,"file":"item-tile.js","sourceRoot":"","sources":["../../../../src/tiles/grid/item-tile.ts"],"names":[],"mappings":";AAAA,yCAAyC;AACzC,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG5D,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAEvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,SAAS,MAAM,eAAe,CAAC;AAEtC,OAAO,mBAAmB,CAAC;AAC3B,OAAO,eAAe,CAAC;AAGvB,IAAa,QAAQ,GAArB,MAAa,QAAS,SAAQ,UAAU;IAKtC,MAAM;;QACJ,MAAM,SAAS,GAAG,CAAA,MAAA,IAAI,CAAC,KAAK,0CAAE,KAAK,KAAI,OAAO,CAAC;QAC/C,MAAM,WAAW,GAAG,MAAA,IAAI,CAAC,KAAK,0CAAE,OAAO,CAAC;QACxC,OAAO,IAAI,CAAA;;;sCAGuB,SAAS,IAAI,SAAS;;iCAE3B,IAAI,CAAC,KAAK,kBAAkB,IAAI,CAAC,YAAY;;;;;gBAK9D,WAAW;YACX,CAAC,CAAC,IAAI,CAAA,iBAAiB,WAAW,SAAS;YAC3C,CAAC,CAAC,OAAO;;;;;;;;;;;6BAWI,MAAA,IAAI,CAAC,KAAK,0CAAE,SAAS;8BACpB,MAAA,IAAI,CAAC,KAAK,0CAAE,WAAW;;;;;;gBAMrC,SAAS;;kBAEP,WAAW,CAAC,MAAA,IAAI,CAAC,KAAK,0CAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC;;;;gBAItD,kBAAkB;;kBAEhB,WAAW,CAAC,MAAA,IAAI,CAAC,KAAK,0CAAE,SAAS,EAAE,OAAO,EAAE,OAAO,CAAC;;;;gBAItD,WAAW;;kBAET,WAAW,CAAC,MAAA,IAAI,CAAC,KAAK,0CAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC;;;;;;KAMhE,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,MAAM,eAAe,GAAG,GAAG,CAAA,wCAAwC,CAAC;QAEpE,OAAO,GAAG,CAAA;;;yBAGW,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAoHnC,CAAC;IACJ,CAAC;CACF,CAAA;AAxL6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAAmB;AAElB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;8CAAuB;AAHvC,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAyLpB;SAzLY,QAAQ","sourcesContent":["/* eslint-disable import/no-duplicates */\nimport { css, CSSResultGroup, html, LitElement, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nimport { TileModel } from '../../models';\nimport { formatCount } from '../../utils/format-count';\n\nimport { favoriteFilledIcon } from './icons/favorite-filled';\nimport { reviewsIcon } from './icons/reviews';\nimport viewsIcon from './icons/views';\n\nimport '../mediatype-icon';\nimport '../item-image';\n\n@customElement('item-tile')\nexport class ItemTile extends LitElement {\n @property({ type: Object }) model?: TileModel;\n\n @property({ type: String }) baseImageUrl?: string;\n\n render() {\n const itemTitle = this.model?.title || nothing;\n const itemCreator = this.model?.creator;\n return html`\n <div id=\"container\">\n <div id=\"title-image-container\">\n <h1 id=\"item-title\" title=${itemTitle}>${itemTitle}</h1>\n <div id=\"item-image-container\">\n <item-image .model=${this.model} .baseImageUrl=${this.baseImageUrl}>\n </item-image>\n </div>\n <div class=\"item-creator\">\n <div class=\"truncated\">\n ${itemCreator\n ? html`<span>by&nbsp;${itemCreator}</span>`\n : nothing}\n </div>\n </div>\n </div>\n\n <div class=\"hr\"></div>\n\n <div id=\"item-stats-container\">\n <div id=\"stats-holder\">\n <div class=\"col\">\n <mediatype-icon\n .mediatype=${this.model?.mediatype}\n .collection=${this.model?.collections}\n style=\"--iconHeight:25px; --iconWidth:25px;\"\n >\n </mediatype-icon>\n </div>\n <div class=\"col\">\n ${viewsIcon}\n <p class=\"status-text\">\n ${formatCount(this.model?.viewCount, 'short', 'short')}\n </p>\n </div>\n <div class=\"col\">\n ${favoriteFilledIcon}\n <p class=\"status-text\">\n ${formatCount(this.model?.itemCount, 'short', 'short')}\n </p>\n </div>\n <div class=\"col\">\n ${reviewsIcon}\n <p class=\"status-text\">\n ${formatCount(this.model?.favCount, 'short', 'short')}\n </p>\n </div>\n </div>\n </div>\n </div>\n `;\n }\n\n static get styles(): CSSResultGroup {\n const cornerRadiusCss = css`var(--collectionTileCornerRadius, 4px)`;\n\n return css`\n #container {\n background-color: #ffffff;\n border-radius: ${cornerRadiusCss};\n box-shadow: 1px 1px 2px 0px;\n display: flex;\n flex-direction: column;\n height: 100%;\n position: relative;\n }\n\n #title-image-container {\n display: flex;\n flex: 1;\n flex-direction: column;\n padding: 0.5rem 0.5rem 0 0.5rem;\n }\n\n #item-title {\n color: #2c2c2c;\n font-size: 1.6rem;\n text-align: center;\n margin-top: 0rem;\n margin-bottom: 0.5rem;\n overflow: hidden;\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n line-height: 2rem;\n height: 4rem;\n }\n\n #item-image-container {\n display: flex;\n justify-content: center;\n flex: 1;\n }\n\n .hidden {\n display: none;\n }\n\n #container:hover > #title-image-container > .item-title {\n text-decoration: underline;\n }\n\n /** this is a workaround for Safari 15 where the hover effects are not working */\n #title-image-container:hover > #item-title {\n text-decoration: underline;\n }\n\n #container:hover > #item-title {\n background-color: #fcfcfc;\n }\n\n .item-creator {\n display: flex;\n justify-content: center;\n align-items: flex-end; /* Important to start text from bottom */\n height: 3rem;\n padding-top: 1rem;\n }\n\n .truncated {\n flex: 1;\n min-width: 0; /* Important for long words! */\n }\n\n .truncated span {\n font-size: 1.4rem;\n color: #2c2c2c;\n -webkit-line-clamp: 2;\n text-overflow: ellipsis;\n overflow: hidden;\n display: -webkit-box;\n -webkit-box-orient: vertical;\n word-wrap: break-word;\n line-height: 2rem;\n text-align: center;\n }\n\n .hr {\n border: 0.5px solid #ccc;\n }\n\n #item-stats-container {\n align-items: center;\n display: flex;\n height: 5.5rem;\n padding-left: 1rem;\n padding-right: 0.5rem;\n }\n\n #stats-holder {\n align-items: center;\n display: flex;\n flex: 1;\n justify-content: space-evenly;\n text-align: center;\n width: 100%;\n }\n\n svg {\n height: 10px;\n width: 10px;\n }\n\n .status-text {\n font-size: 14px;\n color: #2c2c2c;\n margin: auto;\n display: block;\n text-align: center;\n }\n\n .col {\n width: 25%;\n }\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"item-tile.js","sourceRoot":"","sources":["../../../../src/tiles/grid/item-tile.ts"],"names":[],"mappings":"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","sourcesContent":["/* eslint-disable import/no-duplicates */\nimport { css, CSSResultGroup, html, LitElement, nothing } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { SortParam } from '@internetarchive/search-service';\n\nimport { formatDate } from '../../utils/format-date';\nimport { TileModel } from '../../models';\n\nimport '../mediatype-icon';\nimport '../item-image';\nimport './tile-stats';\n\n@customElement('item-tile')\nexport class ItemTile extends LitElement {\n @property({ type: Object }) model?: TileModel;\n\n @property({ type: String }) baseImageUrl?: string;\n\n @property({ type: Object }) sortParam?: SortParam;\n\n render() {\n const itemTitle = this.model?.title;\n return html`\n <div class=\"container\">\n <div class=\"item-info\">\n <div id=\"title\">\n <h1 class=\"truncated\" title=${ifDefined(\n itemTitle\n )}>${itemTitle}</h1>\n </div>\n\n <div id=\"image\">\n <item-image\n .model=${this.model}\n .baseImageUrl=${this.baseImageUrl}>\n </item-image>\n </div>\n ${\n this.doesSortedByDate\n ? this.sortedDateInfoTemplate\n : this.creatorTemplate\n }\n </div>\n\n <tile-stats \n .mediatype=${this.model?.mediatype}\n .viewCount=${this.model?.viewCount}\n .favCount=${this.model?.favCount}\n .commentCount=${this.model?.commentCount}>\n </tile-stats>\n </div>\n </div>\n `;\n }\n\n private get doesSortedByDate() {\n return ['date', 'reviewdate', 'addeddate', 'publicdate'].includes(\n this.sortParam?.field as string\n );\n }\n\n private get sortedDateInfoTemplate() {\n let sortedValue;\n\n switch (this.sortParam?.field) {\n case 'date':\n sortedValue = { field: 'published', value: this.model?.datePublished };\n break;\n case 'reviewdate':\n sortedValue = { field: 'reviewed', value: this.model?.dateReviewed };\n break;\n case 'addeddate':\n sortedValue = { field: 'added', value: this.model?.dateAdded };\n break;\n case 'publicdate':\n sortedValue = { field: 'archived', value: this.model?.dateArchived };\n break;\n default:\n break;\n }\n\n return html`\n <div class=\"date-sorted-by truncated\">\n <span>\n ${sortedValue?.field} ${formatDate(sortedValue?.value, 'long')}\n </span>\n </div>\n `;\n }\n\n private get creatorTemplate() {\n return html`\n <div class=\"created-by truncated\">\n ${this.model?.creator\n ? html`<span>by&nbsp;${this.model?.creator}</span>`\n : nothing}\n </div>\n `;\n }\n\n static get styles(): CSSResultGroup {\n return css`\n .container {\n background-color: #ffffff;\n border-radius: var(--collectionTileCornerRadius, 4px);\n box-shadow: 1px 1px 2px 0px;\n display: flex;\n flex-direction: column;\n height: 100%;\n }\n\n .item-info {\n padding: 5px 5px 0 5px;\n flex-grow: 1;\n }\n\n #title {\n flex-shrink: 0;\n }\n\n #image {\n display: flex;\n justify-content: center;\n flex: 1;\n height: 16rem;\n }\n\n .hidden {\n display: none;\n }\n\n .container:hover > .item-info > #title > .truncated {\n text-decoration: underline;\n }\n\n /** this is a workaround for Safari 15 where the hover effects are not working */\n #title:hover > .truncated {\n text-decoration: underline;\n }\n\n .created-by,\n .date-sorted-by {\n display: flex;\n justify-content: center;\n align-items: flex-end; /* Important to start text from bottom */\n height: 3rem;\n padding-top: 1rem;\n margin-top: 5px;\n }\n\n .truncated {\n flex: 1;\n color: #2c2c2c;\n min-width: 0; /* Important for long words! */\n text-align: center;\n line-height: 2rem;\n text-overflow: ellipsis;\n overflow: hidden;\n word-wrap: break-word;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n }\n\n .truncated span {\n font-size: 1.4rem;\n display: -webkit-box;\n }\n\n h1.truncated {\n margin-top: 0rem;\n margin-bottom: 0.5rem;\n font-size: 1.6rem;\n height: 4rem;\n display: -webkit-box;\n }\n `;\n }\n}\n"]}