@salesforcedevs/dw-components 0.0.0 → 0.0.1
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/lwc.config.json +10 -1
- package/package.json +8 -4
- package/src/modules/dw/blogsGrid/blogsGrid.css +10 -7
- package/src/modules/dw/blogsGrid/blogsGrid.html +15 -12
- package/src/modules/dw/blogsGrid/blogsGrid.ts +23 -9
- package/src/modules/dw/browseTrials/browseTrials.css +35 -0
- package/src/modules/dw/browseTrials/browseTrials.html +86 -0
- package/src/modules/dw/browseTrials/browseTrials.ts +116 -0
- package/src/modules/dw/cardBlogPostProvider/cardBlogPostProvider.css +2 -0
- package/src/modules/dw/cardBlogPostProvider/cardBlogPostProvider.html +3 -3
- package/src/modules/dw/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.css +2 -0
- package/src/modules/dw/cardPodcastEpisodeProvider/cardPodcastEpisodeProvider.html +2 -1
- package/src/modules/dw/codeSamplesGrid/codeSamplesGrid.css +6 -8
- package/src/modules/dw/codeSamplesGrid/codeSamplesGrid.html +11 -7
- package/src/modules/dw/codeSamplesGrid/codeSamplesGrid.ts +71 -40
- package/src/modules/dw/contentArchive/contentArchive.css +5 -4
- package/src/modules/dw/contentArchive/contentArchive.html +58 -24
- package/src/modules/dw/contentArchive/contentArchive.ts +46 -8
- package/src/modules/dw/contentArchive/contentArchive.types.ts +8 -4
- package/src/modules/dw/contentArchive/utils.ts +30 -14
- package/src/modules/dw/deSignupForm/deSignupForm.css +11 -10
- package/src/modules/dw/deSignupForm/deSignupForm.html +39 -25
- package/src/modules/dw/deSignupForm/deSignupForm.ts +200 -133
- package/src/modules/dw/deSignupForm/submitForm.ts +7 -3
- package/src/modules/dw/docsGrid/docsGrid.css +0 -1
- package/src/modules/dw/docsGrid/docsGrid.html +6 -2
- package/src/modules/dw/docsGrid/docsGrid.ts +103 -38
- package/src/modules/dw/eventsList/eventsList.css +4 -4
- package/src/modules/dw/eventsList/eventsList.html +5 -5
- package/src/modules/dw/eventsList/eventsList.ts +47 -48
- package/src/modules/dw/j2sCardSequence/j2sCardSequence.css +14 -0
- package/src/modules/dw/j2sCardSequence/j2sCardSequence.html +41 -0
- package/src/modules/dw/j2sCardSequence/j2sCardSequence.ts +487 -0
- package/src/modules/dw/j2sCardSequenceStep/j2sCardSequenceStep.css +76 -0
- package/src/modules/dw/j2sCardSequenceStep/j2sCardSequenceStep.html +64 -0
- package/src/modules/dw/j2sCardSequenceStep/j2sCardSequenceStep.ts +157 -0
- package/src/modules/dw/j2sForm/j2sForm.css +65 -0
- package/src/modules/dw/j2sForm/j2sForm.html +217 -0
- package/src/modules/dw/j2sForm/j2sForm.ts +371 -0
- package/src/modules/dw/j2sForm/mockProps.ts +3102 -0
- package/src/modules/dw/languageSelector/languageSelector.html +11 -0
- package/src/modules/dw/languageSelector/languageSelector.ts +106 -0
- package/src/modules/dw/newsletterForm/newsletterForm.css +2 -2
- package/src/modules/dw/newsletterForm/newsletterForm.html +35 -10
- package/src/modules/dw/newsletterForm/newsletterForm.ts +107 -78
- package/src/modules/dw/podcastSubscription/podcastSubscription.css +6 -7
- package/src/modules/dw/podcastSubscription/podcastSubscription.html +2 -2
- package/src/modules/dw/podcastSubscription/podcastSubscription.ts +4 -4
- package/src/modules/dw/podcastsGrid/podcastsGrid.css +7 -0
- package/src/modules/dw/podcastsGrid/podcastsGrid.html +6 -1
- package/src/modules/dw/podcastsGrid/podcastsGrid.ts +3 -3
- package/src/modules/dw/podcastsPromo/podcastsPromo.css +14 -0
- package/src/modules/dw/podcastsPromo/podcastsPromo.html +16 -8
- package/src/modules/dw/podcastsPromo/podcastsPromo.ts +11 -2
- package/src/modules/dw/rcgTable/altData.ts +72 -9
- package/src/modules/dw/rcgTable/getTableData.ts +1 -1
- package/src/modules/dw/rcgTable/rcgTable.ts +3 -3
- package/src/modules/dw/slackCta/slackCta.css +5 -6
- package/src/modules/dw/slackCta/slackCta.html +1 -1
- package/src/modules/dw/slackSuccess/slackSuccess.css +1 -1
- package/src/modules/dw/slackSuccess/slackSuccess.html +2 -2
- package/src/modules/dw/tbidLoginMenu/tbidLoginMenu.css +119 -0
- package/src/modules/dw/tbidLoginMenu/tbidLoginMenu.html +192 -0
- package/src/modules/dw/tbidLoginMenu/tbidLoginMenu.ts +148 -0
- package/src/modules/dw/videoGrid/types.ts +12 -0
- package/src/modules/dw/videoGrid/videoGrid.css +24 -0
- package/src/modules/dw/videoGrid/videoGrid.html +41 -0
- package/src/modules/dw/videoGrid/videoGrid.ts +41 -0
- package/src/modules/dw/youtubeVideoGrid/types.ts +8 -0
- package/src/modules/dw/youtubeVideoGrid/youtubeVideoGrid.css +14 -0
- package/src/modules/dw/youtubeVideoGrid/youtubeVideoGrid.html +24 -0
- package/src/modules/dw/youtubeVideoGrid/youtubeVideoGrid.ts +66 -0
- package/src/modules/dwHelpers/mobileDividers/mobileDividers.css +19 -0
- package/src/modules/dwUtils/forms/forms.ts +514 -0
- package/src/modules/{dwBaseElements → dwUtils}/postsGrid/postsGrid.ts +10 -13
|
@@ -3,11 +3,11 @@ import qs from "query-string";
|
|
|
3
3
|
import uniqBy from "lodash.uniqby";
|
|
4
4
|
import orderBy from "lodash.orderby";
|
|
5
5
|
import cloneDeep from "lodash.clonedeep";
|
|
6
|
-
import {
|
|
6
|
+
import { DropdownItem, CodeSample } from "typings/custom";
|
|
7
7
|
import { toJson } from "dxUtils/normalizers";
|
|
8
|
+
import { track } from "dxUtils/analytics";
|
|
8
9
|
|
|
9
10
|
const PRODUCT_FILTER_ALL_PRODUCTS = "all products";
|
|
10
|
-
const LANGUAGE_FILTER_LABEL = "Type";
|
|
11
11
|
const WAIT_TIME = 500;
|
|
12
12
|
const DEFAULT_BUTTON_TEXT = "Explore on GitHub";
|
|
13
13
|
export default class CodeSamplesGrid extends LightningElement {
|
|
@@ -22,10 +22,10 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
22
22
|
private totalRecountCount = 0;
|
|
23
23
|
private totalPages = 1;
|
|
24
24
|
private _featuredCodeSample?: CodeSample = undefined;
|
|
25
|
-
private _samplesList
|
|
26
|
-
private _typesFiltersList
|
|
27
|
-
private _sourceFiltersList
|
|
28
|
-
private _productFiltersList
|
|
25
|
+
private _samplesList: CodeSample[] = [];
|
|
26
|
+
private _typesFiltersList: DropdownItem[] = [];
|
|
27
|
+
private _sourceFiltersList: DropdownItem[] = [];
|
|
28
|
+
private _productFiltersList: DropdownItem[] = [];
|
|
29
29
|
private matchDesktop!: MediaQueryList;
|
|
30
30
|
private matchMobile!: MediaQueryList;
|
|
31
31
|
private matchMobileSmall!: MediaQueryList;
|
|
@@ -36,10 +36,11 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
36
36
|
private isMobile = "(min-width: 401px) and (max-width: 1023px)";
|
|
37
37
|
private isMobileSmall = "(max-width: 400px)";
|
|
38
38
|
private showSourcesFilter = false;
|
|
39
|
+
private filteredItemsSelected: boolean = false;
|
|
39
40
|
private filtersDefaultValue = {
|
|
40
|
-
selectedSourceFilter: [],
|
|
41
|
-
selectedTypeFilter: [],
|
|
42
|
-
selectedProductFilter: [],
|
|
41
|
+
selectedSourceFilter: [] as string[],
|
|
42
|
+
selectedTypeFilter: [] as string[],
|
|
43
|
+
selectedProductFilter: [] as string[],
|
|
43
44
|
searchTerm: "",
|
|
44
45
|
page: "1"
|
|
45
46
|
};
|
|
@@ -91,7 +92,7 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
91
92
|
}
|
|
92
93
|
if (urlParams.get("service")) {
|
|
93
94
|
this.selectedProductFilter = urlParams
|
|
94
|
-
.get("service")
|
|
95
|
+
.get("service")!
|
|
95
96
|
.split(",");
|
|
96
97
|
}
|
|
97
98
|
if (urlParams.get("filter_text")) {
|
|
@@ -100,7 +101,7 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
100
101
|
).toLowerCase();
|
|
101
102
|
}
|
|
102
103
|
if (urlParams.has("page")) {
|
|
103
|
-
page = urlParams.get("page")
|
|
104
|
+
page = urlParams.get("page")!;
|
|
104
105
|
}
|
|
105
106
|
}
|
|
106
107
|
this.calculatePagination(page, true);
|
|
@@ -111,21 +112,31 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
111
112
|
this.matchMobile.removeEventListener("change", this.handleView);
|
|
112
113
|
this.matchMobileSmall.removeEventListener("change", this.handleView);
|
|
113
114
|
window.removeEventListener("popstate", this.handleURLStateChange);
|
|
115
|
+
|
|
116
|
+
if (!this.filteredItemsSelected) {
|
|
117
|
+
this.selectedProductFilter?.forEach((filter) => {
|
|
118
|
+
track(document, "custEv_filterAbandoned", {
|
|
119
|
+
click_text: filter,
|
|
120
|
+
element_title: "CodeSamplesGrid",
|
|
121
|
+
element_type: "filter abandoned",
|
|
122
|
+
content_category: "filter"
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
}
|
|
114
126
|
}
|
|
115
127
|
|
|
116
128
|
@api
|
|
117
129
|
set featuredCodeSample(value: string) {
|
|
118
130
|
this._featuredCodeSample = toJson(value);
|
|
119
131
|
}
|
|
120
|
-
get featuredCodeSample(): CodeSample {
|
|
132
|
+
get featuredCodeSample(): CodeSample | undefined {
|
|
121
133
|
return this._featuredCodeSample;
|
|
122
134
|
}
|
|
123
135
|
|
|
124
136
|
@api
|
|
125
137
|
set samples(value: string) {
|
|
126
|
-
console.log(value);
|
|
127
138
|
const jsonSamples = toJson(value) || [];
|
|
128
|
-
this._samplesList = jsonSamples.map((sample, i) => ({
|
|
139
|
+
this._samplesList = jsonSamples.map((sample: any, i: number) => ({
|
|
129
140
|
id: i,
|
|
130
141
|
title: sample.title,
|
|
131
142
|
body: sample.body,
|
|
@@ -152,10 +163,10 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
152
163
|
}));
|
|
153
164
|
|
|
154
165
|
this._productFiltersList = orderBy(
|
|
155
|
-
uniqBy([...productsFilters], "value"),
|
|
166
|
+
uniqBy([...productsFilters] as any, "value"),
|
|
156
167
|
["value"],
|
|
157
168
|
["asc"]
|
|
158
|
-
);
|
|
169
|
+
) as any[];
|
|
159
170
|
this.selectedProductFilter = this._productFiltersList.map(
|
|
160
171
|
(filter) => filter.value
|
|
161
172
|
);
|
|
@@ -175,10 +186,10 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
175
186
|
}));
|
|
176
187
|
|
|
177
188
|
this._typesFiltersList = orderBy(
|
|
178
|
-
uniqBy([...typesFilter], "value"),
|
|
189
|
+
uniqBy([...typesFilter] as any, "value"),
|
|
179
190
|
["value"],
|
|
180
191
|
["asc"]
|
|
181
|
-
);
|
|
192
|
+
) as any[];
|
|
182
193
|
this.selectedTypeFilter = this._typesFiltersList.map(
|
|
183
194
|
(filter) => filter.value
|
|
184
195
|
);
|
|
@@ -200,10 +211,10 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
200
211
|
}));
|
|
201
212
|
|
|
202
213
|
this._sourceFiltersList = orderBy(
|
|
203
|
-
uniqBy([...sourcesFilter], "value"),
|
|
214
|
+
uniqBy([...sourcesFilter] as any, "value"),
|
|
204
215
|
["value"],
|
|
205
216
|
["asc"]
|
|
206
|
-
);
|
|
217
|
+
) as any;
|
|
207
218
|
this.selectedSourceFilter = this._sourceFiltersList.map(
|
|
208
219
|
(filter) => filter.value
|
|
209
220
|
);
|
|
@@ -219,7 +230,7 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
219
230
|
return this.filterSamples([...this.samples]);
|
|
220
231
|
}
|
|
221
232
|
|
|
222
|
-
get currentPageSamples():
|
|
233
|
+
get currentPageSamples(): CodeSample[] {
|
|
223
234
|
return this.filteredSamples.slice(
|
|
224
235
|
this.startingRecord - 1,
|
|
225
236
|
this.endingRecord
|
|
@@ -238,14 +249,6 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
238
249
|
return !this.filteredSamples.length;
|
|
239
250
|
}
|
|
240
251
|
|
|
241
|
-
get typeFilterLabel(): string {
|
|
242
|
-
const selectedLanguage = this.typesList.find(
|
|
243
|
-
(language) => language.value === this.selectedTypeFilter
|
|
244
|
-
);
|
|
245
|
-
const label = selectedLanguage && selectedLanguage.label;
|
|
246
|
-
return label || LANGUAGE_FILTER_LABEL;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
252
|
get tileColumns(): string {
|
|
250
253
|
return this.deviceType === "desktop" ? "three" : "two";
|
|
251
254
|
}
|
|
@@ -258,13 +261,24 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
258
261
|
return this.totalPages < 2;
|
|
259
262
|
}
|
|
260
263
|
|
|
261
|
-
get emptyStateSubtitle()
|
|
264
|
+
get emptyStateSubtitle() {
|
|
262
265
|
return (
|
|
263
|
-
"
|
|
264
|
-
(this.searchTerm !== "" ? `
|
|
266
|
+
"Sorry, no results were found for your search" +
|
|
267
|
+
(this.searchTerm !== "" ? ` "${this.searchTerm}"` : "")
|
|
265
268
|
);
|
|
266
269
|
}
|
|
267
270
|
|
|
271
|
+
get emptyStateBody() {
|
|
272
|
+
return "Search Tips:";
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
get emptyStateSuggestions() {
|
|
276
|
+
return JSON.stringify([
|
|
277
|
+
"Please consider misspellings",
|
|
278
|
+
"Try different search keywords"
|
|
279
|
+
]);
|
|
280
|
+
}
|
|
281
|
+
|
|
268
282
|
handleView = (e: MediaQueryListEvent | MediaQueryList): void => {
|
|
269
283
|
if (e.media === this.isDesktop && e.matches) {
|
|
270
284
|
this.deviceType = "desktop";
|
|
@@ -331,12 +345,14 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
331
345
|
let newList = event.detail.value;
|
|
332
346
|
if (!event.detail.checked) {
|
|
333
347
|
newList = newList.filter(
|
|
334
|
-
(val) =>
|
|
348
|
+
(val: typeof PRODUCT_FILTER_ALL_PRODUCTS) =>
|
|
349
|
+
val !== PRODUCT_FILTER_ALL_PRODUCTS
|
|
335
350
|
);
|
|
336
351
|
}
|
|
337
352
|
this.selectedProductFilter = newList;
|
|
338
353
|
}
|
|
339
354
|
this.calculatePagination();
|
|
355
|
+
this.filteredItemsSelected = false;
|
|
340
356
|
}
|
|
341
357
|
|
|
342
358
|
handleLanguageFilterChange(event: CustomEvent): void {
|
|
@@ -389,7 +405,9 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
389
405
|
}
|
|
390
406
|
|
|
391
407
|
calculatePagination(page?: string, skipSetSearchParams = false): void {
|
|
392
|
-
|
|
408
|
+
if (page) {
|
|
409
|
+
this.page = parseInt(page, 10) || 1;
|
|
410
|
+
}
|
|
393
411
|
this.totalRecountCount = this.filteredSamples.length;
|
|
394
412
|
this.totalPages = Math.ceil(this.totalRecountCount / this.pageSize);
|
|
395
413
|
this.displayRecordsPerPage(this.page);
|
|
@@ -400,16 +418,17 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
400
418
|
|
|
401
419
|
scrollToTop(): void {
|
|
402
420
|
this.template
|
|
403
|
-
.querySelector(".docs-grid-container")
|
|
421
|
+
.querySelector(".docs-grid-container")!
|
|
404
422
|
.scrollIntoView({ behavior: "smooth" });
|
|
405
423
|
}
|
|
406
424
|
|
|
407
|
-
setSearchParams(key?: string, val?: string[]): void {
|
|
425
|
+
setSearchParams(key?: string | null, val?: string[] | null): void {
|
|
408
426
|
const service =
|
|
409
|
-
this.selectedProductFilter
|
|
427
|
+
this.selectedProductFilter!.length ===
|
|
428
|
+
this.productFiltersList.length
|
|
410
429
|
? ""
|
|
411
|
-
: this.selectedProductFilter
|
|
412
|
-
const params = {
|
|
430
|
+
: this.selectedProductFilter!.join(",");
|
|
431
|
+
const params: { [key: string]: any } = {
|
|
413
432
|
filter_text: this.searchTerm,
|
|
414
433
|
service,
|
|
415
434
|
type: this.selectedTypeFilter,
|
|
@@ -417,7 +436,7 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
417
436
|
source: this.selectedSourceFilter
|
|
418
437
|
};
|
|
419
438
|
if (key) {
|
|
420
|
-
params[key] = key === "service" ? val
|
|
439
|
+
params[key] = key === "service" ? val!.join(",") : val;
|
|
421
440
|
}
|
|
422
441
|
for (const _key in params) {
|
|
423
442
|
if (!params[_key]) {
|
|
@@ -428,4 +447,16 @@ export default class CodeSamplesGrid extends LightningElement {
|
|
|
428
447
|
const newurl = `${window.location.pathname}?${searchParams}`;
|
|
429
448
|
window.history.pushState({ path: newurl }, "", newurl);
|
|
430
449
|
}
|
|
450
|
+
|
|
451
|
+
handleReadItClick() {
|
|
452
|
+
this.filteredItemsSelected = true;
|
|
453
|
+
this.selectedProductFilter?.forEach((filter) => {
|
|
454
|
+
track(document, "custEv_filterApplied", {
|
|
455
|
+
click_text: filter,
|
|
456
|
+
click_url: `${window.location.origin}${filter}`,
|
|
457
|
+
element_type: "filter applied",
|
|
458
|
+
content_category: "filter"
|
|
459
|
+
});
|
|
460
|
+
});
|
|
461
|
+
}
|
|
431
462
|
}
|
|
@@ -101,7 +101,7 @@ button:active {
|
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
.empty-state-container {
|
|
104
|
-
background-image: url(/
|
|
104
|
+
background-image: url("https://a.sfdcstatic.com/developer-website/images/no-results-combined.svg");
|
|
105
105
|
background-repeat: no-repeat;
|
|
106
106
|
background-position: center;
|
|
107
107
|
background-size: contain;
|
|
@@ -121,6 +121,7 @@ button:active {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
.filter-title {
|
|
124
|
+
color: var(--dx-g-text-heading-color);
|
|
124
125
|
font-family: var(--dx-g-font-display);
|
|
125
126
|
font-size: var(--dx-g-text-lg);
|
|
126
127
|
}
|
|
@@ -181,13 +182,13 @@ dx-filter-menu {
|
|
|
181
182
|
|
|
182
183
|
.chip-title {
|
|
183
184
|
font-weight: bold;
|
|
184
|
-
color: rgb(24
|
|
185
|
+
color: rgb(24 24 24);
|
|
185
186
|
}
|
|
186
187
|
|
|
187
188
|
.chip-item {
|
|
188
|
-
border: 2px solid rgb(92
|
|
189
|
+
border: 2px solid rgb(92 92 92);
|
|
189
190
|
border-radius: 4px;
|
|
190
|
-
color: rgb(92
|
|
191
|
+
color: rgb(92 92 92);
|
|
191
192
|
font-weight: 600;
|
|
192
193
|
padding: 2px 4px;
|
|
193
194
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<dx-featured-content-header
|
|
3
3
|
class="documentation_header"
|
|
4
|
-
|
|
4
|
+
header="Content Archive"
|
|
5
5
|
body="Learn more about the topics that interest you most by exploring the full collection of Salesforce Developers blog and podcast content."
|
|
6
6
|
dark="true"
|
|
7
7
|
no-swoop={isMobile}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
<dx-modal-drawer open={modalOpen} onclickclose={toggleModal}>
|
|
12
12
|
<img
|
|
13
13
|
if:true={filtersLoading}
|
|
14
|
-
src="/
|
|
14
|
+
src="https://a.sfdcstatic.com/developer-website/images/sidebar-loading.svg"
|
|
15
15
|
alt="loading"
|
|
16
16
|
class="modal-loading"
|
|
17
17
|
/>
|
|
@@ -27,13 +27,13 @@
|
|
|
27
27
|
</div>
|
|
28
28
|
<dx-filter-menu
|
|
29
29
|
name="content-type"
|
|
30
|
-
|
|
30
|
+
header={contentTypeTitle}
|
|
31
31
|
options={contentTypeList}
|
|
32
32
|
onchange={handleUpdateSiteFilter}
|
|
33
33
|
></dx-filter-menu>
|
|
34
34
|
<dx-filter-menu
|
|
35
35
|
name="dates"
|
|
36
|
-
|
|
36
|
+
header={dateTitle}
|
|
37
37
|
options={dateList}
|
|
38
38
|
variant="nested"
|
|
39
39
|
filters-dates-loading={filtersDatesLoading}
|
|
@@ -42,17 +42,23 @@
|
|
|
42
42
|
<template if:false={hideBlogFilters}>
|
|
43
43
|
<dx-filter-menu
|
|
44
44
|
name="authors"
|
|
45
|
-
|
|
45
|
+
header={authorTitle}
|
|
46
46
|
options={authorList}
|
|
47
47
|
onchange={handleFiltersEvent}
|
|
48
48
|
></dx-filter-menu>
|
|
49
49
|
</template>
|
|
50
50
|
<dx-filter-menu
|
|
51
51
|
name="categories"
|
|
52
|
-
|
|
52
|
+
header={categoryTitle}
|
|
53
53
|
options={categoryList}
|
|
54
54
|
onchange={handleFiltersEvent}
|
|
55
55
|
></dx-filter-menu>
|
|
56
|
+
<dx-filter-menu
|
|
57
|
+
name="language"
|
|
58
|
+
header={languageTitle}
|
|
59
|
+
options={languagesList}
|
|
60
|
+
onchange={handleFiltersEvent}
|
|
61
|
+
></dx-filter-menu>
|
|
56
62
|
</template>
|
|
57
63
|
</dx-modal-drawer>
|
|
58
64
|
</template>
|
|
@@ -60,7 +66,7 @@
|
|
|
60
66
|
<template if:false={isMobile}>
|
|
61
67
|
<img
|
|
62
68
|
if:true={filtersLoading}
|
|
63
|
-
src="/
|
|
69
|
+
src="https://a.sfdcstatic.com/developer-website/images/sidebar-loading.svg"
|
|
64
70
|
alt="loading"
|
|
65
71
|
/>
|
|
66
72
|
<template if:false={filtersLoading}>
|
|
@@ -75,13 +81,13 @@
|
|
|
75
81
|
</div>
|
|
76
82
|
<dx-filter-menu
|
|
77
83
|
name="contentType"
|
|
78
|
-
|
|
84
|
+
header={contentTypeTitle}
|
|
79
85
|
options={contentTypeList}
|
|
80
86
|
onchange={handleUpdateSiteFilter}
|
|
81
87
|
></dx-filter-menu>
|
|
82
88
|
<dx-filter-menu
|
|
83
89
|
name="dates"
|
|
84
|
-
|
|
90
|
+
header={dateTitle}
|
|
85
91
|
options={dateList}
|
|
86
92
|
filters-dates-loading={filtersDatesLoading}
|
|
87
93
|
variant="nested"
|
|
@@ -90,17 +96,23 @@
|
|
|
90
96
|
<template if:false={hideBlogFilters}>
|
|
91
97
|
<dx-filter-menu
|
|
92
98
|
name="authors"
|
|
93
|
-
|
|
99
|
+
header={authorTitle}
|
|
94
100
|
options={authorList}
|
|
95
101
|
onchange={handleFiltersEvent}
|
|
96
102
|
></dx-filter-menu>
|
|
97
103
|
</template>
|
|
98
104
|
<dx-filter-menu
|
|
99
105
|
name="categories"
|
|
100
|
-
|
|
106
|
+
header={categoryTitle}
|
|
101
107
|
options={categoryList}
|
|
102
108
|
onchange={handleFiltersEvent}
|
|
103
109
|
></dx-filter-menu>
|
|
110
|
+
<dx-filter-menu
|
|
111
|
+
name="language"
|
|
112
|
+
header={languageTitle}
|
|
113
|
+
options={languagesList}
|
|
114
|
+
onchange={handleFiltersEvent}
|
|
115
|
+
></dx-filter-menu>
|
|
104
116
|
</template>
|
|
105
117
|
</template>
|
|
106
118
|
<template if:true={isMobile}>
|
|
@@ -180,6 +192,27 @@
|
|
|
180
192
|
</template>
|
|
181
193
|
</div>
|
|
182
194
|
</template>
|
|
195
|
+
<template if:true={selectedFilterMenuData.language.length}>
|
|
196
|
+
<div class="chip-item-container">
|
|
197
|
+
<p class="chip-title">Language</p>
|
|
198
|
+
<template
|
|
199
|
+
for:each={selectedFilterMenuData.language}
|
|
200
|
+
for:item="lang"
|
|
201
|
+
>
|
|
202
|
+
<span class="chip-item" key={lang}>
|
|
203
|
+
{lang.name}
|
|
204
|
+
<dx-button
|
|
205
|
+
name="language"
|
|
206
|
+
onclick={removeFilterItem}
|
|
207
|
+
value={lang}
|
|
208
|
+
variant="inline"
|
|
209
|
+
>
|
|
210
|
+
✕
|
|
211
|
+
</dx-button>
|
|
212
|
+
</span>
|
|
213
|
+
</template>
|
|
214
|
+
</div>
|
|
215
|
+
</template>
|
|
183
216
|
<template if:true={selectedFilterMenuData.dates.length}>
|
|
184
217
|
<div class="chip-item-container">
|
|
185
218
|
<p class="chip-title">Date</p>
|
|
@@ -245,7 +278,7 @@
|
|
|
245
278
|
</template>
|
|
246
279
|
</div>
|
|
247
280
|
<h3 class="results-heading" if:false={loading}>{resultsHeading}</h3>
|
|
248
|
-
<hr />
|
|
281
|
+
<hr if:false={isEmptyState} />
|
|
249
282
|
<template if:true={loading}>
|
|
250
283
|
<template if:false={modalOpen}>
|
|
251
284
|
<div class="spinner-container">
|
|
@@ -279,7 +312,7 @@
|
|
|
279
312
|
<dx-card-minimal
|
|
280
313
|
key={post.id}
|
|
281
314
|
content-type={post.contentType}
|
|
282
|
-
|
|
315
|
+
header={post.title}
|
|
283
316
|
href={post.href}
|
|
284
317
|
></dx-card-minimal>
|
|
285
318
|
</template>
|
|
@@ -288,24 +321,23 @@
|
|
|
288
321
|
</template>
|
|
289
322
|
<template for:each={posts} for:item="post">
|
|
290
323
|
<template if:false={isMinimalCard}>
|
|
291
|
-
<template if:true={post.
|
|
324
|
+
<template if:true={post.authors}>
|
|
292
325
|
<dx-card-expanded
|
|
293
326
|
key={post.id}
|
|
294
|
-
|
|
327
|
+
header={post.title}
|
|
295
328
|
content-type={post.contentType}
|
|
296
329
|
href={post.href}
|
|
297
330
|
date={post.date}
|
|
298
331
|
body={post.excerpt}
|
|
299
|
-
|
|
300
|
-
author-label={post.author.name}
|
|
332
|
+
authors={post.authors}
|
|
301
333
|
topics={post.topics}
|
|
302
334
|
length={post.duration}
|
|
303
335
|
></dx-card-expanded>
|
|
304
336
|
</template>
|
|
305
|
-
<template if:false={post.
|
|
337
|
+
<template if:false={post.authors}>
|
|
306
338
|
<dx-card-expanded
|
|
307
339
|
key={post.id}
|
|
308
|
-
|
|
340
|
+
header={post.title}
|
|
309
341
|
content-type={post.contentType}
|
|
310
342
|
href={post.href}
|
|
311
343
|
date={post.date}
|
|
@@ -329,11 +361,13 @@
|
|
|
329
361
|
</template>
|
|
330
362
|
</template>
|
|
331
363
|
<template if:true={isEmptyState}>
|
|
332
|
-
<
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
364
|
+
<dx-empty-state
|
|
365
|
+
variant="alt"
|
|
366
|
+
header="Beep boop. That did not compute."
|
|
367
|
+
subtitle={emptyStateSubtitle}
|
|
368
|
+
body={emptyStateBody}
|
|
369
|
+
suggestions={emptyStateSuggestions}
|
|
370
|
+
></dx-empty-state>
|
|
337
371
|
</template>
|
|
338
372
|
</div>
|
|
339
373
|
</div>
|
|
@@ -15,6 +15,7 @@ const MOBILE_MATCH = "767px";
|
|
|
15
15
|
enum FilterNames {
|
|
16
16
|
QUERY_CONTENT_FILTER = "contentType",
|
|
17
17
|
QUERY_AUTHOR_FILTER = "authors",
|
|
18
|
+
QUERY_LANGUAGE_FILTER = "language",
|
|
18
19
|
QUERY_DATES_FILTER = "dates",
|
|
19
20
|
QUERY_CATEGORIES_FILTER = "categories"
|
|
20
21
|
}
|
|
@@ -38,6 +39,7 @@ export default class ContentArchive extends LightningElement {
|
|
|
38
39
|
private postsByDate: {} = {};
|
|
39
40
|
private dateList: any[] = [];
|
|
40
41
|
private authorList: any[] = [];
|
|
42
|
+
private languagesList: any[] = [];
|
|
41
43
|
private categoryList: any[] = [];
|
|
42
44
|
|
|
43
45
|
private isMobile: boolean = false;
|
|
@@ -47,7 +49,8 @@ export default class ContentArchive extends LightningElement {
|
|
|
47
49
|
contentType: [],
|
|
48
50
|
dates: [],
|
|
49
51
|
authors: [],
|
|
50
|
-
categories: []
|
|
52
|
+
categories: [],
|
|
53
|
+
language: []
|
|
51
54
|
};
|
|
52
55
|
|
|
53
56
|
private posts: any[] = [];
|
|
@@ -56,6 +59,18 @@ export default class ContentArchive extends LightningElement {
|
|
|
56
59
|
return this.totalResults === 0 && !this.loading;
|
|
57
60
|
}
|
|
58
61
|
|
|
62
|
+
get emptyStateSubtitle() {
|
|
63
|
+
return "Sorry, no results were found for your search";
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
get emptyStateBody() {
|
|
67
|
+
return "Search Tips:";
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
get emptyStateSuggestions() {
|
|
71
|
+
return JSON.stringify(["Try a different filter selection"]);
|
|
72
|
+
}
|
|
73
|
+
|
|
59
74
|
get currentPageLength() {
|
|
60
75
|
if (this.loading) {
|
|
61
76
|
return "Loading Results...";
|
|
@@ -78,7 +93,7 @@ export default class ContentArchive extends LightningElement {
|
|
|
78
93
|
if (this.currentPage !== 1) {
|
|
79
94
|
pageInfo = `- Page ${this.currentPage}`;
|
|
80
95
|
}
|
|
81
|
-
return this.totalResults ? `Archive Results ${pageInfo}` : "
|
|
96
|
+
return this.totalResults ? `Archive Results ${pageInfo}` : "";
|
|
82
97
|
}
|
|
83
98
|
|
|
84
99
|
get spinnerSize() {
|
|
@@ -135,6 +150,15 @@ export default class ContentArchive extends LightningElement {
|
|
|
135
150
|
: ""
|
|
136
151
|
}`;
|
|
137
152
|
}
|
|
153
|
+
|
|
154
|
+
get languageTitle() {
|
|
155
|
+
return `Language ${
|
|
156
|
+
this.selectedFilterMenuData.language.length > 0
|
|
157
|
+
? `(${this.selectedFilterMenuData.language.length})`
|
|
158
|
+
: ""
|
|
159
|
+
}`;
|
|
160
|
+
}
|
|
161
|
+
|
|
138
162
|
get categoryTitle() {
|
|
139
163
|
return `Topic ${
|
|
140
164
|
this.selectedFilterMenuData.categories.length > 0
|
|
@@ -232,7 +256,8 @@ export default class ContentArchive extends LightningElement {
|
|
|
232
256
|
contentType: [...copy.contentType],
|
|
233
257
|
categories: [...copy.categories],
|
|
234
258
|
dates: [...copy.dates],
|
|
235
|
-
authors: []
|
|
259
|
+
authors: [],
|
|
260
|
+
language: []
|
|
236
261
|
};
|
|
237
262
|
}
|
|
238
263
|
|
|
@@ -243,7 +268,8 @@ export default class ContentArchive extends LightningElement {
|
|
|
243
268
|
contentType: [{ id: 1, name: "Blogs" }],
|
|
244
269
|
categories: [...copy.categories],
|
|
245
270
|
dates: [...copy.dates],
|
|
246
|
-
authors: [...copy.authors]
|
|
271
|
+
authors: [...copy.authors],
|
|
272
|
+
language: [...copy.language]
|
|
247
273
|
};
|
|
248
274
|
}
|
|
249
275
|
|
|
@@ -319,6 +345,7 @@ export default class ContentArchive extends LightningElement {
|
|
|
319
345
|
contentType: [],
|
|
320
346
|
dates: [],
|
|
321
347
|
authors: [],
|
|
348
|
+
language: [],
|
|
322
349
|
categories: []
|
|
323
350
|
};
|
|
324
351
|
|
|
@@ -328,6 +355,7 @@ export default class ContentArchive extends LightningElement {
|
|
|
328
355
|
setUrlParamValue({
|
|
329
356
|
[FilterNames.QUERY_CONTENT_FILTER]: [],
|
|
330
357
|
[FilterNames.QUERY_AUTHOR_FILTER]: [],
|
|
358
|
+
[FilterNames.QUERY_LANGUAGE_FILTER]: [],
|
|
331
359
|
[FilterNames.QUERY_CATEGORIES_FILTER]: [],
|
|
332
360
|
[FilterNames.QUERY_DATES_FILTER]: []
|
|
333
361
|
});
|
|
@@ -362,8 +390,16 @@ export default class ContentArchive extends LightningElement {
|
|
|
362
390
|
this.authorList = authors;
|
|
363
391
|
this.categoryList = categories;
|
|
364
392
|
this.filtersLoading = false;
|
|
365
|
-
|
|
366
|
-
|
|
393
|
+
this.languagesList = [
|
|
394
|
+
{ id: "english", name: "English" },
|
|
395
|
+
{ id: "japanese", name: "日本語" }
|
|
396
|
+
];
|
|
397
|
+
|
|
398
|
+
// note... this is super hacky... but necessary in order to both
|
|
399
|
+
// 1. actually filter the content
|
|
400
|
+
// 2. update the filter checkboxes to show that we filtered the content
|
|
401
|
+
this.updateAllFiltersFromUrl();
|
|
402
|
+
requestAnimationFrame(() => this.updateCheckedStatus());
|
|
367
403
|
}
|
|
368
404
|
}
|
|
369
405
|
|
|
@@ -465,8 +501,9 @@ export default class ContentArchive extends LightningElement {
|
|
|
465
501
|
this.mobileMatchMedia.addEventListener("change", this.onMobileChange);
|
|
466
502
|
|
|
467
503
|
if (this.posts.length === 0) {
|
|
468
|
-
this.fetchArchiveFilterList()
|
|
469
|
-
|
|
504
|
+
this.fetchArchiveFilterList().then(() => {
|
|
505
|
+
this.fetchPostsByCardType();
|
|
506
|
+
});
|
|
470
507
|
}
|
|
471
508
|
}
|
|
472
509
|
|
|
@@ -489,6 +526,7 @@ export default class ContentArchive extends LightningElement {
|
|
|
489
526
|
private updateAllFiltersFromUrl() {
|
|
490
527
|
const filters: FilterMenuData = {
|
|
491
528
|
[FilterNames.QUERY_AUTHOR_FILTER]: this.authorList,
|
|
529
|
+
[FilterNames.QUERY_LANGUAGE_FILTER]: this.languagesList,
|
|
492
530
|
[FilterNames.QUERY_DATES_FILTER]: this.dateList,
|
|
493
531
|
[FilterNames.QUERY_CATEGORIES_FILTER]: this.categoryList,
|
|
494
532
|
[FilterNames.QUERY_CONTENT_FILTER]: this.contentTypeList
|
|
@@ -4,9 +4,7 @@ export type ArchivePostAuthor = {
|
|
|
4
4
|
name: string;
|
|
5
5
|
slug: string;
|
|
6
6
|
url: string;
|
|
7
|
-
|
|
8
|
-
[key: string]: string;
|
|
9
|
-
};
|
|
7
|
+
image_src: string;
|
|
10
8
|
};
|
|
11
9
|
|
|
12
10
|
export type ArchivePost = {
|
|
@@ -15,6 +13,9 @@ export type ArchivePost = {
|
|
|
15
13
|
title: {
|
|
16
14
|
rendered: string;
|
|
17
15
|
};
|
|
16
|
+
acf: {
|
|
17
|
+
language: string;
|
|
18
|
+
};
|
|
18
19
|
type: string;
|
|
19
20
|
link: string;
|
|
20
21
|
excerpt: string;
|
|
@@ -23,6 +24,7 @@ export type ArchivePost = {
|
|
|
23
24
|
audio_url: string;
|
|
24
25
|
duration: string;
|
|
25
26
|
};
|
|
27
|
+
authors: any; // I'm not sure if this field actually exists, but we're trying to use it so let's include it in the type
|
|
26
28
|
_embedded: {
|
|
27
29
|
author: Array<ArchivePostAuthor>;
|
|
28
30
|
["wp:term"]: Array<
|
|
@@ -70,7 +72,8 @@ export type FilterMenuNames =
|
|
|
70
72
|
| "contentType"
|
|
71
73
|
| "dates"
|
|
72
74
|
| "authors"
|
|
73
|
-
| "categories"
|
|
75
|
+
| "categories"
|
|
76
|
+
| "language";
|
|
74
77
|
|
|
75
78
|
export type Filters = {
|
|
76
79
|
[key in FilterMenuNames]: any[];
|
|
@@ -95,4 +98,5 @@ export type FilterMenuData = {
|
|
|
95
98
|
dates: Array<FilterMenuItem>;
|
|
96
99
|
categories: Array<FilterMenuItem>;
|
|
97
100
|
authors: Array<FilterMenuItem>;
|
|
101
|
+
language: Array<FilterMenuItem>;
|
|
98
102
|
};
|