Skip to content

Commit

Permalink
Merge branch 'CURB-4263-merge-pwa6-and-pwa7' into CURB-4478-complete-…
Browse files Browse the repository at this point in the history
…translations
  • Loading branch information
aylinuenal committed Oct 7, 2024
2 parents 35cf2ba + e15f976 commit d2d7131
Show file tree
Hide file tree
Showing 12 changed files with 195 additions and 457 deletions.
5 changes: 4 additions & 1 deletion libraries/common/collections/media-providers/Vimeo.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ class VimeoMediaProvider extends MediaProvider {

const players = [];

iframes.forEach((iframe) => {
iframes.forEach((iframe, index) => {
// Block clicks on Vimeo icon
iframes[index].sandbox = 'allow-forms allow-scripts allow-pointer-lock allow-same-origin allow-top-navigation';

this.responsify(iframe);
players.push(new window.Vimeo.Player(iframe));
});
Expand Down
3 changes: 3 additions & 0 deletions libraries/common/collections/media-providers/YouTube.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class YouTubeMediaProvider extends MediaProvider {

// Update the video urls to enable stopping videos via the event API.
iframes.forEach((iframe, index) => {
// Block clicks on YouTube icon
iframes[index].sandbox = 'allow-forms allow-scripts allow-pointer-lock allow-same-origin allow-top-navigation';

this.responsify(iframe);

const { src } = iframe;
Expand Down
2 changes: 1 addition & 1 deletion libraries/engage/components/__mocks__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export const TaxDisclaimer = () => 'TaxDisclaimer';

// HELPERS
export const I18n = {
Text: () => 'I18n.Text',
Text: ({ string }) => string,
Placeholder: () => null,
Price: () => null,
};
Expand Down
12 changes: 6 additions & 6 deletions libraries/engage/favorites/components/Item/Item.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ const styles = {

/**
* Favorite Item component
* @return {JSX}
* @return {JSX.Element}
*/
const FavoriteItem = ({
listId,
Expand Down Expand Up @@ -321,17 +321,17 @@ const FavoriteItem = ({
return (
<ProductListEntryProvider productId={product.id}>
<SurroundPortals portalName={FAVORITES_LIST_ITEM} portalProps={product}>
<div className={styles.root}>
<div className={classNames(styles.root, 'engage__favorites__item')}>
<Link
className={styles.imageContainer}
className={classNames(styles.imageContainer, 'engage__favorites__item__image-container')}
component="div"
href={productLink}
aria-hidden
>
<ProductImage src={product.featuredImageBaseUrl} resolutions={gridResolutions} />
<ProductImage className={classNames('engage__favorites__item__image')} src={product.featuredImageBaseUrl} resolutions={gridResolutions} />
</Link>

<div className={styles.infoContainer}>
<div className={classNames(styles.infoContainer, 'engage__favorites__item__info-container')}>
<div className={classNames(styles.infoContainerRow)}>
<div className={styles.titleWrapper}>
<SurroundPortals
Expand All @@ -341,7 +341,7 @@ const FavoriteItem = ({
<TextLink
href={productLink}
tag="span"
className={styles.titleContainer}
className={classNames(styles.titleContainer, 'engage__favorites__item__title-container')}
>
<span
className={styles.title}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ exports[`engage > locations > StoreList > StoreDetails should render as expected
className="css-1lr3f02"
string="locations.hours_details"
>
I18n.Text
locations.hours_details
</Text>
<div
className="css-1btxmah"
Expand Down Expand Up @@ -140,7 +140,7 @@ exports[`engage > locations > StoreList > StoreDetails should render as expected
className="css-1lr3f02"
string="locations.phone"
>
I18n.Text
locations.phone
</Text>
</Grid.Item>
</Grid>
Expand Down Expand Up @@ -200,7 +200,7 @@ exports[`engage > locations > StoreList > StoreDetails should render as expected
className="css-1lr3f02"
string="locations.map_open"
>
I18n.Text
locations.map_open
</Text>
</Grid.Item>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ exports[`<Description /> should not render if no data is available 1`] = `
<Text
string="product.description_heading"
>
I18n.Text
product.description_heading
</Text>
</div>
<PlaceholderParagraph
Expand Down Expand Up @@ -120,7 +120,7 @@ exports[`<Description /> should render description if data is available 1`] = `
<Text
string="product.description_heading"
>
I18n.Text
product.description_heading
</Text>
</div>
<PlaceholderParagraph
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ exports[`<ChipsLayout /> should render with one chip 1`] = `
<Text
string="more"
>
I18n.Text
more
</Text>
</RippleButton>
</div>
Expand Down Expand Up @@ -338,7 +338,7 @@ exports[`<ChipsLayout /> should render with two chips 1`] = `
<Text
string="more"
>
I18n.Text
more
</Text>
</RippleButton>
</div>
Expand Down
48 changes: 32 additions & 16 deletions themes/theme-gmd/pages/Category/components/Content/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,55 @@ import PropTypes from 'prop-types';
import ProductFilters from 'Components/ProductFilters';
import { VIEW_CONTENT } from '@shopgate/engage/core';
import { SurroundPortals } from '@shopgate/engage/components';
import { hasNewServices } from '@shopgate/engage/core/helpers';
import ProductsContent from '../ProductsContent';
import Empty from '../Empty';
import CategoryListContent from '../CategoryListContent';
import connect from './connector';
import AppBar from '../AppBar';

/**
* @param {Object} props.categoryId The category id.
* @param {Object} props The component props.
* @param {string} props.categoryId The category id.
* @param {boolean} props.hasChildren Whether the category has children.
* @param {boolean} props.hasProducts Whether the category has products.
* @returns {JSX}
*/
const CategoryContent = ({ categoryId, hasProducts }) => (
<Fragment>
<AppBar filtersShown={hasProducts} categoryId={categoryId} />
<ProductFilters categoryId={categoryId} showFilters={hasProducts} />
<SurroundPortals portalName={VIEW_CONTENT}>
<CategoryListContent categoryId={categoryId} />
const CategoryContent = ({ categoryId, hasChildren, hasProducts }) => {
// Show filter logic for old services
let showFilters = hasProducts && !hasChildren;
// Show filter logic for new services
if (hasNewServices()) {
showFilters = hasProducts;
}

<ProductsContent categoryId={categoryId} hasProducts={hasProducts} />
<Empty
categoryId={categoryId}
headlineText="category.no_result.heading"
bodyText="category.no_result.body"
/>
</SurroundPortals>
</Fragment>
);
return (

<Fragment>
<AppBar filtersShown={hasProducts} categoryId={categoryId} />
<ProductFilters categoryId={categoryId} showFilters={showFilters} />
<SurroundPortals portalName={VIEW_CONTENT}>
<CategoryListContent categoryId={categoryId} />

<ProductsContent categoryId={categoryId} hasProducts={hasProducts} />
<Empty
categoryId={categoryId}
headlineText="category.no_result.heading"
bodyText="category.no_result.body"
/>
</SurroundPortals>
</Fragment>
);
};

CategoryContent.propTypes = {
categoryId: PropTypes.string.isRequired,
hasChildren: PropTypes.bool,
hasProducts: PropTypes.bool,
};

CategoryContent.defaultProps = {
hasChildren: false,
hasProducts: false,
};

Expand Down
45 changes: 29 additions & 16 deletions themes/theme-ios11/pages/Category/components/Content/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,45 @@ import PropTypes from 'prop-types';
import ProductFilters from 'Components/ProductFilters';
import { VIEW_CONTENT } from '@shopgate/engage/core';
import { SurroundPortals } from '@shopgate/engage/components';
import { hasNewServices } from '@shopgate/engage/core/helpers';
import ProductsContent from '../ProductsContent';
import Empty from '../Empty';
import CategoryListContent from '../CategoryListContent';
import connect from './connector';
import AppBar from '../AppBar';

/**
* @param {Object} props.categoryId The category id.
* @param {Object} props The component props.
* @param {string} props.categoryId The category id.
* @param {boolean} props.hasChildren Whether the category has children.
* @param {boolean} props.hasProducts Whether the category has products.
* @returns {JSX}
*/
const CategoryContent = ({ categoryId, hasChildren, hasProducts }) => (
<Fragment>
<AppBar hasProducts={hasProducts} hasChildren={hasChildren} categoryId={categoryId} />
<ProductFilters categoryId={categoryId} showFilters={hasProducts} />
<SurroundPortals portalName={VIEW_CONTENT}>
<CategoryListContent categoryId={categoryId} />
const CategoryContent = ({ categoryId, hasChildren, hasProducts }) => {
// Show filter logic for old services
let showFilters = hasProducts && !hasChildren;
// Show filter logic for new services
if (hasNewServices()) {
showFilters = hasProducts;
}

<ProductsContent categoryId={categoryId} hasProducts={hasProducts} />
<Empty
categoryId={categoryId}
headlineText="category.no_result.heading"
bodyText="category.no_result.body"
/>
</SurroundPortals>
</Fragment>
);
return (
<Fragment>
<AppBar hasProducts={hasProducts} hasChildren={hasChildren} categoryId={categoryId} />
<ProductFilters categoryId={categoryId} showFilters={showFilters} />
<SurroundPortals portalName={VIEW_CONTENT}>
<CategoryListContent categoryId={categoryId} />

<ProductsContent categoryId={categoryId} hasProducts={hasProducts} />
<Empty
categoryId={categoryId}
headlineText="category.no_result.heading"
bodyText="category.no_result.body"
/>
</SurroundPortals>
</Fragment>
);
};

CategoryContent.propTypes = {
categoryId: PropTypes.string.isRequired,
Expand Down
Loading

0 comments on commit d2d7131

Please sign in to comment.