mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 20:03:12 +03:00
Updated default page to signin for invite only sites
closes https://github.com/TryGhost/Team/issues/689 For invite only sites, the default page should be signin as it makes more sense and is actionable than a static signup page
This commit is contained in:
parent
0bbdccea72
commit
52d52c9a9e
@ -9,7 +9,7 @@ import * as Fixtures from './utils/fixtures';
|
||||
import ActionHandler from './actions';
|
||||
import './App.css';
|
||||
import NotificationParser from './utils/notifications';
|
||||
import {createPopupNotification, getCurrencySymbol, getFirstpromoterId, getQueryPrice, getSiteDomain, isComplimentaryMember, removePortalLinkFromUrl} from './utils/helpers';
|
||||
import {createPopupNotification, getCurrencySymbol, getFirstpromoterId, getQueryPrice, getSiteDomain, isComplimentaryMember, isInviteOnlySite, removePortalLinkFromUrl} from './utils/helpers';
|
||||
|
||||
const handleDataAttributes = require('./data-attributes');
|
||||
const React = require('react');
|
||||
@ -516,10 +516,11 @@ export default class App extends React.Component {
|
||||
}
|
||||
|
||||
/**Get final page set in App context from state data*/
|
||||
getContextPage({page, member}) {
|
||||
getContextPage({site, page, member}) {
|
||||
/**Set default page based on logged-in status */
|
||||
if (!page) {
|
||||
page = member ? 'accountHome' : 'signup';
|
||||
const loggedOutPage = isInviteOnlySite({site}) ? 'signin' : 'signup';
|
||||
page = member ? 'accountHome' : loggedOutPage;
|
||||
}
|
||||
|
||||
if (page === 'accountPlan' && isComplimentaryMember({member})) {
|
||||
@ -552,7 +553,7 @@ export default class App extends React.Component {
|
||||
/**Get final App level context from App state*/
|
||||
getContextFromState() {
|
||||
const {site, member, action, page, lastPage, showPopup, pageQuery, popupNotification} = this.state;
|
||||
const contextPage = this.getContextPage({page, member});
|
||||
const contextPage = this.getContextPage({site, page, member});
|
||||
const contextMember = this.getContextMember({page: contextPage, member});
|
||||
return {
|
||||
site,
|
||||
|
@ -9,6 +9,7 @@ import {ReactComponent as ButtonIcon3} from '../images/icons/button-icon-3.svg';
|
||||
import {ReactComponent as ButtonIcon4} from '../images/icons/button-icon-4.svg';
|
||||
import {ReactComponent as ButtonIcon5} from '../images/icons/button-icon-5.svg';
|
||||
import TriggerButtonStyle from './TriggerButton.styles';
|
||||
import {isInviteOnlySite} from '../utils/helpers';
|
||||
|
||||
const React = require('react');
|
||||
|
||||
@ -163,11 +164,12 @@ class TriggerButtonContent extends React.Component {
|
||||
}
|
||||
|
||||
onToggle() {
|
||||
const {showPopup, member} = this.context;
|
||||
const {showPopup, member, site} = this.context;
|
||||
if (showPopup) {
|
||||
this.context.onAction('closePopup');
|
||||
} else {
|
||||
const page = member ? 'accountHome' : 'signup';
|
||||
const loggedOutPage = isInviteOnlySite({site}) ? 'signin' : 'signup';
|
||||
const page = member ? 'accountHome' : loggedOutPage;
|
||||
this.context.onAction('openPopup', {page});
|
||||
}
|
||||
}
|
||||
|
@ -388,7 +388,7 @@ function PlanOptions({plans, selectedPlan, onPlanSelect, changePlan}) {
|
||||
const {site} = useContext(AppContext);
|
||||
const {free_price_name: freePriceName, free_price_description: freePriceDescription} = site;
|
||||
addDiscountToPlans(plans);
|
||||
return plans.map(({ name, currency_symbol: currencySymbol, amount, description, interval, id}) => {
|
||||
return plans.map(({name, currency_symbol: currencySymbol, amount, description, interval, id}) => {
|
||||
const price = amount / 100;
|
||||
const isChecked = selectedPlan === id;
|
||||
const classes = (isChecked ? 'gh-portal-plan-section checked' : 'gh-portal-plan-section');
|
||||
|
@ -145,7 +145,7 @@ export function capitalize(str) {
|
||||
return str.charAt(0).toUpperCase() + str.slice(1);
|
||||
}
|
||||
|
||||
export function isInviteOnlySite({site = {}, pageQuery}) {
|
||||
export function isInviteOnlySite({site = {}, pageQuery = ''}) {
|
||||
const prices = getSitePrices({site, pageQuery});
|
||||
return prices.length === 0 || (site && site.members_signup_access === 'invite');
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user