From 49400ca5260ed57c7def996ebe43c555dab7ae8c Mon Sep 17 00:00:00 2001 From: Vesa Luusua Date: Fri, 17 Feb 2023 18:43:08 +0200 Subject: [PATCH 1/8] P.js: remove requirement for children --- src/containers/PageBuilder/Primitives/P/P.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/containers/PageBuilder/Primitives/P/P.js b/src/containers/PageBuilder/Primitives/P/P.js index bb22870de..5df9db7c5 100644 --- a/src/containers/PageBuilder/Primitives/P/P.js +++ b/src/containers/PageBuilder/Primitives/P/P.js @@ -16,10 +16,11 @@ P.displayName = 'P'; P.defaultProps = { rootClassName: null, className: null, + children: null, }; P.propTypes = { rootClassName: string, className: string, - children: node.isRequired, + children: node, }; From c69475e5976ade2eba55f975488995e6362dad5b Mon Sep 17 00:00:00 2001 From: Vesa Luusua Date: Wed, 22 Feb 2023 15:51:45 +0200 Subject: [PATCH 2/8] Fix wrong asset name --- src/containers/AuthenticationPage/AuthenticationPage.duck.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/containers/AuthenticationPage/AuthenticationPage.duck.js b/src/containers/AuthenticationPage/AuthenticationPage.duck.js index 3de1a6c9d..9f4524cfd 100644 --- a/src/containers/AuthenticationPage/AuthenticationPage.duck.js +++ b/src/containers/AuthenticationPage/AuthenticationPage.duck.js @@ -2,6 +2,6 @@ import { fetchPageAssets } from '../../ducks/hostedAssets.duck'; export const ASSET_NAME = 'terms-of-service'; export const loadData = (params, search) => dispatch => { - const pageAsset = { termsOfServicePage: `content/pages/${ASSET_NAME}.json` }; + const pageAsset = { termsOfService: `content/pages/${ASSET_NAME}.json` }; return dispatch(fetchPageAssets(pageAsset, true)); }; From afbba28b2ab54413287a7be1b5395dd95c3427f7 Mon Sep 17 00:00:00 2001 From: Vesa Luusua Date: Wed, 22 Feb 2023 16:36:59 +0200 Subject: [PATCH 3/8] Update changelog --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 67193613b..6b21d5a2d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,9 @@ way to update this template, but currently, we follow a pattern: ## Upcoming version 2022-XX-XX +- [fix] AuthenticationPage.duck.js: had wrong asset name. + [#1588](https://github.com/sharetribe/ftw-daily/pull/1588) + ## [v10.0.0] 2023-02-14 - [add] This adds support for page asset files that can be created in Console. These asset files are From 9097a6be49722ad28b69f5a2bfb1be2779ab12c4 Mon Sep 17 00:00:00 2001 From: Vesa Luusua Date: Thu, 23 Feb 2023 17:47:39 +0200 Subject: [PATCH 4/8] Improve error handling possibilities for PageBuilder --- src/containers/LandingPage/FallbackPage.js | 39 +++++++++++++------ src/containers/LandingPage/LandingPage.js | 21 ++++------ src/containers/PageBuilder/PageBuilder.js | 12 +++++- .../PrivacyPolicyPage/PrivacyPolicyPage.js | 19 ++++----- .../TermsOfServicePage/TermsOfServicePage.js | 20 ++++------ 5 files changed, 59 insertions(+), 52 deletions(-) diff --git a/src/containers/LandingPage/FallbackPage.js b/src/containers/LandingPage/FallbackPage.js index 0e5fa509e..0bbfc768d 100644 --- a/src/containers/LandingPage/FallbackPage.js +++ b/src/containers/LandingPage/FallbackPage.js @@ -3,11 +3,13 @@ import PageBuilder from '../PageBuilder/PageBuilder'; import css from './FallbackPage.module.css'; // Create fallback content (array of sections) in page asset format: -export const fallbackSections = { +export const fallbackSections = error => ({ sections: [ { sectionType: 'customMaintenance', sectionId: 'maintenance-mode', + // pass possible error to SectionMaintenanceMode component + error, }, ], meta: { @@ -20,37 +22,50 @@ export const fallbackSections = { content: 'Home page fetch failed', }, }, -}; +}); // Note: this microcopy/translation does not come from translation file. // It needs to be something that is not part of fetched assets but built-in text const SectionMaintenanceMode = props => { - const { sectionId } = props; + const { sectionId, error } = props; + // 404 means that the landing-page asset was not found from the expected asset path + // which is defined in config.js + const is404 = error?.status === 404; return (
-
-

