Some checks are pending
Check i18n / check-i18n (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
Check formatting / lint (push) Waiting to run
JavaScript Linting / lint (push) Waiting to run
JavaScript Testing / test (push) Waiting to run
Ruby Testing / build (production) (push) Waiting to run
Ruby Testing / build (test) (push) Waiting to run
Ruby Testing / test (.ruby-version) (push) Blocked by required conditions
Ruby Testing / test (3.2) (push) Blocked by required conditions
Ruby Testing / test (3.3) (push) Blocked by required conditions
Ruby Testing / Libvips tests (push) Blocked by required conditions
Ruby Testing / End to End testing (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (push) Blocked by required conditions
Ruby Testing / Back to original and return test (push) Blocked by required conditions
56 lines
2.5 KiB
JavaScript
56 lines
2.5 KiB
JavaScript
import { useCallback } from 'react';
|
|
|
|
import { FormattedMessage } from 'react-intl';
|
|
|
|
|
|
import { openModal } from 'mastodon/actions/modal';
|
|
import { registrationsOpen, sso_redirect } from 'mastodon/initial_state';
|
|
import { useAppDispatch, useAppSelector } from 'mastodon/store';
|
|
|
|
const SignInBanner = () => {
|
|
const dispatch = useAppDispatch();
|
|
|
|
const openClosedRegistrationsModal = useCallback(
|
|
() => dispatch(openModal({ modalType: 'CLOSED_REGISTRATIONS' })),
|
|
[dispatch],
|
|
);
|
|
|
|
let signupButton;
|
|
|
|
const signupUrl = useAppSelector((state) => state.getIn(['server', 'server', 'registrations', 'url'], null) || '/auth/sign_up');
|
|
|
|
if (sso_redirect) {
|
|
return (
|
|
<div className='sign-in-banner'>
|
|
<p><strong><FormattedMessage id='sign_in_banner.mastodon_is' defaultMessage="Join the Fediverse, become part of a community, and break free from Big Tech™'s stranglehold on public discourse." /></strong></p>
|
|
<p><FormattedMessage id='sign_in_banner.follow_anyone' defaultMessage='Follow anyone across the fediverse and see it all in chronological order. No algorithms, ads, or clickbait in sight.' /></p>
|
|
<a href={sso_redirect} data-method='post' className='button button--block button-tertiary'><FormattedMessage id='sign_in_banner.sso_redirect' defaultMessage='Login or Register' /></a>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
if (registrationsOpen) {
|
|
signupButton = (
|
|
<a href={signupUrl} className='button button--block'>
|
|
<FormattedMessage id='sign_in_banner.create_account' defaultMessage='Create account' />
|
|
</a>
|
|
);
|
|
} else {
|
|
signupButton = (
|
|
<button className='button button--block' onClick={openClosedRegistrationsModal}>
|
|
<FormattedMessage id='sign_in_banner.create_account' defaultMessage='Create account' />
|
|
</button>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className='sign-in-banner'>
|
|
<p><strong><FormattedMessage id='sign_in_banner.mastodon_is' defaultMessage="Join the Fediverse, become part of a community, and break free from Big Tech™'s stranglehold on public discourse." /></strong></p>
|
|
<p><FormattedMessage id='sign_in_banner.follow_anyone' defaultMessage='Follow anyone across the fediverse and see it all in chronological order. No algorithms, ads, or clickbait in sight.' /></p>
|
|
{signupButton}
|
|
<a href='/auth/sign_in' className='button button--block button-tertiary'><FormattedMessage id='sign_in_banner.sign_in' defaultMessage='Login' /></a>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default SignInBanner;
|