0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-04-08 02:52:39 -05:00

Added WIP offer page shell

refs https://github.com/TryGhost/Team/issues/1139

- adds basic offer page shell for offer screen development
This commit is contained in:
Rishabh 2021-10-13 19:33:41 +05:30
parent 136913e799
commit e34cf74735
4 changed files with 51 additions and 8 deletions

View file

@ -18,8 +18,8 @@ const React = require('react');
const DEV_MODE_DATA = {
showPopup: true,
site: Fixtures.site,
member: Fixtures.member.paid,
page: 'signup'
member: Fixtures.member.free,
page: 'offer'
};
function SentryErrorBoundary({site, children}) {
@ -518,13 +518,20 @@ export default class App extends React.Component {
}
handleOfferQuery({site, offerId}) {
removePortalLinkFromUrl();
const prices = getAvailablePrices({site});
const priceId = prices?.[0]?.id;
if (this.state.member) {
this.dispatchAction('checkoutPlan', {plan: priceId, offerId});
const showOfferScreen = false;
if (showOfferScreen) {
this.dispatchAction('openPopup', {
page: 'offer'
});
} else {
this.dispatchAction('signup', {plan: priceId, offerId});
removePortalLinkFromUrl();
if (this.state.member) {
this.dispatchAction('checkoutPlan', {plan: priceId, offerId});
} else {
this.dispatchAction('signup', {plan: priceId, offerId});
}
}
}

View file

@ -0,0 +1,14 @@
import {offer} from '../../utils/fixtures';
const React = require('react');
export default class OfferPage extends React.Component {
render() {
return (
<div className='gh-portal-content'>
<div style={{paddingLeft: '16px', paddingRight: '16px', paddingTop: '12px'}}>
Offer - {offer.name}
</div>
</div>
);
}
}

View file

@ -6,6 +6,7 @@ import LoadingPage from './components/pages/LoadingPage';
import AccountPlanPage from './components/pages/AccountPlanPage';
import AccountProfilePage from './components/pages/AccountProfilePage';
import LinkPage from './components/pages/LinkPage';
import OfferPage from './components/pages/OfferPage';
/** List of all available pages in Portal, mapped to their UI component
* Any new page added to portal needs to be mapped here
@ -18,7 +19,8 @@ const Pages = {
accountProfile: AccountProfilePage,
magiclink: MagicLinkPage,
loading: LoadingPage,
links: LinkPage
links: LinkPage,
offer: OfferPage
};
/** Return page if valid, fallback to signup */
@ -33,4 +35,4 @@ export const isAccountPage = function ({page}) {
return page.includes('account');
};
export default Pages;
export default Pages;

View file

@ -339,6 +339,26 @@ export const testSite = {
portal_plans: ['free', 'monthly', 'yearly']
};
export const offer = {
id: '615fc537e1a950452c06e64d',
name: 'Black Friday',
code: 'black-friday',
display_title: 'Black Friday Special',
display_description: 'Black Friday Sale!',
type: 'percent',
cadence: 'month',
amount: 50,
duration: 'once',
duration_in_months: null,
currency_restriction: false,
currency: null,
status: 'active',
tier: {
id: '61233747fa18731c77a36691',
name: 'Basic'
}
};
export function generateAccountPlanFixture() {
return {
site: {