From 62172fb88397e983bfc4fabe2d98bfde8ace2eed Mon Sep 17 00:00:00 2001 From: Sag Date: Wed, 30 Aug 2023 17:24:04 +0200 Subject: [PATCH] Added basic Recommendations modal (#17877) refs https://github.com/TryGhost/Product/issues/3770 --- apps/portal/src/App.js | 4 ++ apps/portal/src/components/Frame.styles.js | 4 +- .../components/pages/RecommendationsPage.js | 72 +++++++++++++++++++ apps/portal/src/pages.js | 4 +- 4 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 apps/portal/src/components/pages/RecommendationsPage.js diff --git a/apps/portal/src/App.js b/apps/portal/src/App.js index f6ca06a605..c77a4fe280 100644 --- a/apps/portal/src/App.js +++ b/apps/portal/src/App.js @@ -792,6 +792,10 @@ export default class App extends React.Component { return { page: 'supportError' }; + } else if (path === 'recommendations') { + return { + page: 'recommendations' + }; } return {}; } diff --git a/apps/portal/src/components/Frame.styles.js b/apps/portal/src/components/Frame.styles.js index 6bba1a2842..30accb1d1e 100644 --- a/apps/portal/src/components/Frame.styles.js +++ b/apps/portal/src/components/Frame.styles.js @@ -22,6 +22,7 @@ import EmailSuppressionFAQ from './pages/EmailSuppressionFAQ.css'; import EmailReceivingFAQ from './pages/EmailReceivingFAQ.css'; import {TipsAndDonationsSuccessStyle} from './pages/SupportSuccess'; import {TipsAndDonationsErrorStyle} from './pages/SupportError'; +import {RecommendationsPageStyles} from './pages/RecommendationsPage'; // Global styles const FrameStyles = ` @@ -1227,6 +1228,7 @@ export function getFrameStyles({site}) { EmailSuppressionFAQ + EmailReceivingFAQ + TipsAndDonationsSuccessStyle + - TipsAndDonationsErrorStyle; + TipsAndDonationsErrorStyle + + RecommendationsPageStyles; return FrameStyle; } diff --git a/apps/portal/src/components/pages/RecommendationsPage.js b/apps/portal/src/components/pages/RecommendationsPage.js new file mode 100644 index 0000000000..dafad00484 --- /dev/null +++ b/apps/portal/src/components/pages/RecommendationsPage.js @@ -0,0 +1,72 @@ +import AppContext from '../../AppContext'; +import {useContext} from 'react'; + +// Dummy data for design purposes. To be deleted when wired up with real data. +const recommendations = [ + { + title: 'Mountains by bike', + url: 'https://unsplash.com/photos/1527pjeb6jg', + reason: 'Incredible photography, captivating stories.', + excerpt: 'Explore mountains with me and my bike!', + featured_image: 'https://unsplash.com/photos/1527pjeb6jg', + favicon: 'https://unsplash.com/photos/1527pjeb6jg' + }, + { + title: 'By the seaside', + url: 'https://unsplash.com/photos/V3l7m298DLg', + reason: 'Sea, sunsets, beers. What else do you need?', + excerpt: 'Enjoy the sea!', + featured_image: 'https://unsplash.com/photos/V3l7m298DLg', + favicon: 'https://unsplash.com/photos/V3l7m298DLg' + } +]; + +export const RecommendationsPageStyles = ` + .gh-portal-recommendation-item { + display: flex; + justify-content: space-between; + align-items: center; + padding: 10px; + } +`; + +const RecommendationItem = ({title, url, excerpt}) => { + const {t} = useContext(AppContext); + + return ( +
+
+

{title}

+

{excerpt}

+
+
+ {t('Visit')} +
+
+ ); +}; + +const RecommendationsPage = () => { + const {site, t} = useContext(AppContext); + + return ( +
+

{t('Recommendations')}

+

{t(`Here are a few other sites ${site.title} thinks you may enjoy.`)}

+ +
+ {recommendations.map((recommendation, index) => ( + + ))} +
+ + +
+ ); +}; + +export default RecommendationsPage; diff --git a/apps/portal/src/pages.js b/apps/portal/src/pages.js index 49b5d3aca4..89ee83e56d 100644 --- a/apps/portal/src/pages.js +++ b/apps/portal/src/pages.js @@ -16,6 +16,7 @@ import EmailReceivingFAQ from './components/pages/EmailReceivingFAQ'; import SupportPage from './components/pages/SupportPage'; import SupportSuccess from './components/pages/SupportSuccess'; import SupportError from './components/pages/SupportError'; +import RecommendationsPage from './components/pages/RecommendationsPage'; /** List of all available pages in Portal, mapped to their UI component * Any new page added to portal needs to be mapped here @@ -38,7 +39,8 @@ const Pages = { emailReceivingFAQ: EmailReceivingFAQ, support: SupportPage, supportSuccess: SupportSuccess, - supportError: SupportError + supportError: SupportError, + recommendations: RecommendationsPage }; /** Return page if valid, fallback to signup */