mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-04 17:04:59 +03:00
Added cookies disabled check
no issue - Added dummy banner if cookies are disabled - Adds new helper to check if cookies are disabled
This commit is contained in:
parent
2105872859
commit
71fcfb4918
@ -4,6 +4,7 @@ import AppContext from '../AppContext';
|
||||
import FrameStyle from './Frame.styles';
|
||||
import Pages, {getActivePage} from '../pages';
|
||||
import PopupNotification from './common/PopupNotification';
|
||||
import { isCookiesDisabled } from '../utils/helpers';
|
||||
|
||||
const React = require('react');
|
||||
|
||||
@ -38,6 +39,16 @@ const StylesWrapper = ({member}) => {
|
||||
};
|
||||
};
|
||||
|
||||
const CookieDisabledBanner = () => {
|
||||
const cookieDisabled = isCookiesDisabled();
|
||||
if (cookieDisabled) {
|
||||
return (
|
||||
<div> Cookies are disabled </div>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
class PopupContent extends React.Component {
|
||||
static contextType = AppContext;
|
||||
|
||||
@ -100,6 +111,7 @@ class PopupContent extends React.Component {
|
||||
return (
|
||||
<div className='gh-portal-popup-wrapper'>
|
||||
<div className={(hasMode(['preview', 'dev']) ? 'gh-portal-popup-container preview' : 'gh-portal-popup-container') + ' ' + popupWidthStyle} style={pageStyle} ref={node => (this.node = node)} tabIndex="-1">
|
||||
<CookieDisabledBanner />
|
||||
{this.renderPopupNotification()}
|
||||
{this.renderActivePage()}
|
||||
</div>
|
||||
|
@ -1,5 +1,9 @@
|
||||
import CalculateDiscount from './discount';
|
||||
|
||||
export function isCookiesDisabled() {
|
||||
return !(navigator && navigator.cookieEnabled);
|
||||
}
|
||||
|
||||
export function getMemberSubscription({member = {}}) {
|
||||
if (member.paid) {
|
||||
const [subscription] = member.subscriptions || [];
|
||||
|
Loading…
Reference in New Issue
Block a user