@internetarchive/collection-browser 0.2.5 → 0.2.7-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/{tiles/grid → assets/img}/icons/favorite-filled.d.ts +0 -0
- package/dist/src/{tiles/grid → assets/img}/icons/favorite-filled.js +0 -0
- package/dist/src/{tiles/grid → assets/img}/icons/favorite-filled.js.map +1 -1
- package/dist/src/assets/img/icons/login-required.d.ts +1 -0
- package/dist/src/assets/img/icons/login-required.js +30 -0
- package/dist/src/assets/img/icons/login-required.js.map +1 -0
- package/dist/src/{tiles/grid → assets/img}/icons/reviews.d.ts +0 -0
- package/dist/src/{tiles/grid → assets/img}/icons/reviews.js +0 -0
- package/dist/src/{tiles/grid → assets/img}/icons/reviews.js.map +1 -1
- package/dist/src/{tiles/grid → assets/img}/icons/upload.d.ts +0 -0
- package/dist/src/{tiles/grid → assets/img}/icons/upload.js +0 -0
- package/dist/src/{tiles/grid → assets/img}/icons/upload.js.map +1 -1
- package/dist/src/assets/img/icons/views.d.ts +1 -0
- package/dist/src/{tiles/grid → assets/img}/icons/views.js +1 -1
- package/dist/src/assets/img/icons/views.js.map +1 -0
- package/dist/src/collection-browser.js +15 -10
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/tiles/grid/account-tile.d.ts +1 -0
- package/dist/src/tiles/grid/account-tile.js +45 -78
- package/dist/src/tiles/grid/account-tile.js.map +1 -1
- package/dist/src/tiles/grid/item-tile.d.ts +7 -0
- package/dist/src/tiles/grid/item-tile.js +76 -122
- package/dist/src/tiles/grid/item-tile.js.map +1 -1
- package/dist/src/tiles/grid/tile-stats.d.ts +10 -0
- package/dist/src/tiles/grid/tile-stats.js +134 -0
- package/dist/src/tiles/grid/tile-stats.js.map +1 -0
- package/dist/src/tiles/item-image.d.ts +5 -0
- package/dist/src/tiles/item-image.js +21 -3
- package/dist/src/tiles/item-image.js.map +1 -1
- package/dist/src/tiles/list/tile-list-compact.d.ts +1 -0
- package/dist/src/tiles/list/tile-list-compact.js +10 -1
- package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
- package/dist/src/tiles/list/tile-list.d.ts +1 -0
- package/dist/src/tiles/list/tile-list.js +5 -0
- package/dist/src/tiles/list/tile-list.js.map +1 -1
- package/dist/src/tiles/mediatype-icon.js +4 -0
- package/dist/src/tiles/mediatype-icon.js.map +1 -1
- package/dist/src/tiles/overlay/icon-overlay.d.ts +7 -0
- package/dist/src/tiles/overlay/icon-overlay.js +43 -0
- package/dist/src/tiles/overlay/icon-overlay.js.map +1 -0
- package/dist/src/tiles/overlay/text-overlay.d.ts +8 -0
- package/dist/src/tiles/overlay/text-overlay.js +53 -0
- package/dist/src/tiles/overlay/text-overlay.js.map +1 -0
- package/dist/src/tiles/tile-dispatcher.d.ts +1 -0
- package/dist/src/tiles/tile-dispatcher.js +7 -0
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/test/icon-overlay.test.d.ts +1 -0
- package/dist/test/icon-overlay.test.js +23 -0
- package/dist/test/icon-overlay.test.js.map +1 -0
- package/dist/test/item-image.test.d.ts +1 -0
- package/dist/test/item-image.test.js +75 -0
- package/dist/test/item-image.test.js.map +1 -0
- package/dist/test/text-overlay.test.d.ts +1 -0
- package/dist/test/text-overlay.test.js +37 -0
- package/dist/test/text-overlay.test.js.map +1 -0
- package/dist/test/tile-stats.test.d.ts +1 -0
- package/dist/test/tile-stats.test.js +42 -0
- package/dist/test/tile-stats.test.js.map +1 -0
- package/package.json +2 -2
- package/src/{tiles/grid → assets/img}/icons/favorite-filled.ts +0 -0
- package/src/assets/img/icons/login-required.ts +30 -0
- package/src/{tiles/grid → assets/img}/icons/reviews.ts +0 -0
- package/src/{tiles/grid → assets/img}/icons/upload.ts +0 -0
- package/src/{tiles/grid → assets/img}/icons/views.ts +1 -1
- package/src/collection-browser.ts +15 -10
- package/src/tiles/grid/account-tile.ts +44 -77
- package/src/tiles/grid/item-tile.ts +73 -123
- package/src/tiles/grid/tile-stats.ts +132 -0
- package/src/tiles/item-image.ts +22 -2
- package/src/tiles/list/tile-list-compact.ts +8 -1
- package/src/tiles/list/tile-list.ts +3 -0
- package/src/tiles/mediatype-icon.ts +4 -0
- package/src/tiles/overlay/icon-overlay.ts +34 -0
- package/src/tiles/overlay/text-overlay.ts +44 -0
- package/src/tiles/tile-dispatcher.ts +5 -0
- package/test/icon-overlay.test.ts +30 -0
- package/test/item-image.test.ts +85 -0
- package/test/text-overlay.test.ts +44 -0
- package/test/tile-stats.test.ts +57 -0
- package/dist/src/tiles/grid/icons/account.d.ts +0 -1
- package/dist/src/tiles/grid/icons/account.js +0 -12
- package/dist/src/tiles/grid/icons/account.js.map +0 -1
- package/dist/src/tiles/grid/icons/views.d.ts +0 -2
- package/dist/src/tiles/grid/icons/views.js.map +0 -1
- package/dist/src/tiles/item-tile-image.d.ts +0 -15
- package/dist/src/tiles/item-tile-image.js +0 -68
- package/dist/src/tiles/item-tile-image.js.map +0 -1
- package/src/tiles/grid/icons/account.ts +0 -12
- package/src/tiles/item-tile-image.ts +0 -61
|
@@ -2,10 +2,7 @@ import { css, html, LitElement } from 'lit';
|
|
|
2
2
|
import { customElement, property } from 'lit/decorators.js';
|
|
3
3
|
import { TileModel } from '../../models';
|
|
4
4
|
|
|
5
|
-
import
|
|
6
|
-
import { favoriteFilledIcon } from './icons/favorite-filled';
|
|
7
|
-
import { reviewsIcon } from './icons/reviews';
|
|
8
|
-
import { uploadIcon } from './icons/upload';
|
|
5
|
+
import './tile-stats';
|
|
9
6
|
|
|
10
7
|
@customElement('account-tile')
|
|
11
8
|
export class AccountTile extends LitElement {
|
|
@@ -13,44 +10,32 @@ export class AccountTile extends LitElement {
|
|
|
13
10
|
|
|
14
11
|
render() {
|
|
15
12
|
return html`
|
|
16
|
-
<div class="
|
|
17
|
-
<div
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
<div id="year-holder">
|
|
31
|
-
<div id="archivist-since">
|
|
32
|
-
<h3>Archivist Since</h3>
|
|
33
|
-
</div>
|
|
34
|
-
<div id="year-holder">
|
|
35
|
-
<h3>${this.model?.dateAdded?.getFullYear()}</h3>
|
|
36
|
-
</div>
|
|
37
|
-
</div>
|
|
38
|
-
<div id="status-holder">
|
|
39
|
-
<div id="patron-icon">${accountIcon}</div>
|
|
40
|
-
<div class="stat-icon">
|
|
41
|
-
${uploadIcon}
|
|
42
|
-
<h3>${this.model?.itemCount}</h3>
|
|
43
|
-
</div>
|
|
44
|
-
<div class="stat-icon">
|
|
45
|
-
${favoriteFilledIcon}
|
|
46
|
-
<h3>${this.model?.favCount}</h3>
|
|
47
|
-
</div>
|
|
48
|
-
<div class="stat-icon">
|
|
49
|
-
${reviewsIcon}
|
|
50
|
-
<h3>${this.model?.commentCount}</h3>
|
|
51
|
-
</div>
|
|
13
|
+
<div class="account-tile-main">
|
|
14
|
+
<div id="title">
|
|
15
|
+
<h1 class="truncated">${this.model?.identifier}</h1>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<div class="account-info">
|
|
19
|
+
<div id="avatar-info">
|
|
20
|
+
<img
|
|
21
|
+
id="avatar"
|
|
22
|
+
alt="patron-avatar"
|
|
23
|
+
src="https://archive.org/services/img/${this.model?.identifier}"
|
|
24
|
+
/>
|
|
52
25
|
</div>
|
|
26
|
+
|
|
27
|
+
<span id="archivist-since">
|
|
28
|
+
Archivist since ${this.model?.dateAdded?.getFullYear()}
|
|
29
|
+
</span>
|
|
53
30
|
</div>
|
|
31
|
+
|
|
32
|
+
<tile-stats
|
|
33
|
+
.mediatype=${this.model?.mediatype}
|
|
34
|
+
.itemCount=${this.model?.itemCount}
|
|
35
|
+
.favCount=${this.model?.favCount}
|
|
36
|
+
.commentCount=${this.model?.commentCount}
|
|
37
|
+
>
|
|
38
|
+
</tile-stats>
|
|
54
39
|
</div>
|
|
55
40
|
`;
|
|
56
41
|
}
|
|
@@ -63,41 +48,45 @@ export class AccountTile extends LitElement {
|
|
|
63
48
|
margin: 0;
|
|
64
49
|
}
|
|
65
50
|
|
|
66
|
-
|
|
51
|
+
span {
|
|
67
52
|
font-size: 14px;
|
|
68
|
-
font-weight: bold;
|
|
69
53
|
color: #2c2c2c;
|
|
70
54
|
margin: 0px;
|
|
71
55
|
}
|
|
72
56
|
|
|
73
|
-
.
|
|
57
|
+
.account-tile-main {
|
|
74
58
|
background-color: #fcf5e6;
|
|
75
59
|
border: 1px #2c2c2c;
|
|
76
60
|
border-radius: 4px;
|
|
77
61
|
box-shadow: 1px 1px 2px 0px;
|
|
78
62
|
height: 100%;
|
|
79
63
|
display: flex;
|
|
64
|
+
flex-direction: column;
|
|
80
65
|
text-align: center;
|
|
81
66
|
width: 100%;
|
|
82
67
|
}
|
|
83
68
|
|
|
84
|
-
.
|
|
85
|
-
|
|
86
|
-
width: 100%;
|
|
87
|
-
display: flex;
|
|
88
|
-
flex-direction: column;
|
|
69
|
+
.account-info {
|
|
70
|
+
flex-grow: 1;
|
|
89
71
|
}
|
|
90
72
|
|
|
91
|
-
#
|
|
92
|
-
|
|
73
|
+
#title {
|
|
74
|
+
padding: 5px 5px 0px 5px;
|
|
75
|
+
flex-shrink: 0;
|
|
76
|
+
height: 40px;
|
|
93
77
|
}
|
|
94
78
|
|
|
95
|
-
#title
|
|
96
|
-
|
|
97
|
-
|
|
79
|
+
.account-tile-main:hover > #title > .truncated {
|
|
80
|
+
text-decoration: underline;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** this is a workaround for Safari 15 where the hover effects are not working */
|
|
84
|
+
#title:hover > .truncated {
|
|
85
|
+
text-decoration: underline;
|
|
98
86
|
}
|
|
99
87
|
|
|
100
|
-
#avatar-
|
|
88
|
+
#avatar-info {
|
|
89
|
+
margin-top: 5px;
|
|
101
90
|
margin-bottom: 5px;
|
|
102
91
|
display: flex;
|
|
103
92
|
align-items: center;
|
|
@@ -112,27 +101,11 @@ export class AccountTile extends LitElement {
|
|
|
112
101
|
box-shadow: 1px 1px 2px #888888;
|
|
113
102
|
}
|
|
114
103
|
|
|
115
|
-
#
|
|
104
|
+
#archivist-since {
|
|
116
105
|
margin-bottom: 5px;
|
|
117
106
|
height: 40px;
|
|
118
107
|
}
|
|
119
108
|
|
|
120
|
-
#year-holder {
|
|
121
|
-
margin: 0px;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
#status-holder {
|
|
125
|
-
height: 25px;
|
|
126
|
-
display: flex;
|
|
127
|
-
justify-content: space-evenly;
|
|
128
|
-
line-height: initial;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
#patron-icon {
|
|
132
|
-
height: 25px;
|
|
133
|
-
width: 25px;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
109
|
.truncated {
|
|
137
110
|
flex: 1;
|
|
138
111
|
min-width: 0; /* Important for long words! */
|
|
@@ -142,15 +115,9 @@ export class AccountTile extends LitElement {
|
|
|
142
115
|
display: -webkit-box;
|
|
143
116
|
-webkit-box-orient: vertical;
|
|
144
117
|
word-wrap: break-word;
|
|
145
|
-
word-break: break-all;
|
|
146
118
|
line-height: 2rem;
|
|
147
119
|
text-align: center;
|
|
148
120
|
}
|
|
149
|
-
|
|
150
|
-
.stat-icon {
|
|
151
|
-
height: 10px;
|
|
152
|
-
width: 10px;
|
|
153
|
-
}
|
|
154
121
|
`;
|
|
155
122
|
}
|
|
156
123
|
}
|
|
@@ -1,200 +1,150 @@
|
|
|
1
1
|
/* eslint-disable import/no-duplicates */
|
|
2
2
|
import { css, CSSResultGroup, html, LitElement, nothing } from 'lit';
|
|
3
3
|
import { customElement, property } from 'lit/decorators.js';
|
|
4
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
4
5
|
|
|
5
6
|
import { TileModel } from '../../models';
|
|
6
|
-
import { formatCount } from '../../utils/format-count';
|
|
7
|
-
|
|
8
|
-
import { favoriteFilledIcon } from './icons/favorite-filled';
|
|
9
|
-
import { reviewsIcon } from './icons/reviews';
|
|
10
|
-
import viewsIcon from './icons/views';
|
|
11
7
|
|
|
12
8
|
import '../mediatype-icon';
|
|
13
9
|
import '../item-image';
|
|
10
|
+
import './tile-stats';
|
|
11
|
+
import '../overlay/text-overlay';
|
|
14
12
|
|
|
15
13
|
@customElement('item-tile')
|
|
16
14
|
export class ItemTile extends LitElement {
|
|
15
|
+
@property({ type: Boolean }) loggedIn = false;
|
|
16
|
+
|
|
17
17
|
@property({ type: Object }) model?: TileModel;
|
|
18
18
|
|
|
19
19
|
@property({ type: String }) baseImageUrl?: string;
|
|
20
20
|
|
|
21
21
|
render() {
|
|
22
|
-
const itemTitle = this.model?.title
|
|
22
|
+
const itemTitle = this.model?.title;
|
|
23
23
|
const itemCreator = this.model?.creator;
|
|
24
|
+
|
|
24
25
|
return html`
|
|
25
|
-
<div
|
|
26
|
-
<div
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
<div class="container">
|
|
27
|
+
<div class="item-info">
|
|
28
|
+
<div id="title">
|
|
29
|
+
<h1 class="truncated" title=${ifDefined(
|
|
30
|
+
itemTitle
|
|
31
|
+
)}>${itemTitle}</h1>
|
|
32
|
+
</div>
|
|
33
|
+
|
|
34
|
+
<div id="image">
|
|
35
|
+
<item-image
|
|
36
|
+
.model=${this.model}
|
|
37
|
+
.baseImageUrl=${this.baseImageUrl}>
|
|
30
38
|
</item-image>
|
|
39
|
+
${this.textOverlayTemplate}
|
|
31
40
|
</div>
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
? html`<span>by ${itemCreator}</span>`
|
|
36
|
-
: nothing}
|
|
37
|
-
</div>
|
|
41
|
+
|
|
42
|
+
<div class="created-by truncated">
|
|
43
|
+
${itemCreator ? html`<span>by ${itemCreator}</span>` : nothing}
|
|
38
44
|
</div>
|
|
39
45
|
</div>
|
|
40
46
|
|
|
41
|
-
<
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
.mediatype=${this.model?.mediatype}
|
|
48
|
-
.collection=${this.model?.collections}
|
|
49
|
-
style="--iconHeight:25px; --iconWidth:25px;"
|
|
50
|
-
>
|
|
51
|
-
</mediatype-icon>
|
|
52
|
-
</div>
|
|
53
|
-
<div class="col">
|
|
54
|
-
${viewsIcon}
|
|
55
|
-
<p class="status-text">
|
|
56
|
-
${formatCount(this.model?.viewCount, 'short', 'short')}
|
|
57
|
-
</p>
|
|
58
|
-
</div>
|
|
59
|
-
<div class="col">
|
|
60
|
-
${favoriteFilledIcon}
|
|
61
|
-
<p class="status-text">
|
|
62
|
-
${formatCount(this.model?.itemCount, 'short', 'short')}
|
|
63
|
-
</p>
|
|
64
|
-
</div>
|
|
65
|
-
<div class="col">
|
|
66
|
-
${reviewsIcon}
|
|
67
|
-
<p class="status-text">
|
|
68
|
-
${formatCount(this.model?.favCount, 'short', 'short')}
|
|
69
|
-
</p>
|
|
70
|
-
</div>
|
|
71
|
-
</div>
|
|
47
|
+
<tile-stats
|
|
48
|
+
.mediatype=${this.model?.mediatype}
|
|
49
|
+
.viewCount=${this.model?.viewCount}
|
|
50
|
+
.favCount=${this.model?.favCount}
|
|
51
|
+
.commentCount=${this.model?.commentCount}>
|
|
52
|
+
</tile-stats>
|
|
72
53
|
</div>
|
|
73
54
|
</div>
|
|
74
55
|
`;
|
|
75
56
|
}
|
|
76
57
|
|
|
77
|
-
|
|
78
|
-
|
|
58
|
+
/**
|
|
59
|
+
* Templates
|
|
60
|
+
*/
|
|
61
|
+
private get textOverlayTemplate() {
|
|
62
|
+
if (!this.model?.loginRequired && !this.model?.contentWarning) {
|
|
63
|
+
return nothing;
|
|
64
|
+
}
|
|
65
|
+
return html`
|
|
66
|
+
<text-overlay
|
|
67
|
+
.loggedIn=${this.loggedIn}
|
|
68
|
+
.loginRequired=${this.model?.loginRequired}
|
|
69
|
+
.contentWarning=${this.model?.contentWarning}
|
|
70
|
+
></text-overlay>
|
|
71
|
+
`;
|
|
72
|
+
}
|
|
79
73
|
|
|
74
|
+
static get styles(): CSSResultGroup {
|
|
80
75
|
return css`
|
|
81
|
-
|
|
76
|
+
.container {
|
|
82
77
|
background-color: #ffffff;
|
|
83
|
-
border-radius:
|
|
78
|
+
border-radius: var(--collectionTileCornerRadius, 4px);
|
|
84
79
|
box-shadow: 1px 1px 2px 0px;
|
|
85
80
|
display: flex;
|
|
86
81
|
flex-direction: column;
|
|
87
82
|
height: 100%;
|
|
88
|
-
position: relative;
|
|
89
83
|
}
|
|
90
84
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
flex: 1;
|
|
94
|
-
flex-direction: column;
|
|
95
|
-
padding: 0.5rem 0.5rem 0 0.5rem;
|
|
85
|
+
.item-info {
|
|
86
|
+
padding: 5px 5px 0 5px;
|
|
87
|
+
flex-grow: 1;
|
|
96
88
|
}
|
|
97
89
|
|
|
98
|
-
#
|
|
99
|
-
|
|
100
|
-
font-size: 1.6rem;
|
|
101
|
-
text-align: center;
|
|
102
|
-
margin-top: 0rem;
|
|
103
|
-
margin-bottom: 0.5rem;
|
|
104
|
-
overflow: hidden;
|
|
105
|
-
text-overflow: ellipsis;
|
|
106
|
-
display: -webkit-box;
|
|
107
|
-
-webkit-line-clamp: 2;
|
|
108
|
-
-webkit-box-orient: vertical;
|
|
109
|
-
line-height: 2rem;
|
|
110
|
-
height: 4rem;
|
|
90
|
+
#title {
|
|
91
|
+
flex-shrink: 0;
|
|
111
92
|
}
|
|
112
93
|
|
|
113
|
-
#
|
|
94
|
+
#image {
|
|
114
95
|
display: flex;
|
|
115
96
|
justify-content: center;
|
|
116
97
|
flex: 1;
|
|
98
|
+
height: 16rem;
|
|
99
|
+
position: relative;
|
|
117
100
|
}
|
|
118
101
|
|
|
119
102
|
.hidden {
|
|
120
103
|
display: none;
|
|
121
104
|
}
|
|
122
105
|
|
|
123
|
-
|
|
106
|
+
.container:hover > .item-info > #title > .truncated {
|
|
124
107
|
text-decoration: underline;
|
|
125
108
|
}
|
|
126
109
|
|
|
127
110
|
/** this is a workaround for Safari 15 where the hover effects are not working */
|
|
128
|
-
#title
|
|
111
|
+
#title:hover > .truncated {
|
|
129
112
|
text-decoration: underline;
|
|
130
113
|
}
|
|
131
114
|
|
|
132
|
-
|
|
133
|
-
background-color: #fcfcfc;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
.item-creator {
|
|
115
|
+
.created-by {
|
|
137
116
|
display: flex;
|
|
138
117
|
justify-content: center;
|
|
139
118
|
align-items: flex-end; /* Important to start text from bottom */
|
|
140
119
|
height: 3rem;
|
|
141
120
|
padding-top: 1rem;
|
|
121
|
+
margin-top: 5px;
|
|
142
122
|
}
|
|
143
123
|
|
|
144
124
|
.truncated {
|
|
145
125
|
flex: 1;
|
|
146
|
-
min-width: 0; /* Important for long words! */
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
.truncated span {
|
|
150
|
-
font-size: 1.4rem;
|
|
151
126
|
color: #2c2c2c;
|
|
152
|
-
-
|
|
127
|
+
min-width: 0; /* Important for long words! */
|
|
128
|
+
text-align: center;
|
|
129
|
+
line-height: 2rem;
|
|
153
130
|
text-overflow: ellipsis;
|
|
154
131
|
overflow: hidden;
|
|
155
|
-
display: -webkit-box;
|
|
156
|
-
-webkit-box-orient: vertical;
|
|
157
132
|
word-wrap: break-word;
|
|
158
|
-
line-
|
|
159
|
-
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.hr {
|
|
163
|
-
border: 0.5px solid #ccc;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
#item-stats-container {
|
|
167
|
-
align-items: center;
|
|
168
|
-
display: flex;
|
|
169
|
-
height: 5.5rem;
|
|
170
|
-
padding-left: 1rem;
|
|
171
|
-
padding-right: 0.5rem;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
#stats-holder {
|
|
175
|
-
align-items: center;
|
|
176
|
-
display: flex;
|
|
177
|
-
flex: 1;
|
|
178
|
-
justify-content: space-evenly;
|
|
179
|
-
text-align: center;
|
|
180
|
-
width: 100%;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
svg {
|
|
184
|
-
height: 10px;
|
|
185
|
-
width: 10px;
|
|
133
|
+
-webkit-line-clamp: 2;
|
|
134
|
+
-webkit-box-orient: vertical;
|
|
186
135
|
}
|
|
187
136
|
|
|
188
|
-
.
|
|
189
|
-
font-size:
|
|
190
|
-
|
|
191
|
-
margin: auto;
|
|
192
|
-
display: block;
|
|
193
|
-
text-align: center;
|
|
137
|
+
.truncated span {
|
|
138
|
+
font-size: 1.4rem;
|
|
139
|
+
display: -webkit-box;
|
|
194
140
|
}
|
|
195
141
|
|
|
196
|
-
.
|
|
197
|
-
|
|
142
|
+
h1.truncated {
|
|
143
|
+
margin-top: 0rem;
|
|
144
|
+
margin-bottom: 0.5rem;
|
|
145
|
+
font-size: 1.6rem;
|
|
146
|
+
height: 4rem;
|
|
147
|
+
display: -webkit-box;
|
|
198
148
|
}
|
|
199
149
|
`;
|
|
200
150
|
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { css, CSSResultGroup, html, LitElement } from 'lit';
|
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
3
|
+
|
|
4
|
+
import { favoriteFilledIcon } from '../../assets/img/icons/favorite-filled';
|
|
5
|
+
import { reviewsIcon } from '../../assets/img/icons/reviews';
|
|
6
|
+
import { uploadIcon } from '../../assets/img/icons/upload';
|
|
7
|
+
import { viewsIcon } from '../../assets/img/icons/views';
|
|
8
|
+
|
|
9
|
+
import { formatCount } from '../../utils/format-count';
|
|
10
|
+
|
|
11
|
+
@customElement('tile-stats')
|
|
12
|
+
export class TileStats extends LitElement {
|
|
13
|
+
@property({ type: String }) mediatype?: string;
|
|
14
|
+
|
|
15
|
+
@property({ type: Number }) itemCount?: number;
|
|
16
|
+
|
|
17
|
+
@property({ type: Number }) viewCount?: number;
|
|
18
|
+
|
|
19
|
+
@property({ type: Number }) favCount?: number;
|
|
20
|
+
|
|
21
|
+
@property({ type: Number }) commentCount?: number;
|
|
22
|
+
|
|
23
|
+
render() {
|
|
24
|
+
return html`
|
|
25
|
+
<div class="item-stats">
|
|
26
|
+
<p class="sr-only">
|
|
27
|
+
${this.mediatype === 'account' ? 'Account Stats' : 'Item Stats'}
|
|
28
|
+
</p>
|
|
29
|
+
<ul id="stats-row">
|
|
30
|
+
<li class="col">
|
|
31
|
+
<p class="sr-only">Mediatype:</p>
|
|
32
|
+
<mediatype-icon .mediatype=${this.mediatype}></mediatype-icon>
|
|
33
|
+
</li>
|
|
34
|
+
<li class="col">
|
|
35
|
+
${this.mediatype === 'account' ? uploadIcon : viewsIcon}
|
|
36
|
+
<p class="status-text">
|
|
37
|
+
<span class="sr-only">
|
|
38
|
+
${this.mediatype === 'account' ? 'Uploads:' : 'Views:'}
|
|
39
|
+
</span>
|
|
40
|
+
${formatCount(
|
|
41
|
+
this.mediatype === 'account' ? this.itemCount : this.viewCount,
|
|
42
|
+
'short',
|
|
43
|
+
'short'
|
|
44
|
+
)}
|
|
45
|
+
</p>
|
|
46
|
+
</li>
|
|
47
|
+
<li class="col">
|
|
48
|
+
${favoriteFilledIcon}
|
|
49
|
+
<p class="status-text">
|
|
50
|
+
<span class="sr-only">Favorites:</span>
|
|
51
|
+
${formatCount(this.favCount, 'short', 'short')}
|
|
52
|
+
</p>
|
|
53
|
+
</li>
|
|
54
|
+
<li class="col">
|
|
55
|
+
${reviewsIcon}
|
|
56
|
+
<p class="status-text">
|
|
57
|
+
<span class="sr-only">Reviews:</span>
|
|
58
|
+
${formatCount(this.commentCount, 'short', 'short')}
|
|
59
|
+
</p>
|
|
60
|
+
</li>
|
|
61
|
+
</ul>
|
|
62
|
+
</div>
|
|
63
|
+
`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static get styles(): CSSResultGroup {
|
|
67
|
+
return css`
|
|
68
|
+
mediatype-icon {
|
|
69
|
+
--iconHeight: 25px;
|
|
70
|
+
--iconWidth: 25px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
ul {
|
|
74
|
+
all: unset; // unset all property values
|
|
75
|
+
list-style-type: none; // remove default list-style
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
li {
|
|
79
|
+
list-style-type: none; // remove default list-style
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.item-stats {
|
|
83
|
+
height: 35px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
#stats-row {
|
|
87
|
+
border-top: 1px solid #bbb;
|
|
88
|
+
align-items: center;
|
|
89
|
+
display: flex;
|
|
90
|
+
flex: 1;
|
|
91
|
+
justify-content: space-evenly;
|
|
92
|
+
text-align: center;
|
|
93
|
+
width: 100%;
|
|
94
|
+
padding-top: 5px;
|
|
95
|
+
padding-bottom: 5px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.sr-only {
|
|
99
|
+
position: absolute;
|
|
100
|
+
width: 1px;
|
|
101
|
+
height: 1px;
|
|
102
|
+
padding: 0;
|
|
103
|
+
margin: -1px;
|
|
104
|
+
overflow: hidden;
|
|
105
|
+
clip: rect(0, 0, 0, 0);
|
|
106
|
+
border: 0;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.col {
|
|
110
|
+
width: 25%;
|
|
111
|
+
height: 25px;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
svg {
|
|
115
|
+
height: 10px;
|
|
116
|
+
width: 10px;
|
|
117
|
+
display: block;
|
|
118
|
+
margin: auto;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.status-text {
|
|
122
|
+
font-size: 14px;
|
|
123
|
+
height: 15px;
|
|
124
|
+
color: #2c2c2c;
|
|
125
|
+
line-height: 20px;
|
|
126
|
+
margin: auto;
|
|
127
|
+
display: block;
|
|
128
|
+
text-align: center;
|
|
129
|
+
}
|
|
130
|
+
`;
|
|
131
|
+
}
|
|
132
|
+
}
|
package/src/tiles/item-image.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { css, CSSResultGroup, html, LitElement } from 'lit';
|
|
1
|
+
import { css, CSSResultGroup, html, LitElement, nothing } from 'lit';
|
|
2
2
|
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
3
3
|
import { ClassInfo, classMap } from 'lit/directives/class-map.js';
|
|
4
4
|
|
|
@@ -9,6 +9,8 @@ import {
|
|
|
9
9
|
waveformGradientStyles,
|
|
10
10
|
} from '../styles/item-image-styles';
|
|
11
11
|
|
|
12
|
+
import './overlay/icon-overlay';
|
|
13
|
+
|
|
12
14
|
@customElement('item-image')
|
|
13
15
|
export class ItemImage extends LitElement {
|
|
14
16
|
@property({ type: Object }) model?: TileModel;
|
|
@@ -34,10 +36,26 @@ export class ItemImage extends LitElement {
|
|
|
34
36
|
alt=""
|
|
35
37
|
@load=${this.onLoad}
|
|
36
38
|
/>
|
|
39
|
+
${this.iconOverlayTemplate}
|
|
37
40
|
</div>
|
|
38
41
|
`;
|
|
39
42
|
}
|
|
40
43
|
|
|
44
|
+
/**
|
|
45
|
+
* Templates
|
|
46
|
+
*/
|
|
47
|
+
private get iconOverlayTemplate() {
|
|
48
|
+
if (!this.model?.loginRequired && !this.model?.contentWarning) {
|
|
49
|
+
return nothing;
|
|
50
|
+
}
|
|
51
|
+
return html`
|
|
52
|
+
<icon-overlay
|
|
53
|
+
.loggedIn=${this.loggedIn}
|
|
54
|
+
.loginRequired=${this.model?.loginRequired}
|
|
55
|
+
></icon-overlay>
|
|
56
|
+
`;
|
|
57
|
+
}
|
|
58
|
+
|
|
41
59
|
/**
|
|
42
60
|
* Helpers
|
|
43
61
|
*/
|
|
@@ -71,10 +89,12 @@ export class ItemImage extends LitElement {
|
|
|
71
89
|
}
|
|
72
90
|
|
|
73
91
|
private get itemImageClass(): ClassInfo {
|
|
92
|
+
const toBlur = this.model?.contentWarning || this.model?.loginRequired;
|
|
93
|
+
|
|
74
94
|
return {
|
|
75
95
|
contain: !this.isCompactTile && !this.isWaveform,
|
|
76
96
|
cover: this.isCompactTile,
|
|
77
|
-
blur:
|
|
97
|
+
blur: toBlur || false,
|
|
78
98
|
waveform: this.isWaveform,
|
|
79
99
|
};
|
|
80
100
|
}
|
|
@@ -28,6 +28,8 @@ export class TileListCompact extends LitElement {
|
|
|
28
28
|
|
|
29
29
|
@property({ type: String }) baseImageUrl?: string;
|
|
30
30
|
|
|
31
|
+
@property({ type: Boolean }) loggedIn = false;
|
|
32
|
+
|
|
31
33
|
render() {
|
|
32
34
|
return html`
|
|
33
35
|
<div id="list-line" class="${this.classSize}">
|
|
@@ -65,7 +67,7 @@ export class TileListCompact extends LitElement {
|
|
|
65
67
|
.baseImageUrl=${this.baseImageUrl}
|
|
66
68
|
.isListTile=${true}
|
|
67
69
|
.isCompactTile=${true}
|
|
68
|
-
|
|
70
|
+
.loggedIn=${this.loggedIn}
|
|
69
71
|
>
|
|
70
72
|
</item-image>
|
|
71
73
|
`;
|
|
@@ -205,6 +207,11 @@ export class TileListCompact extends LitElement {
|
|
|
205
207
|
--iconHeight: 20px;
|
|
206
208
|
--iconWidth: 20px;
|
|
207
209
|
}
|
|
210
|
+
|
|
211
|
+
item-image {
|
|
212
|
+
--imgHeight: 100%;
|
|
213
|
+
--imgWidth: 100%;
|
|
214
|
+
}
|
|
208
215
|
`;
|
|
209
216
|
}
|
|
210
217
|
}
|
|
@@ -45,6 +45,8 @@ export class TileList extends LitElement {
|
|
|
45
45
|
|
|
46
46
|
@property({ type: String }) baseImageUrl?: string;
|
|
47
47
|
|
|
48
|
+
@property({ type: Boolean }) loggedIn = false;
|
|
49
|
+
|
|
48
50
|
protected updated(changed: PropertyValues): void {
|
|
49
51
|
if (changed.has('model')) {
|
|
50
52
|
this.fetchCollectionNames();
|
|
@@ -147,6 +149,7 @@ export class TileList extends LitElement {
|
|
|
147
149
|
.model=${this.model}
|
|
148
150
|
.baseImageUrl=${this.baseImageUrl}
|
|
149
151
|
.isListTile=${true}
|
|
152
|
+
.loggedIn=${this.loggedIn}
|
|
150
153
|
style="--imgHeight: 100%; --imgWidth: 100%"
|
|
151
154
|
>
|
|
152
155
|
</item-image>
|