Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mwpw 151240 performance improvement #51

Merged
merged 6 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions eds/blocks/knowledge-base-overview/KnowledgeBaseOverview.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
import PartnerCardsWithDateFilter from '../../components/PartnerCardsWithDateFilter.js';

export default class KnowledgeBaseOverview extends PartnerCardsWithDateFilter {
constructor() {
super();
this.useStageCaasEndpoint = true;
}
}
export default class KnowledgeBaseOverview extends PartnerCardsWithDateFilter {}
13 changes: 10 additions & 3 deletions eds/blocks/knowledge-base-overview/knowledge-base-overview.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { getLibs, replaceText, getConfig, populateLocalizedTextFromListItems } from '../../scripts/utils.js';
import { getCaasUrl, getLibs } from '../../scripts/utils.js';
import { replaceText, getConfig, populateLocalizedTextFromListItems } from '../utils/utils.js';
import KnowledgeBaseOverview from './KnowledgeBaseOverview.js';

function declareKnowledgeBaseOverview() {
Expand Down Expand Up @@ -70,14 +71,20 @@ export default async function init(el) {
],
};

const block = {
el,
name: 'knowledge-base-overview',
collectionTag: '"caas:adobe-partners/collections/knowledge-base"',
ietf: config.locale.ietf
}

const blockData = {
localizedText,
tableData: el.children,
dateFilter,
cardsPerPage: 12,
ietf: config.locale.ietf,
collectionTags: '"caas:adobe-partners/collections/knowledge-base"',
pagination: 'default',
caasUrl: getCaasUrl(block)
};

const app = document.createElement('knowledge-base-overview');
Expand Down
13 changes: 10 additions & 3 deletions eds/blocks/partner-news/partner-news.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { getLibs, replaceText, getConfig, populateLocalizedTextFromListItems } from '../../scripts/utils.js';
import { getCaasUrl, getLibs } from '../../scripts/utils.js';
import { replaceText, getConfig, populateLocalizedTextFromListItems } from '../utils/utils.js';
import PartnerNews from './PartnerNews.js';

function declarePartnerNews() {
Expand Down Expand Up @@ -70,14 +71,20 @@ export default async function init(el) {
],
};

const block = {
el,
name: 'partner-news',
collectionTag: '"caas:adobe-partners/collections/news"',
ietf: config.locale.ietf
}

const blockData = {
localizedText,
tableData: el.children,
dateFilter,
cardsPerPage: 12,
ietf: config.locale.ietf,
collectionTags: '"caas:adobe-partners/collections/news"',
pagination: 'load-more',
caasUrl: getCaasUrl(block)
};

const app = document.createElement('partner-news');
Expand Down
20 changes: 20 additions & 0 deletions eds/blocks/utils/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { setLibs } from '../../scripts/utils.js';

const miloLibs = setLibs('/libs');

const { createTag, localizeLink, getConfig } = await import(`${miloLibs}/utils/utils.js`);

export { createTag, localizeLink, getConfig };
const { replaceText } = await import(`${miloLibs}/features/placeholders.js`);
export { replaceText };

export function populateLocalizedTextFromListItems(el, localizedText) {
const liList = Array.from(el.querySelectorAll('li'));
liList.forEach((liEl) => {
const liInnerText = liEl.innerText;
if (!liInnerText) return;
let liContent = liInnerText.trim().toLowerCase().replace(/ /g, '-');
if (liContent.endsWith('_default')) liContent = liContent.slice(0, -8);
localizedText[`{{${liContent}}}`] = liContent;
});
}
141 changes: 0 additions & 141 deletions eds/components/NewsCardStyles.js

This file was deleted.

Loading
Loading