Skip to content

Commit

Permalink
Merge pull request #196 from adobecom/dev
Browse files Browse the repository at this point in the history
dev -> stage
  • Loading branch information
apganapa-adobe authored Aug 30, 2024
2 parents f8f87e1 + e1442b3 commit c7b357b
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 11 deletions.
5 changes: 5 additions & 0 deletions ecc/blocks/ecc-dashboard/ecc-dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@
transition: background-color 1s;
}

.ecc-dashboard table .no-search-results-row td {
padding: 40px 0;
text-align: center;
}

.ecc-dashboard table .event-row.highlight {
background-color: #EAEAEA;
}
Expand Down
30 changes: 24 additions & 6 deletions ecc/blocks/ecc-dashboard/ecc-dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,8 @@ function updatePaginationControl(pagination, currentPage, totalPages) {
}

function decoratePagination(props, config) {
if (!props.filteredData.length) return;

const totalPages = Math.ceil(props.filteredData.length / +config['page-size']);
const paginationContainer = createTag('div', { class: 'pagination-container' });
const chevLeft = getIcon('chev-left');
Expand Down Expand Up @@ -565,6 +567,8 @@ function initSorting(props, config) {
th.append(getIcon('chev-down'), getIcon('chev-up'));
th.classList.add('sortable', key);
th.addEventListener('click', () => {
if (!props.filteredData.length) return;

thead.querySelectorAll('th').forEach((h) => {
if (th !== h) {
h.classList.remove('active');
Expand All @@ -580,18 +584,31 @@ function initSorting(props, config) {
});
}

function buildNoSearchResultsScreen(el, config) {
const noSearchResultsRow = createTag('tr', { class: 'no-search-results-row' });
const noSearchResultsCol = createTag('td', { colspan: '100%' }, getIcon('empty-dashboard'), { parent: noSearchResultsRow });
createTag('h2', {}, config['no-search-results-heading'], { parent: noSearchResultsCol });
createTag('p', {}, config['no-search-results-text'], { parent: noSearchResultsCol });

el.append(noSearchResultsRow);
}

function populateTable(props, config) {
const tBody = props.el.querySelector('table.dashboard-table tbody');
tBody.innerHTML = '';

const endOfPage = Math.min(+config['page-size'], props.paginatedData.length);
if (!props.paginatedData.length) {
buildNoSearchResultsScreen(tBody, config);
} else {
const endOfPage = Math.min(+config['page-size'], props.paginatedData.length);

for (let i = 0; i < endOfPage; i += 1) {
populateRow(props, config, i);
}
for (let i = 0; i < endOfPage; i += 1) {
populateRow(props, config, i);
}

props.el.querySelector('.pagination-container')?.remove();
decoratePagination(props, config);
props.el.querySelector('.pagination-container')?.remove();
decoratePagination(props, config);
}
}

function filterData(props, config, query) {
Expand Down Expand Up @@ -685,6 +702,7 @@ async function buildDashboard(el, config) {
set(target, prop, value, receiver) {
target[prop] = value;
populateTable(receiver, config);

return true;
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default function init(component, props) {

const updateInputState = () => {
input.required = checkbox.checked;
if (!checkbox.checked) input.value = '';
};

if (checkbox && input) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ function updateImgUploadComponentConfigs(component) {

const configs = {
type,
altText: `Event ${component.classList[1]} image`,
targetUrl: `/v1/events/${getFilteredCachedResponse().eventId}/images`,
};

Expand Down Expand Up @@ -107,7 +106,7 @@ export default async function init(component, props) {

dialog.innerHTML = '';

createTag('h1', { slot: 'heading' }, `You are deleting the ${configs.altText.toLowerCase()}.`, { parent: dialog });
createTag('h1', { slot: 'heading' }, 'You are deleting this image.', { parent: dialog });
createTag('p', {}, 'Are you sure you want to do this? This cannot be undone.', { parent: dialog });
const buttonContainer = createTag('div', { class: 'button-container' }, '', { parent: dialog });
const dialogDeleteBtn = createTag('sp-button', { variant: 'secondary', slot: 'button' }, 'Yes, I want to delete this image', { parent: buttonContainer });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function prefillFields(component, props) {

contactHostEl.addEventListener('change', () => {
hostEmailEl.disabled = !contactHostEl.checked;
if (!contactHostEl.checked) hostEmailEl.value = '';
});
}
}
Expand Down Expand Up @@ -62,7 +63,6 @@ export async function onUpdate(component, props) {
if (!props.eventDataResp) return;

if (props.eventDataResp.cloudType === 'CreativeCloud') {
component.querySelector('.attendee-count-wrapper')?.classList.add('hidden');
component.querySelector('#registration-allow-waitlist')?.classList.add('hidden');
}

Expand Down
2 changes: 1 addition & 1 deletion ecc/components/partner-selector/partner-selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export default class PartnerSelector extends LitElement {
const sponsorData = await uploadImage(file, {
targetUrl: `/v1/series/${this.seriesId}/sponsors/${this.partner.sponsorId}/images`,
type: 'sponsor-image',
altText: `${this.partner.name} image`,
altText: `${this.partner.name}`,
}, null, respJson.image?.imageId);

if (sponsorData) {
Expand Down
1 change: 0 additions & 1 deletion ecc/components/profile/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ export class Profile extends LitElement {
{
targetUrl: `/v1/series/${this.seriesId}/speakers/${profile.speakerId}/images`,
type: 'speaker-photo',
altText: `${this.profile.firstName} ${this.profile.lastName} photo`,
},
null,
lastPhoto?.imageId,
Expand Down
10 changes: 10 additions & 0 deletions tools/sidekick/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@
"excludePaths": [ "/**" ],
"includePaths": [ "**/:x**" ]
},
{
"containerId": "tools",
"id": "localize-2",
"title": "Localize project (V2)",
"environments": [ "edit" ],
"url": "https://main--ecc-milo--adobecom.hlx.page/tools/loc?milolibs=locui",
"passReferrer": true,
"passConfig": true,
"includePaths": [ "**.xlsx**" ]
},
{
"containerId": "tools",
"title": "Check Schema",
Expand Down

0 comments on commit c7b357b

Please sign in to comment.