Maintenance mode

-

- The marketplace is not fully operational at the moment. Try refreshing the page and if - that does not solve the issue, contact the marketplace admins. -

-
+ {is404 ? ( +
+

Maintenance mode

+

+ The marketplace is not fully operational at the moment. +
+ Try refreshing the page and if that does not solve the issue, contact the marketplace + admins. +

+
+ ) : ( +
+

Oops, something went wrong!

+

{error?.message}

+
+ )}
); }; // This is the fallback page, in case there's no Landing Page asset defined in Console. const FallbackPage = props => { + const { error, ...rest } = props; return ( ); }; diff --git a/src/containers/LandingPage/LandingPage.js b/src/containers/LandingPage/LandingPage.js index 857a239ec..109862ca1 100644 --- a/src/containers/LandingPage/LandingPage.js +++ b/src/containers/LandingPage/LandingPage.js @@ -2,10 +2,9 @@ import React from 'react'; import { bool, object } from 'prop-types'; import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withRouter } from 'react-router-dom'; -import { injectIntl, intlShape } from '../../util/reactIntl'; import { camelize } from '../../util/string'; +import { propTypes } from '../../util/types'; import PageBuilder from '../../containers/PageBuilder/PageBuilder'; @@ -13,27 +12,27 @@ import FallbackPage from './FallbackPage'; import { ASSET_NAME } from './LandingPage.duck'; export const LandingPageComponent = props => { - const { pageAssetsData, inProgress } = props; + const { pageAssetsData, inProgress, error } = props; return ( } + error={error} + fallbackPage={} /> ); }; LandingPageComponent.propTypes = { - // from injectIntl - intl: intlShape.isRequired, pageAssetsData: object, inProgress: bool, + error: propTypes.error, }; const mapStateToProps = state => { - const { pageAssetsData, inProgress } = state.hostedAssets || {}; - return { pageAssetsData, inProgress }; + const { pageAssetsData, inProgress, error } = state.hostedAssets || {}; + return { pageAssetsData, inProgress, error }; }; // Note: it is important that the withRouter HOC is **outside** the @@ -42,10 +41,6 @@ const mapStateToProps = state => { // lifecycle hook. // // See: https://github.com/ReactTraining/react-router/issues/4671 -const LandingPage = compose( - withRouter, - connect(mapStateToProps), - injectIntl -)(LandingPageComponent); +const LandingPage = compose(connect(mapStateToProps))(LandingPageComponent); export default LandingPage; diff --git a/src/containers/PageBuilder/PageBuilder.js b/src/containers/PageBuilder/PageBuilder.js index 0acf02e93..9ff01796f 100644 --- a/src/containers/PageBuilder/PageBuilder.js +++ b/src/containers/PageBuilder/PageBuilder.js @@ -73,9 +73,17 @@ const getMetadata = (meta, schemaType, fieldOptions) => { * @returns page component */ const PageBuilder = props => { - const { pageAssetsData, inProgress, fallbackPage, schemaType, options, ...pageProps } = props; + const { + pageAssetsData, + inProgress, + error, + fallbackPage, + schemaType, + options, + ...pageProps + } = props; - if (!pageAssetsData && fallbackPage && !inProgress) { + if (!pageAssetsData && fallbackPage && !inProgress && error) { return fallbackPage; } diff --git a/src/containers/PrivacyPolicyPage/PrivacyPolicyPage.js b/src/containers/PrivacyPolicyPage/PrivacyPolicyPage.js index 85b6a0568..927032153 100644 --- a/src/containers/PrivacyPolicyPage/PrivacyPolicyPage.js +++ b/src/containers/PrivacyPolicyPage/PrivacyPolicyPage.js @@ -2,10 +2,9 @@ import React from 'react'; import { bool, object } from 'prop-types'; import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withRouter } from 'react-router-dom'; -import { injectIntl, intlShape } from '../../util/reactIntl'; import { camelize } from '../../util/string'; +import { propTypes } from '../../util/types'; import { H1 } from '../PageBuilder/Primitives/Heading'; import PageBuilder, { SectionBuilder } from '../../containers/PageBuilder/PageBuilder'; @@ -47,27 +46,27 @@ const PrivacyPolicyContent = props => { // Presentational component for PrivacyPolicyPage const PrivacyPolicyPageComponent = props => { - const { pageAssetsData, inProgress } = props; + const { pageAssetsData, inProgress, error } = props; return ( } /> ); }; PrivacyPolicyPageComponent.propTypes = { - // from injectIntl - intl: intlShape.isRequired, pageAssetsData: object, inProgress: bool, + error: propTypes.error, }; const mapStateToProps = state => { - const { pageAssetsData, inProgress } = state.hostedAssets || {}; - return { pageAssetsData, inProgress }; + const { pageAssetsData, inProgress, error } = state.hostedAssets || {}; + return { pageAssetsData, inProgress, error }; }; // Note: it is important that the withRouter HOC is **outside** the @@ -76,11 +75,7 @@ const mapStateToProps = state => { // lifecycle hook. // // See: https://github.com/ReactTraining/react-router/issues/4671 -const PrivacyPolicyPage = compose( - withRouter, - connect(mapStateToProps), - injectIntl -)(PrivacyPolicyPageComponent); +const PrivacyPolicyPage = compose(connect(mapStateToProps))(PrivacyPolicyPageComponent); const PRIVACY_POLICY_ASSET_NAME = ASSET_NAME; export { PRIVACY_POLICY_ASSET_NAME, PrivacyPolicyPageComponent, PrivacyPolicyContent }; diff --git a/src/containers/TermsOfServicePage/TermsOfServicePage.js b/src/containers/TermsOfServicePage/TermsOfServicePage.js index 56817ac50..91ee32feb 100644 --- a/src/containers/TermsOfServicePage/TermsOfServicePage.js +++ b/src/containers/TermsOfServicePage/TermsOfServicePage.js @@ -2,11 +2,9 @@ import React from 'react'; import { bool, object } from 'prop-types'; import { compose } from 'redux'; import { connect } from 'react-redux'; -import { withRouter } from 'react-router-dom'; -import config from '../../config'; -import { injectIntl, intlShape } from '../../util/reactIntl'; import { camelize } from '../../util/string'; +import { propTypes } from '../../util/types'; import { H1 } from '../PageBuilder/Primitives/Heading'; import PageBuilder, { SectionBuilder } from '../../containers/PageBuilder/PageBuilder'; @@ -48,27 +46,27 @@ const TermsOfServiceContent = props => { // Presentational component for TermsOfServicePage const TermsOfServicePageComponent = props => { - const { pageAssetsData, inProgress } = props; + const { pageAssetsData, inProgress, error } = props; return ( } /> ); }; TermsOfServicePageComponent.propTypes = { - // from injectIntl - intl: intlShape.isRequired, pageAssetsData: object, inProgress: bool, + error: propTypes.error, }; const mapStateToProps = state => { - const { pageAssetsData, inProgress } = state.hostedAssets || {}; - return { pageAssetsData, inProgress }; + const { pageAssetsData, inProgress, error } = state.hostedAssets || {}; + return { pageAssetsData, inProgress, error }; }; // Note: it is important that the withRouter HOC is **outside** the @@ -77,11 +75,7 @@ const mapStateToProps = state => { // lifecycle hook. // // See: https://github.com/ReactTraining/react-router/issues/4671 -const TermsOfServicePage = compose( - withRouter, - connect(mapStateToProps), - injectIntl -)(TermsOfServicePageComponent); +const TermsOfServicePage = compose(connect(mapStateToProps))(TermsOfServicePageComponent); const TOS_ASSET_NAME = ASSET_NAME; export { TOS_ASSET_NAME, TermsOfServicePageComponent, TermsOfServiceContent }; From bc2a666786af30654d24faf8b6d6cb7ec1ea0413 Mon Sep 17 00:00:00 2001 From: Vesa Luusua Date: Thu, 23 Feb 2023 17:57:24 +0200 Subject: [PATCH 5/8] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b21d5a2d..949980a38 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ way to update this template, but currently, we follow a pattern: ## Upcoming version 2022-XX-XX +- [change] improve error handling possibilities on PageBuilder. + [#1589](https://github.com/sharetribe/ftw-daily/pull/1589) - [fix] AuthenticationPage.duck.js: had wrong asset name. [#1588](https://github.com/sharetribe/ftw-daily/pull/1588) From 1489ff827a206b31a6d90fd7ad8b8a911332f0d0 Mon Sep 17 00:00:00 2001 From: Vesa Luusua Date: Tue, 28 Feb 2023 14:12:18 +0200 Subject: [PATCH 6/8] Remove background-color from image to allow opacity --- .../BlockBuilder/BlockDefault/BlockDefault.module.css | 1 - src/containers/PageBuilder/Primitives/Image/Image.js | 2 +- .../PageBuilder/Primitives/Image/Image.module.css | 6 +++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/containers/PageBuilder/BlockBuilder/BlockDefault/BlockDefault.module.css b/src/containers/PageBuilder/BlockBuilder/BlockDefault/BlockDefault.module.css index 41409affe..330371147 100644 --- a/src/containers/PageBuilder/BlockBuilder/BlockDefault/BlockDefault.module.css +++ b/src/containers/PageBuilder/BlockBuilder/BlockDefault/BlockDefault.module.css @@ -3,7 +3,6 @@ .media { width: 100%; - background-color: var(--matterColorNegative); /* Loading state color for the images */ border-radius: 8px; margin-bottom: 0; } diff --git a/src/containers/PageBuilder/Primitives/Image/Image.js b/src/containers/PageBuilder/Primitives/Image/Image.js index 9268b6ff5..7098e2007 100644 --- a/src/containers/PageBuilder/Primitives/Image/Image.js +++ b/src/containers/PageBuilder/Primitives/Image/Image.js @@ -40,7 +40,7 @@ export const FieldImage = React.forwardRef((props, ref) => { const firstImageVariant = variants[variantNames[0]]; const { width: aspectWidth, height: aspectHeight } = firstImageVariant || {}; - const classes = classNames(rootClassName || css.markdownImage, className); + const classes = classNames(rootClassName || css.fieldImage, className); return ( Date: Tue, 28 Feb 2023 14:13:42 +0200 Subject: [PATCH 7/8] Update changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 949980a38..07df6505a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,8 @@ way to update this template, but currently, we follow a pattern: ## Upcoming version 2022-XX-XX +- [change] remove background-color from images (to allow opacity). + [#1590](https://github.com/sharetribe/ftw-daily/pull/1590) - [change] improve error handling possibilities on PageBuilder. [#1589](https://github.com/sharetribe/ftw-daily/pull/1589) - [fix] AuthenticationPage.duck.js: had wrong asset name. From f3fa119afd5c30cdea2a20451e60f3dbd374a0cb Mon Sep 17 00:00:00 2001 From: Vesa Luusua Date: Tue, 28 Feb 2023 16:23:41 +0200 Subject: [PATCH 8/8] New release: v10.1.0 --- CHANGELOG.md | 8 +++++++- package.json | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 07df6505a..3baf75bfa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,9 @@ way to update this template, but currently, we follow a pattern: --- -## Upcoming version 2022-XX-XX +## Upcoming version 2023-XX-XX + +## [v10.1.0] 2023-02-28 - [change] remove background-color from images (to allow opacity). [#1590](https://github.com/sharetribe/ftw-daily/pull/1590) @@ -20,6 +22,10 @@ way to update this template, but currently, we follow a pattern: [#1589](https://github.com/sharetribe/ftw-daily/pull/1589) - [fix] AuthenticationPage.duck.js: had wrong asset name. [#1588](https://github.com/sharetribe/ftw-daily/pull/1588) +- [change] P.js: remove requirement for mandatory children. + [#1587](https://github.com/sharetribe/ftw-daily/pull/1587) + + [v10.1.0]: https://github.com/sharetribe/ftw-daily/compare/v10.0.0.../v10.1.0 ## [v10.0.0] 2023-02-14 diff --git a/package.json b/package.json index 30ccb6035..f36cf8383 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "app", - "version": "10.0.0", + "version": "10.1.0", "private": true, "license": "Apache-2.0", "dependencies": {