@internetarchive/collection-browser 2.10.1-alpha-webdev7479.10 → 2.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/assets/img/icons/close-circle-dark.d.ts +2 -0
- package/dist/src/assets/img/icons/close-circle-dark.js +5 -0
- package/dist/src/assets/img/icons/close-circle-dark.js.map +1 -0
- package/dist/src/collection-browser.d.ts +8 -4
- package/dist/src/collection-browser.js +35 -21
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js +1 -1
- package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.d.ts +3 -2
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +36 -13
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-button.js +26 -10
- package/dist/src/collection-facets/smart-facets/smart-facet-button.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +19 -9
- package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source.js +5 -18
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/src/data-source/collection-browser-query-state.d.ts +0 -1
- package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
- package/dist/src/models.d.ts +0 -2
- package/dist/src/models.js +5 -9
- package/dist/src/models.js.map +1 -1
- package/dist/src/restoration-state-handler.d.ts +2 -6
- package/dist/src/restoration-state-handler.js +11 -27
- package/dist/src/restoration-state-handler.js.map +1 -1
- package/dist/src/tiles/grid/item-tile.d.ts +0 -1
- package/dist/src/tiles/grid/item-tile.js +1 -7
- package/dist/src/tiles/grid/item-tile.js.map +1 -1
- package/dist/src/tiles/grid/tile-stats.d.ts +2 -46
- package/dist/src/tiles/grid/tile-stats.js +41 -92
- package/dist/src/tiles/grid/tile-stats.js.map +1 -1
- package/dist/src/tiles/item-image.js +3 -6
- package/dist/src/tiles/item-image.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.d.ts +0 -1
- package/dist/src/tiles/tile-dispatcher.js +0 -5
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/test/collection-browser.test.js +14 -0
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/restoration-state-handler.test.js +4 -4
- package/dist/test/restoration-state-handler.test.js.map +1 -1
- package/package.json +2 -2
- package/src/assets/img/icons/close-circle-dark.ts +5 -0
- package/src/collection-browser.ts +40 -20
- package/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.ts +4 -1
- package/src/collection-facets/smart-facets/smart-facet-bar.ts +38 -16
- package/src/collection-facets/smart-facets/smart-facet-button.ts +27 -10
- package/src/collection-facets/smart-facets/smart-facet-dropdown.ts +21 -10
- package/src/data-source/collection-browser-data-source.ts +3 -17
- package/src/data-source/collection-browser-query-state.ts +0 -1
- package/src/models.ts +0 -8
- package/src/restoration-state-handler.ts +11 -40
- package/src/tiles/grid/item-tile.ts +0 -4
- package/src/tiles/grid/tile-stats.ts +52 -106
- package/src/tiles/item-image.ts +0 -3
- package/src/tiles/tile-dispatcher.ts +0 -3
- package/test/collection-browser.test.ts +19 -0
- package/test/restoration-state-handler.test.ts +4 -4
- package/dist/src/assets/img/icons/quote.d.ts +0 -1
- package/dist/src/assets/img/icons/quote.js +0 -7
- package/dist/src/assets/img/icons/quote.js.map +0 -1
- package/src/assets/img/icons/quote.ts +0 -7
|
@@ -586,20 +586,14 @@ export class CollectionBrowserDataSource
|
|
|
586
586
|
const isCollectionSearch = !!this.host.withinCollection;
|
|
587
587
|
const isProfileSearch = !!this.host.withinProfile;
|
|
588
588
|
const hasProfileElement = !!this.host.profileElement;
|
|
589
|
-
const isDefaultedSearch = this.host.searchType === SearchType.DEFAULT;
|
|
590
589
|
const isMetadataSearch = this.host.searchType === SearchType.METADATA;
|
|
591
|
-
const isTvSearch = this.host.searchType === SearchType.TV;
|
|
592
590
|
|
|
593
|
-
// Metadata
|
|
594
|
-
// Searches within a profile page may also be performed without a query, provided the profile element is set.
|
|
591
|
+
// Metadata searches within a collection/profile are allowed to have no query.
|
|
595
592
|
// Otherwise, a non-empty query must be set.
|
|
596
593
|
return (
|
|
597
594
|
hasNonEmptyQuery ||
|
|
598
|
-
(isCollectionSearch &&
|
|
599
|
-
|
|
600
|
-
(isProfileSearch &&
|
|
601
|
-
hasProfileElement &&
|
|
602
|
-
(isDefaultedSearch || isMetadataSearch))
|
|
595
|
+
(isCollectionSearch && isMetadataSearch) ||
|
|
596
|
+
(isProfileSearch && hasProfileElement && isMetadataSearch)
|
|
603
597
|
);
|
|
604
598
|
}
|
|
605
599
|
|
|
@@ -1138,14 +1132,6 @@ export class CollectionBrowserDataSource
|
|
|
1138
1132
|
this.parentCollections = [].concat(
|
|
1139
1133
|
this.collectionExtraInfo.public_metadata?.collection ?? [],
|
|
1140
1134
|
);
|
|
1141
|
-
|
|
1142
|
-
// Update the TV collection status now that we know the parent collections
|
|
1143
|
-
this.host.isTVCollection =
|
|
1144
|
-
this.host.withinCollection?.startsWith('TV-') ||
|
|
1145
|
-
this.host.withinCollection === 'tvnews' ||
|
|
1146
|
-
this.host.withinCollection === 'tvarchive' ||
|
|
1147
|
-
this.parentCollections.includes('tvnews') ||
|
|
1148
|
-
this.parentCollections.includes('tvarchive');
|
|
1149
1135
|
}
|
|
1150
1136
|
} else if (withinProfile) {
|
|
1151
1137
|
this.accountExtraInfo = success.response.accountExtraInfo;
|
|
@@ -34,7 +34,6 @@ export interface CollectionBrowserQueryState {
|
|
|
34
34
|
export interface CollectionBrowserSearchInterface
|
|
35
35
|
extends CollectionBrowserQueryState {
|
|
36
36
|
searchService?: SearchServiceInterface;
|
|
37
|
-
isTVCollection: boolean;
|
|
38
37
|
readonly sortParam: SortParam | null;
|
|
39
38
|
readonly defaultSortField: SortField | null;
|
|
40
39
|
readonly facetLoadStrategy: FacetLoadStrategy;
|
package/src/models.ts
CHANGED
|
@@ -94,12 +94,8 @@ export class TileModel {
|
|
|
94
94
|
|
|
95
95
|
subjects: string[];
|
|
96
96
|
|
|
97
|
-
thumbnailUrl?: string;
|
|
98
|
-
|
|
99
97
|
title: string;
|
|
100
98
|
|
|
101
|
-
tvClipCount?: number;
|
|
102
|
-
|
|
103
99
|
viewCount?: number;
|
|
104
100
|
|
|
105
101
|
volume?: string;
|
|
@@ -139,9 +135,7 @@ export class TileModel {
|
|
|
139
135
|
this.snippets = result.highlight?.values ?? [];
|
|
140
136
|
this.source = result.source?.value;
|
|
141
137
|
this.subjects = result.subject?.values ?? [];
|
|
142
|
-
this.thumbnailUrl = result.__img__?.value;
|
|
143
138
|
this.title = result.title?.value ?? '';
|
|
144
|
-
this.tvClipCount = result.num_clips?.value ?? 0;
|
|
145
139
|
this.volume = result.volume?.value;
|
|
146
140
|
this.viewCount = result.downloads?.value;
|
|
147
141
|
this.weeklyViewCount = result.week?.value;
|
|
@@ -178,9 +172,7 @@ export class TileModel {
|
|
|
178
172
|
cloned.snippets = this.snippets;
|
|
179
173
|
cloned.source = this.source;
|
|
180
174
|
cloned.subjects = this.subjects;
|
|
181
|
-
cloned.thumbnailUrl = this.thumbnailUrl;
|
|
182
175
|
cloned.title = this.title;
|
|
183
|
-
cloned.tvClipCount = this.tvClipCount;
|
|
184
176
|
cloned.volume = this.volume;
|
|
185
177
|
cloned.viewCount = this.viewCount;
|
|
186
178
|
cloned.weeklyViewCount = this.weeklyViewCount;
|
|
@@ -30,16 +30,8 @@ export interface RestorationState {
|
|
|
30
30
|
selectedCreatorFilter?: string;
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
export interface RestorationStatePersistOptions {
|
|
34
|
-
forceReplace?: boolean;
|
|
35
|
-
persistMetadataSearchType?: boolean;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
33
|
export interface RestorationStateHandlerInterface {
|
|
39
|
-
persistState(
|
|
40
|
-
state: RestorationState,
|
|
41
|
-
options?: RestorationStatePersistOptions,
|
|
42
|
-
): void;
|
|
34
|
+
persistState(state: RestorationState, forceReplace?: boolean): void;
|
|
43
35
|
getRestorationState(): RestorationState;
|
|
44
36
|
}
|
|
45
37
|
|
|
@@ -58,12 +50,9 @@ export class RestorationStateHandler
|
|
|
58
50
|
this.context = options.context;
|
|
59
51
|
}
|
|
60
52
|
|
|
61
|
-
persistState(
|
|
62
|
-
state: RestorationState,
|
|
63
|
-
options: RestorationStatePersistOptions = {},
|
|
64
|
-
): void {
|
|
53
|
+
persistState(state: RestorationState, forceReplace = false): void {
|
|
65
54
|
if (state.displayMode) this.persistViewStateToCookies(state.displayMode);
|
|
66
|
-
this.persistQueryStateToUrl(state,
|
|
55
|
+
this.persistQueryStateToUrl(state, forceReplace);
|
|
67
56
|
}
|
|
68
57
|
|
|
69
58
|
getRestorationState(): RestorationState {
|
|
@@ -98,7 +87,7 @@ export class RestorationStateHandler
|
|
|
98
87
|
|
|
99
88
|
private persistQueryStateToUrl(
|
|
100
89
|
state: RestorationState,
|
|
101
|
-
|
|
90
|
+
forceReplace = false,
|
|
102
91
|
) {
|
|
103
92
|
const url = new URL(window.location.href);
|
|
104
93
|
const oldParams = new URLSearchParams(url.searchParams);
|
|
@@ -110,24 +99,11 @@ export class RestorationStateHandler
|
|
|
110
99
|
newParams.set('query', state.baseQuery);
|
|
111
100
|
}
|
|
112
101
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
case SearchType.RADIO:
|
|
118
|
-
newParams.set('sin', 'RADIO');
|
|
119
|
-
break;
|
|
120
|
-
case SearchType.TV:
|
|
121
|
-
newParams.set('sin', 'TV');
|
|
122
|
-
break;
|
|
123
|
-
case SearchType.METADATA:
|
|
124
|
-
// Only write the param for metadata when it isn't already the default.
|
|
125
|
-
// Currently this is only the case within TV collections.
|
|
126
|
-
if (options.persistMetadataSearchType || oldParams.get('sin') === 'MD')
|
|
127
|
-
newParams.set('sin', 'MD');
|
|
128
|
-
break;
|
|
102
|
+
if (state.searchType === SearchType.FULLTEXT) {
|
|
103
|
+
newParams.set('sin', 'TXT');
|
|
104
|
+
} else if (state.searchType === SearchType.RADIO) {
|
|
105
|
+
newParams.set('sin', 'RADIO');
|
|
129
106
|
}
|
|
130
|
-
|
|
131
107
|
if (oldParams.get('sin') === '') {
|
|
132
108
|
// Treat empty sin the same as no sin at all
|
|
133
109
|
oldParams.delete('sin');
|
|
@@ -204,7 +180,7 @@ export class RestorationStateHandler
|
|
|
204
180
|
// - If the state has changed, we push a new history entry.
|
|
205
181
|
// - If only the page number has changed, we replace the current history entry.
|
|
206
182
|
// - If the state hasn't changed, then do nothing.
|
|
207
|
-
let historyMethod: 'pushState' | 'replaceState' =
|
|
183
|
+
let historyMethod: 'pushState' | 'replaceState' = forceReplace
|
|
208
184
|
? 'replaceState'
|
|
209
185
|
: 'pushState';
|
|
210
186
|
const nonQueryParamsMatch = this.paramsMatch(oldParams, newParams, [
|
|
@@ -285,20 +261,15 @@ export class RestorationStateHandler
|
|
|
285
261
|
}
|
|
286
262
|
|
|
287
263
|
switch (searchInside) {
|
|
264
|
+
// Eventually there will be TV/Radio search types here too.
|
|
288
265
|
case 'TXT':
|
|
289
266
|
restorationState.searchType = SearchType.FULLTEXT;
|
|
290
267
|
break;
|
|
291
268
|
case 'RADIO':
|
|
292
269
|
restorationState.searchType = SearchType.RADIO;
|
|
293
270
|
break;
|
|
294
|
-
case 'TV':
|
|
295
|
-
restorationState.searchType = SearchType.TV;
|
|
296
|
-
break;
|
|
297
|
-
case 'MD':
|
|
298
|
-
restorationState.searchType = SearchType.METADATA;
|
|
299
|
-
break;
|
|
300
271
|
default:
|
|
301
|
-
restorationState.searchType = SearchType.
|
|
272
|
+
restorationState.searchType = SearchType.METADATA;
|
|
302
273
|
break;
|
|
303
274
|
}
|
|
304
275
|
|
|
@@ -36,8 +36,6 @@ export class ItemTile extends BaseTileComponent {
|
|
|
36
36
|
|
|
37
37
|
@property({ type: Boolean }) showInfoButton = false;
|
|
38
38
|
|
|
39
|
-
@property({ type: Boolean }) showTvClips = false;
|
|
40
|
-
|
|
41
39
|
render() {
|
|
42
40
|
const itemTitle = this.model?.title;
|
|
43
41
|
const effectiveSort = this.sortParam ?? this.defaultSortParam;
|
|
@@ -73,8 +71,6 @@ export class ItemTile extends BaseTileComponent {
|
|
|
73
71
|
.viewLabel=${viewLabel}
|
|
74
72
|
.favCount=${this.model?.favCount}
|
|
75
73
|
.commentCount=${this.model?.commentCount}
|
|
76
|
-
.tvClipCount=${this.model?.tvClipCount}
|
|
77
|
-
.showTvClips=${this.showTvClips}
|
|
78
74
|
>
|
|
79
75
|
</tile-stats>
|
|
80
76
|
</div>
|
|
@@ -1,142 +1,88 @@
|
|
|
1
|
-
import { css, CSSResultGroup, html, LitElement
|
|
1
|
+
import { css, CSSResultGroup, html, LitElement } from 'lit';
|
|
2
2
|
import { customElement, property } from 'lit/decorators.js';
|
|
3
3
|
|
|
4
4
|
import { msg } from '@lit/localize';
|
|
5
|
-
import { favoriteFilledIcon
|
|
5
|
+
import { favoriteFilledIcon } from '../../assets/img/icons/favorite-filled';
|
|
6
6
|
import { reviewsIcon } from '../../assets/img/icons/reviews';
|
|
7
7
|
import { uploadIcon } from '../../assets/img/icons/upload';
|
|
8
8
|
import { viewsIcon } from '../../assets/img/icons/views';
|
|
9
|
-
import { quoteIcon } from '../../assets/img/icons/quote';
|
|
10
9
|
import { srOnlyStyle } from '../../styles/sr-only';
|
|
11
10
|
|
|
12
11
|
import { formatCount } from '../../utils/format-count';
|
|
13
12
|
|
|
14
13
|
@customElement('tile-stats')
|
|
15
14
|
export class TileStats extends LitElement {
|
|
16
|
-
/** The mediatype of the item these stats represent */
|
|
17
15
|
@property({ type: String }) mediatype?: string;
|
|
18
16
|
|
|
19
|
-
/** The number of uploaded items, if representing an account */
|
|
20
17
|
@property({ type: Number }) itemCount?: number;
|
|
21
18
|
|
|
22
|
-
/** The number of times the item has been viewed */
|
|
23
19
|
@property({ type: Number }) viewCount?: number;
|
|
24
20
|
|
|
25
|
-
/** The text label describing the type of views (default "all-time views") */
|
|
26
21
|
@property({ type: String }) viewLabel?: string;
|
|
27
22
|
|
|
28
|
-
/** The number of times the item has been favorited */
|
|
29
23
|
@property({ type: Number }) favCount?: number;
|
|
30
24
|
|
|
31
|
-
/** The number of times the item has been reviewed */
|
|
32
25
|
@property({ type: Number }) commentCount?: number;
|
|
33
26
|
|
|
34
|
-
/** Whether to show the number of TV clips in place of reviews */
|
|
35
|
-
@property({ type: Boolean }) showTvClips = false;
|
|
36
|
-
|
|
37
|
-
/** The number of times the TV item has been clipped */
|
|
38
|
-
@property({ type: Number }) tvClipCount?: number;
|
|
39
|
-
|
|
40
27
|
render() {
|
|
28
|
+
const formattedFavCount = formatCount(this.favCount, 'short', 'short');
|
|
29
|
+
const formattedReviewCount = formatCount(
|
|
30
|
+
this.commentCount,
|
|
31
|
+
'short',
|
|
32
|
+
'short',
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
const uploadsOrViewsTitle =
|
|
36
|
+
this.mediatype === 'account'
|
|
37
|
+
? `${this.itemCount ?? 0} uploads`
|
|
38
|
+
: `${this.viewCount ?? 0} ${this.viewLabel ?? 'all-time views'}`;
|
|
39
|
+
|
|
41
40
|
return html`
|
|
42
41
|
<div class="item-stats">
|
|
43
42
|
<p class="sr-only">
|
|
44
43
|
${this.mediatype === 'account' ? 'Account Stats' : 'Item Stats'}
|
|
45
44
|
</p>
|
|
46
45
|
<ul id="stats-row">
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
${
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
46
|
+
<li class="col">
|
|
47
|
+
<p class="sr-only">${msg('Mediatype:')}</p>
|
|
48
|
+
<mediatype-icon .mediatype=${this.mediatype}></mediatype-icon>
|
|
49
|
+
</li>
|
|
50
|
+
<li class="col" title="${uploadsOrViewsTitle}">
|
|
51
|
+
${this.mediatype === 'account' ? uploadIcon : viewsIcon}
|
|
52
|
+
<p class="status-text">
|
|
53
|
+
<span class="sr-only">
|
|
54
|
+
${this.mediatype === 'account'
|
|
55
|
+
? msg('Uploads:')
|
|
56
|
+
: msg('Views:')}
|
|
57
|
+
</span>
|
|
58
|
+
${formatCount(
|
|
59
|
+
this.mediatype === 'account'
|
|
60
|
+
? (this.itemCount ?? 0)
|
|
61
|
+
: (this.viewCount ?? 0),
|
|
62
|
+
'short',
|
|
63
|
+
'short',
|
|
64
|
+
)}
|
|
65
|
+
</p>
|
|
66
|
+
</li>
|
|
67
|
+
<li class="col" title="${formattedFavCount} favorites">
|
|
68
|
+
${favoriteFilledIcon}
|
|
69
|
+
<p class="status-text">
|
|
70
|
+
<span class="sr-only">${msg('Favorites:')}</span>
|
|
71
|
+
${formattedFavCount}
|
|
72
|
+
</p>
|
|
73
|
+
</li>
|
|
74
|
+
<li class="col reviews" title="${formattedReviewCount} reviews">
|
|
75
|
+
${reviewsIcon}
|
|
76
|
+
<p class="status-text">
|
|
77
|
+
<span class="sr-only">${msg('Reviews:')}</span>
|
|
78
|
+
${formattedReviewCount}
|
|
79
|
+
</p>
|
|
80
|
+
</li>
|
|
55
81
|
</ul>
|
|
56
82
|
</div>
|
|
57
83
|
`;
|
|
58
84
|
}
|
|
59
85
|
|
|
60
|
-
/**
|
|
61
|
-
* Template for the mediatype icon column.
|
|
62
|
-
*/
|
|
63
|
-
private get mediatypeIconColumnTemplate(): TemplateResult {
|
|
64
|
-
return html`
|
|
65
|
-
<li class="col">
|
|
66
|
-
<p class="sr-only">${msg('Mediatype:')}</p>
|
|
67
|
-
<mediatype-icon .mediatype=${this.mediatype}></mediatype-icon>
|
|
68
|
-
</li>
|
|
69
|
-
`;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Helper method to construct a template for one of the tile stat columns,
|
|
74
|
-
* given its stat count, labels, and icon.
|
|
75
|
-
*
|
|
76
|
-
* @param count The numeric count to show for the stat. If undefined, will be treated as 0.
|
|
77
|
-
* @param label The textual label describing the stat (used in the title and screenreader text).
|
|
78
|
-
* @param icon The icon visually representing the stat.
|
|
79
|
-
* @param classes Any additional CSS classes the stat column should have (optional).
|
|
80
|
-
*/
|
|
81
|
-
private columnTemplate(
|
|
82
|
-
count: number | undefined,
|
|
83
|
-
label: string,
|
|
84
|
-
icon: TemplateResult,
|
|
85
|
-
classes: string[] = [],
|
|
86
|
-
): TemplateResult {
|
|
87
|
-
const formattedCount = formatCount(count ?? 0, 'short', 'short');
|
|
88
|
-
const title = `${formattedCount} ${label}`;
|
|
89
|
-
const srLabel = label + ':';
|
|
90
|
-
|
|
91
|
-
return html`
|
|
92
|
-
<li class="col ${classes.join(' ')}" title=${title}>
|
|
93
|
-
${icon}
|
|
94
|
-
<p class="status-text">
|
|
95
|
-
<span class="sr-only">${srLabel}</span>
|
|
96
|
-
${formattedCount}
|
|
97
|
-
</p>
|
|
98
|
-
</li>
|
|
99
|
-
`;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Template for the views count column.
|
|
104
|
-
*/
|
|
105
|
-
private get viewsColumnTemplate(): TemplateResult {
|
|
106
|
-
const label = this.viewLabel ?? msg('all-time views');
|
|
107
|
-
return this.columnTemplate(this.viewCount, label, viewsIcon);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Template for the uploads count column (replaces views for account tiles).
|
|
112
|
-
*/
|
|
113
|
-
private get uploadsColumnTemplate(): TemplateResult {
|
|
114
|
-
return this.columnTemplate(this.itemCount, msg('uploads'), uploadIcon);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Template for the favorites count column.
|
|
119
|
-
*/
|
|
120
|
-
private get favoritesColumnTemplate(): TemplateResult {
|
|
121
|
-
return this.columnTemplate(this.favCount, msg('favorites'), favIcon);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Template for the reviews count column.
|
|
126
|
-
*/
|
|
127
|
-
private get reviewsColumnTemplate(): TemplateResult {
|
|
128
|
-
return this.columnTemplate(this.commentCount, msg('reviews'), reviewsIcon, [
|
|
129
|
-
'reviews',
|
|
130
|
-
]);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
/**
|
|
134
|
-
* Template for the TV clips count column (replaces reviews for TV tiles).
|
|
135
|
-
*/
|
|
136
|
-
private get tvClipsColumnTemplate(): TemplateResult {
|
|
137
|
-
return this.columnTemplate(this.tvClipCount, msg('clips'), quoteIcon);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
86
|
static get styles(): CSSResultGroup {
|
|
141
87
|
return [
|
|
142
88
|
srOnlyStyle,
|
|
@@ -147,12 +93,12 @@ export class TileStats extends LitElement {
|
|
|
147
93
|
}
|
|
148
94
|
|
|
149
95
|
ul {
|
|
150
|
-
all: unset;
|
|
151
|
-
list-style-type: none;
|
|
96
|
+
all: unset; // unset all property values
|
|
97
|
+
list-style-type: none; // remove default list-style
|
|
152
98
|
}
|
|
153
99
|
|
|
154
100
|
li {
|
|
155
|
-
list-style-type: none;
|
|
101
|
+
list-style-type: none; // remove default list-style
|
|
156
102
|
}
|
|
157
103
|
|
|
158
104
|
svg {
|
package/src/tiles/item-image.ts
CHANGED
|
@@ -69,9 +69,6 @@ export class ItemImage extends LitElement {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
// Use the thumbnail URL specified in the model if it exists
|
|
73
|
-
if (this.model?.thumbnailUrl) return this.model.thumbnailUrl;
|
|
74
|
-
|
|
75
72
|
// Don't try to load invalid image URLs
|
|
76
73
|
return this.baseImageUrl && this.model?.identifier
|
|
77
74
|
? `${this.baseImageUrl}/services/img/${this.model.identifier}`
|
|
@@ -56,8 +56,6 @@ export class TileDispatcher
|
|
|
56
56
|
@property({ type: Object })
|
|
57
57
|
collectionTitles?: CollectionTitles;
|
|
58
58
|
|
|
59
|
-
@property({ type: Boolean }) showTvClips = false;
|
|
60
|
-
|
|
61
59
|
/** Whether this tile should include a hover pane at all (for applicable tile modes) */
|
|
62
60
|
@property({ type: Boolean }) enableHoverPane = false;
|
|
63
61
|
|
|
@@ -342,7 +340,6 @@ export class TileDispatcher
|
|
|
342
340
|
.creatorFilter=${creatorFilter}
|
|
343
341
|
.loggedIn=${this.loggedIn}
|
|
344
342
|
.isManageView=${this.isManageView}
|
|
345
|
-
?showTvClips=${this.showTvClips}
|
|
346
343
|
?showInfoButton=${!this.isHoverEnabled}
|
|
347
344
|
@infoButtonPressed=${this.tileInfoButtonPressed}
|
|
348
345
|
>
|
|
@@ -2044,4 +2044,23 @@ describe('Collection Browser', () => {
|
|
|
2044
2044
|
const initialResults = el.dataSource.getAllPages();
|
|
2045
2045
|
expect(Object.keys(initialResults).length).to.deep.equal(numberOfPages);
|
|
2046
2046
|
});
|
|
2047
|
+
|
|
2048
|
+
it('renders provided results header instead of default, when showing smart results', async () => {
|
|
2049
|
+
const searchService = new MockSearchService();
|
|
2050
|
+
|
|
2051
|
+
const el = await fixture<CollectionBrowser>(
|
|
2052
|
+
html`<collection-browser
|
|
2053
|
+
showSmartResults
|
|
2054
|
+
.searchService=${searchService}
|
|
2055
|
+
.resultsHeader=${'Foo Bar'}
|
|
2056
|
+
></collection-browser>`,
|
|
2057
|
+
);
|
|
2058
|
+
|
|
2059
|
+
el.baseQuery = 'foo';
|
|
2060
|
+
await el.updateComplete;
|
|
2061
|
+
await nextTick();
|
|
2062
|
+
|
|
2063
|
+
const header = el.shadowRoot?.querySelector('.results-section-heading');
|
|
2064
|
+
expect(header?.textContent?.trim()).to.equal('Foo Bar');
|
|
2065
|
+
});
|
|
2047
2066
|
});
|
|
@@ -15,7 +15,7 @@ describe('Restoration state handler', () => {
|
|
|
15
15
|
expect(restorationState.baseQuery).to.equal('boop');
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
-
it('should restore
|
|
18
|
+
it('should restore metadata search type from URL without valid sin', async () => {
|
|
19
19
|
const handler = new RestorationStateHandler({ context: 'search' });
|
|
20
20
|
|
|
21
21
|
const url = new URL(window.location.href);
|
|
@@ -23,10 +23,10 @@ describe('Restoration state handler', () => {
|
|
|
23
23
|
window.history.replaceState({ path: url.href }, '', url.href);
|
|
24
24
|
|
|
25
25
|
const restorationState = handler.getRestorationState();
|
|
26
|
-
expect(restorationState.searchType).to.equal(SearchType.
|
|
26
|
+
expect(restorationState.searchType).to.equal(SearchType.METADATA);
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
it('should restore
|
|
29
|
+
it('should restore metadata search type if sin explicitly empty in URL', async () => {
|
|
30
30
|
const handler = new RestorationStateHandler({ context: 'search' });
|
|
31
31
|
|
|
32
32
|
const url = new URL(window.location.href);
|
|
@@ -34,7 +34,7 @@ describe('Restoration state handler', () => {
|
|
|
34
34
|
window.history.replaceState({ path: url.href }, '', url.href);
|
|
35
35
|
|
|
36
36
|
const restorationState = handler.getRestorationState();
|
|
37
|
-
expect(restorationState.searchType).to.equal(SearchType.
|
|
37
|
+
expect(restorationState.searchType).to.equal(SearchType.METADATA);
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
it('should restore full text search type from URL', async () => {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const quoteIcon: import("lit").TemplateResult<2>;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { svg } from 'lit';
|
|
2
|
-
export const quoteIcon = svg `
|
|
3
|
-
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
|
|
4
|
-
<path d="m45.3394669 100.000002h7.4385828c6.4511217-.3595144 12.58904-1.9152224 18.4137548-4.6671261s10.8424956-6.3426695 15.0533425-10.7722976c4.2108468-4.429628 7.556034-9.6360206 10.0355616-15.6191778s3.7192914-12.2669975 3.7192914-18.8515208c0-9.0967521-2.2250498-17.4897316-6.6751493-25.1789383-4.4500995-7.6892068-10.5140669-13.7638762-18.1919023-18.22400833-7.6778355-4.46013212-16.0560287-6.68910874-25.1345797-6.68693148-6.8100007 0-13.2915728 1.31603472-19.4447163 3.94810096-6.1531434 2.63206624-11.4699901 6.17816545-15.9505399 10.63829755-4.4805499 4.4601321-8.03453942 9.7863622-10.66196865 15.9786902s-3.94114385 12.7005912-3.94114385 19.5247894c0 12.9271929 4.36092352 24.1624988 13.0827705 33.7059178 8.7218471 9.543419 19.4751667 14.9448198 32.2599589 16.2042045zm-28.136113-51.5246596c2.2707252-7.480036 5.6159125-13.1058597 10.0355616-16.8774711 4.2412972-3.9502783 8.9610997-5.4166529 14.1594076-4.399124.2979783.1786667.1783519.507675-.358879.9870248-.537231.4793498-1.433341 1.2572039-2.6883299 2.3335621-1.254989 1.0763582-2.3000881 2.1538058-3.1352974 3.2323429-1.074462 1.4358706-1.7911325 2.7976598-2.1500114 4.0853677-.358879 1.2877079-.448055 2.214814-.267528 2.7813184.180527.5665043.180527 1.1798542 0 1.8400496 3.1059345-.1786668 5.8236273.5545206 8.1530782 2.199562s3.9726817 3.7095139 4.9296923 6.1934174c.9570107 2.4839036 1.210401 5.2063926.760171 8.1674672-.45023 2.9610745-1.6595435 5.6094822-3.6279404 7.9452231-3.3451872 3.6495952-7.5712592 5.2205552-12.678216 4.7128802s-8.9154242-2.6767329-11.4254021-6.5071737c-1.5529673-2.1548953-2.4490773-4.8479697-2.6883299-8.0792232-.2392527-3.2312535.089176-6.1040841.9852859-8.6184917zm34.7655868 0c2.2098245-7.3013692 5.5854621-12.9271929 10.1269126-16.8774711 4.1825715-3.9502783 8.8719237-5.4166529 14.0680565-4.399124.358879.1786667.2838407.507675-.225115.9870248-.5089556.4793498-1.3898404 1.2572039-2.6426544 2.3335621-1.2528139 1.0763582-2.3283634 2.1538058-3.2266484 3.2323429-1.0744619 1.4358706-1.7911324 2.7976598-2.1500114 4.0853677s-.4632801 2.214814-.3132035 2.7813184c.1500767.5665043.1348515 1.1798542-.0456755 1.8400496 3.1059346-.1786668 5.8236273.5545206 8.1530782 2.199562s3.9726817 3.7095139 4.9296924 6.1934174c.9570106 2.4839036 1.2256261 5.2063926.8058464 8.1674672-.4197796 2.9610745-1.6443183 5.6094822-3.6736158 7.9452231-3.3451873 3.6495952-7.5712593 5.2205552-12.6782161 4.7128802s-8.9154242-2.6767329-11.4254021-6.5071737c-1.4942416-2.1548953-2.3609888-4.8479697-2.6002414-8.0792232-.2392527-3.2312535.0598131-6.1040841.8971975-8.6184917z"/>
|
|
5
|
-
</svg>
|
|
6
|
-
`;
|
|
7
|
-
//# sourceMappingURL=quote.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"quote.js","sourceRoot":"","sources":["../../../../../src/assets/img/icons/quote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,CAAA;;;;CAI3B,CAAC","sourcesContent":["import { svg } from 'lit';\n\nexport const quoteIcon = svg`\n <svg viewBox=\"0 0 100 100\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"m45.3394669 100.000002h7.4385828c6.4511217-.3595144 12.58904-1.9152224 18.4137548-4.6671261s10.8424956-6.3426695 15.0533425-10.7722976c4.2108468-4.429628 7.556034-9.6360206 10.0355616-15.6191778s3.7192914-12.2669975 3.7192914-18.8515208c0-9.0967521-2.2250498-17.4897316-6.6751493-25.1789383-4.4500995-7.6892068-10.5140669-13.7638762-18.1919023-18.22400833-7.6778355-4.46013212-16.0560287-6.68910874-25.1345797-6.68693148-6.8100007 0-13.2915728 1.31603472-19.4447163 3.94810096-6.1531434 2.63206624-11.4699901 6.17816545-15.9505399 10.63829755-4.4805499 4.4601321-8.03453942 9.7863622-10.66196865 15.9786902s-3.94114385 12.7005912-3.94114385 19.5247894c0 12.9271929 4.36092352 24.1624988 13.0827705 33.7059178 8.7218471 9.543419 19.4751667 14.9448198 32.2599589 16.2042045zm-28.136113-51.5246596c2.2707252-7.480036 5.6159125-13.1058597 10.0355616-16.8774711 4.2412972-3.9502783 8.9610997-5.4166529 14.1594076-4.399124.2979783.1786667.1783519.507675-.358879.9870248-.537231.4793498-1.433341 1.2572039-2.6883299 2.3335621-1.254989 1.0763582-2.3000881 2.1538058-3.1352974 3.2323429-1.074462 1.4358706-1.7911325 2.7976598-2.1500114 4.0853677-.358879 1.2877079-.448055 2.214814-.267528 2.7813184.180527.5665043.180527 1.1798542 0 1.8400496 3.1059345-.1786668 5.8236273.5545206 8.1530782 2.199562s3.9726817 3.7095139 4.9296923 6.1934174c.9570107 2.4839036 1.210401 5.2063926.760171 8.1674672-.45023 2.9610745-1.6595435 5.6094822-3.6279404 7.9452231-3.3451872 3.6495952-7.5712592 5.2205552-12.678216 4.7128802s-8.9154242-2.6767329-11.4254021-6.5071737c-1.5529673-2.1548953-2.4490773-4.8479697-2.6883299-8.0792232-.2392527-3.2312535.089176-6.1040841.9852859-8.6184917zm34.7655868 0c2.2098245-7.3013692 5.5854621-12.9271929 10.1269126-16.8774711 4.1825715-3.9502783 8.8719237-5.4166529 14.0680565-4.399124.358879.1786667.2838407.507675-.225115.9870248-.5089556.4793498-1.3898404 1.2572039-2.6426544 2.3335621-1.2528139 1.0763582-2.3283634 2.1538058-3.2266484 3.2323429-1.0744619 1.4358706-1.7911324 2.7976598-2.1500114 4.0853677s-.4632801 2.214814-.3132035 2.7813184c.1500767.5665043.1348515 1.1798542-.0456755 1.8400496 3.1059346-.1786668 5.8236273.5545206 8.1530782 2.199562s3.9726817 3.7095139 4.9296924 6.1934174c.9570106 2.4839036 1.2256261 5.2063926.8058464 8.1674672-.4197796 2.9610745-1.6443183 5.6094822-3.6736158 7.9452231-3.3451873 3.6495952-7.5712593 5.2205552-12.6782161 4.7128802s-8.9154242-2.6767329-11.4254021-6.5071737c-1.4942416-2.1548953-2.3609888-4.8479697-2.6002414-8.0792232-.2392527-3.2312535.0598131-6.1040841.8971975-8.6184917z\"/>\n </svg>\n`;\n"]}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { svg } from 'lit';
|
|
2
|
-
|
|
3
|
-
export const quoteIcon = svg`
|
|
4
|
-
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
|
|
5
|
-
<path d="m45.3394669 100.000002h7.4385828c6.4511217-.3595144 12.58904-1.9152224 18.4137548-4.6671261s10.8424956-6.3426695 15.0533425-10.7722976c4.2108468-4.429628 7.556034-9.6360206 10.0355616-15.6191778s3.7192914-12.2669975 3.7192914-18.8515208c0-9.0967521-2.2250498-17.4897316-6.6751493-25.1789383-4.4500995-7.6892068-10.5140669-13.7638762-18.1919023-18.22400833-7.6778355-4.46013212-16.0560287-6.68910874-25.1345797-6.68693148-6.8100007 0-13.2915728 1.31603472-19.4447163 3.94810096-6.1531434 2.63206624-11.4699901 6.17816545-15.9505399 10.63829755-4.4805499 4.4601321-8.03453942 9.7863622-10.66196865 15.9786902s-3.94114385 12.7005912-3.94114385 19.5247894c0 12.9271929 4.36092352 24.1624988 13.0827705 33.7059178 8.7218471 9.543419 19.4751667 14.9448198 32.2599589 16.2042045zm-28.136113-51.5246596c2.2707252-7.480036 5.6159125-13.1058597 10.0355616-16.8774711 4.2412972-3.9502783 8.9610997-5.4166529 14.1594076-4.399124.2979783.1786667.1783519.507675-.358879.9870248-.537231.4793498-1.433341 1.2572039-2.6883299 2.3335621-1.254989 1.0763582-2.3000881 2.1538058-3.1352974 3.2323429-1.074462 1.4358706-1.7911325 2.7976598-2.1500114 4.0853677-.358879 1.2877079-.448055 2.214814-.267528 2.7813184.180527.5665043.180527 1.1798542 0 1.8400496 3.1059345-.1786668 5.8236273.5545206 8.1530782 2.199562s3.9726817 3.7095139 4.9296923 6.1934174c.9570107 2.4839036 1.210401 5.2063926.760171 8.1674672-.45023 2.9610745-1.6595435 5.6094822-3.6279404 7.9452231-3.3451872 3.6495952-7.5712592 5.2205552-12.678216 4.7128802s-8.9154242-2.6767329-11.4254021-6.5071737c-1.5529673-2.1548953-2.4490773-4.8479697-2.6883299-8.0792232-.2392527-3.2312535.089176-6.1040841.9852859-8.6184917zm34.7655868 0c2.2098245-7.3013692 5.5854621-12.9271929 10.1269126-16.8774711 4.1825715-3.9502783 8.8719237-5.4166529 14.0680565-4.399124.358879.1786667.2838407.507675-.225115.9870248-.5089556.4793498-1.3898404 1.2572039-2.6426544 2.3335621-1.2528139 1.0763582-2.3283634 2.1538058-3.2266484 3.2323429-1.0744619 1.4358706-1.7911324 2.7976598-2.1500114 4.0853677s-.4632801 2.214814-.3132035 2.7813184c.1500767.5665043.1348515 1.1798542-.0456755 1.8400496 3.1059346-.1786668 5.8236273.5545206 8.1530782 2.199562s3.9726817 3.7095139 4.9296924 6.1934174c.9570106 2.4839036 1.2256261 5.2063926.8058464 8.1674672-.4197796 2.9610745-1.6443183 5.6094822-3.6736158 7.9452231-3.3451873 3.6495952-7.5712593 5.2205552-12.6782161 4.7128802s-8.9154242-2.6767329-11.4254021-6.5071737c-1.4942416-2.1548953-2.3609888-4.8479697-2.6002414-8.0792232-.2392527-3.2312535.0598131-6.1040841.8971975-8.6184917z"/>
|
|
6
|
-
</svg>
|
|
7
|
-
`;
|