sforkowany z mirror/soapbox
LandingPageModal: fix routes
rodzic
23fb01d32d
commit
2028873d34
|
@ -2,11 +2,10 @@ import classNames from 'classnames';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { defineMessages, useIntl } from 'react-intl';
|
import { defineMessages, useIntl } from 'react-intl';
|
||||||
import { useSelector } from 'react-redux';
|
|
||||||
|
|
||||||
import { getSoapboxConfig } from 'soapbox/actions/soapbox';
|
|
||||||
import { Button } from 'soapbox/components/ui';
|
import { Button } from 'soapbox/components/ui';
|
||||||
import { Modal } from 'soapbox/components/ui';
|
import { Modal } from 'soapbox/components/ui';
|
||||||
|
import { useAppSelector, useFeatures, useSoapboxConfig } from 'soapbox/hooks';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
download: { id: 'landing_page_modal.download', defaultMessage: 'Download' },
|
download: { id: 'landing_page_modal.download', defaultMessage: 'Download' },
|
||||||
|
@ -18,9 +17,12 @@ const messages = defineMessages({
|
||||||
const LandingPageModal = ({ onClose }) => {
|
const LandingPageModal = ({ onClose }) => {
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
|
|
||||||
const logo = useSelector((state) => getSoapboxConfig(state).get('logo'));
|
const { logo } = useSoapboxConfig();
|
||||||
const instance = useSelector((state) => state.get('instance'));
|
const instance = useAppSelector((state) => state.instance);
|
||||||
const isOpen = instance.get('registrations', false) === true;
|
const features = useFeatures();
|
||||||
|
|
||||||
|
const isOpen = instance.get('registrations', false) === true;
|
||||||
|
const pepeOpen = useAppSelector(state => state.verification.getIn(['instance', 'registrations'], false) === true);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
|
@ -38,8 +40,8 @@ const LandingPageModal = ({ onClose }) => {
|
||||||
{intl.formatMessage(messages.login)}
|
{intl.formatMessage(messages.login)}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
{isOpen && (
|
{(isOpen || features.pepe && pepeOpen) && (
|
||||||
<Button to='/verify' theme='primary' block>
|
<Button to={features.pepe ? '/verify' : '/signup'} theme='primary' block>
|
||||||
{intl.formatMessage(messages.register)}
|
{intl.formatMessage(messages.register)}
|
||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
|
|
Ładowanie…
Reference in New Issue