Skip to content

Commit

Permalink
Merge branch 'main' into new-geos
Browse files Browse the repository at this point in the history
update branch with main
  • Loading branch information
Ruchika Sinha authored and Ruchika Sinha committed Jan 9, 2024
2 parents f42c0f9 + 47dc30b commit a368976
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 8 deletions.
28 changes: 24 additions & 4 deletions creativecloud/features/firefly/firefly-interactive.css
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
}

.interactive-marquee.firefly .interactive-container {
height: 430px;
height: 440px;
}

.interactive-marquee.firefly .media {
Expand Down Expand Up @@ -125,6 +125,11 @@
right: -122px;
}

[dir="rtl"] .firefly-selectortray {
left: -122px;
right: 446px;
}

.firefly-prompt {
top: 40px;
margin-inline: 40px;
Expand All @@ -138,25 +143,40 @@
}

@media screen and (max-width: 1799px) and (min-width: 1650px) {
[dir="ltr"] .firefly-selectortray {
.firefly-selectortray {
top: 144px;
position: absolute;
right: -85px;
}

[dir="rtl"] .firefly-selectortray {
left: -85px;
right: 399px;
}
}

@media screen and (max-width: 1649px) and (min-width: 1438px) {
[dir="ltr"] .firefly-selectortray {
.firefly-selectortray {
top: 144px;
position: absolute;
right: -35px;
}

[dir="rtl"] .firefly-selectortray {
left: -35px;
right: 359px;
}
}

@media screen and (max-width: 1437px) and (min-width: 1200px) {
[dir="ltr"] .firefly-selectortray {
.firefly-selectortray {
top: 144px;
position: absolute;
right: 5px;
}

[dir="rtl"] .firefly-selectortray {
left: 5px;
right: 319px;
}
}
2 changes: 1 addition & 1 deletion creativecloud/features/firefly/firefly-susi.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function redirectWithParam() {

export const signIn = (prompt, paramKey) => {
const url = new URL(window.location.href);
url.searchParams.delete('goToFirefly', 'goToFireflyEffects', 'goToFireflyGenFill');
url.searchParams.delete('goToFirefly', 'goToFireflyEffects', 'goToFireflyGenFill', 'prompt', 'seed', 'ff_channel', 'ff_campaign', 'ff_source');
url.searchParams.set(paramKey, encodeURI(prompt));
const stageSigninObj = { dctx_id: 'v:2,s,f,bg:firefly2023,2e2b3d80-4e50-11ee-acbc-ab67eaa89524', redirect_uri: url.href };
const prodSigninObj = { dctx_id: 'v:2,s,f,bg:firefly2023,cea19bc0-4e72-11ee-888a-c95a795c7f23', redirect_uri: url.href };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,19 @@
display: block;
}

[dir="rtl"] .enticement-arrow {
right: -54px;
transform: scaleX(-1);
}

.enticement-text {
display: block;
}

[dir="rtl"] .enticement-text {
position: absolute;
left: var(--spacing-xxs);
right: var(--spacing-xxs);
margin: 40px -20px 16px 0;
}

.genfill-prompt {
Expand Down Expand Up @@ -263,13 +269,19 @@
display: block;
}

[dir="rtl"] .enticement-arrow {
right: -54px;
transform: scaleX(-1);
}

.enticement-text {
display: block;
}

[dir="rtl"] .enticement-text {
position: absolute;
left: var(--spacing-xxs);
right: var(--spacing-xxs);
margin: 40px -20px 16px 0;
}

.options {
Expand Down
46 changes: 46 additions & 0 deletions creativecloud/scripts/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,49 @@ export const [setLibs, getLibs] = (() => {
}, () => libs,
];
})();

function getDecorateAreaFn() {
let lcpImgSet = false;

// Load LCP image immediately
const eagerLoad = (lcpImg) => {
lcpImg?.setAttribute('loading', 'eager');
lcpImg?.setAttribute('fetchpriority', 'high');
if (lcpImg) lcpImgSet = true;
};

async function loadLCPImage(area = document, { fragmentLink = null } = {}) {
const firstBlock = area.querySelector('body > main > div > div');
let fgDivs = null;
switch (true) {
case firstBlock?.classList.contains('changebg'): {
firstBlock.querySelector(':scope > div:nth-child(1)').querySelectorAll('img').forEach(eagerLoad);
const { getConfig } = await import(`${getLibs()}/utils/utils.js`);
import(`${getConfig().codeRoot}/creativecloud/deps/interactive-marquee-changebg/changeBgMarquee.js`);
break;
}
case firstBlock?.classList.contains('marquee'):
firstBlock.querySelectorAll('img').forEach(eagerLoad);
break;
case firstBlock?.classList.contains('interactive-marquee'):
firstBlock.querySelector(':scope > div:nth-child(1)').querySelectorAll('img').forEach(eagerLoad);
fgDivs = firstBlock.querySelector(':scope > div:nth-child(2)').querySelectorAll('div:not(:first-child)');
fgDivs.forEach((d) => eagerLoad(d.querySelector('img')));
break;
case !!fragmentLink:
if (window.document.querySelector('a.fragment') === fragmentLink && !window.document.querySelector('img[loading="eager"]')) {
eagerLoad(area.querySelector('img'));
}
break;
default:
if (!fragmentLink) eagerLoad(area.querySelector('img'));
break;
}
}

return (area, options) => {
if (!lcpImgSet) loadLCPImage(area, options);
};
}

export const decorateArea = getDecorateAreaFn();
2 changes: 1 addition & 1 deletion helix-query.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ indices:

merch-cards:
include:
- /cc-shared/fragments/merch/**/cards/**
- /cc-shared/fragments/merch/**/merch-card/**
target: /cc-shared/assets/query-index-cards.xslx
properties:
lastModified:
Expand Down

0 comments on commit a368976

Please sign in to comment.