pl-fe: remove CTA banner

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak
2024-09-09 12:50:51 +02:00
parent 374bef6141
commit ea7853eac2
12 changed files with 0 additions and 117 deletions

View File

@ -1,27 +0,0 @@
import React from 'react';
import { storeClosed, storeLoggedIn, storeOpen } from 'pl-fe/jest/mock-stores';
import { render, screen } from 'pl-fe/jest/test-helpers';
import CtaBanner from './cta-banner';
describe('<CtaBanner />', () => {
it('renders the banner', () => {
render(<CtaBanner />, undefined, storeOpen);
expect(screen.getByTestId('cta-banner')).toHaveTextContent(/sign up/i);
});
describe('with a logged in user', () => {
it('renders empty', () => {
render(<CtaBanner />, undefined, storeLoggedIn);
expect(screen.queryAllByTestId('cta-banner')).toHaveLength(0);
});
});
describe('with registrations closed', () => {
it('renders empty', () => {
render(<CtaBanner />, undefined, storeClosed);
expect(screen.queryAllByTestId('cta-banner')).toHaveLength(0);
});
});
});

View File

@ -1,44 +0,0 @@
import React from 'react';
import { FormattedMessage } from 'react-intl';
import { Banner, Button, HStack, Stack, Text } from 'pl-fe/components/ui';
import { useAppSelector, useInstance, useRegistrationStatus, usePlFeConfig } from 'pl-fe/hooks';
const CtaBanner = () => {
const instance = useInstance();
const { isOpen } = useRegistrationStatus();
const { displayCta } = usePlFeConfig();
const me = useAppSelector((state) => state.me);
if (me || !displayCta || !isOpen) return null;
return (
<div data-testid='cta-banner' className='hidden lg:block'>
<Banner theme='frosted'>
<HStack alignItems='center' justifyContent='between'>
<Stack>
<Text theme='white' size='xl' weight='bold'>
<FormattedMessage id='signup_panel.title' defaultMessage='New to {site_title}?' values={{ site_title: instance.title }} />
</Text>
<Text theme='white' weight='medium' className='opacity-90'>
<FormattedMessage id='signup_panel.subtitle' defaultMessage="Sign up now to discuss what's happening." />
</Text>
</Stack>
<HStack space={2} alignItems='center'>
<Button theme='secondary' to='/login'>
<FormattedMessage id='account.login' defaultMessage='Log in' />
</Button>
<Button theme='accent' to='/signup'>
<FormattedMessage id='account.register' defaultMessage='Sign up' />
</Button>
</HStack>
</HStack>
</Banner>
</div>
);
};
export { CtaBanner as default };

View File

@ -56,7 +56,6 @@ export const ThemeEditor = lazy(() => import('pl-fe/features/theme-editor'));
export const UserPanel = lazy(() => import('pl-fe/features/ui/components/user-panel'));
export const PromoPanel = lazy(() => import('pl-fe/features/ui/components/promo-panel'));
export const SignUpPanel = lazy(() => import('pl-fe/features/ui/components/panels/sign-up-panel'));
export const CtaBanner = lazy(() => import('pl-fe/features/ui/components/cta-banner'));
export const TrendsPanel = lazy(() => import('pl-fe/features/ui/components/trends-panel'));
export const ProfileInfoPanel = lazy(() => import('pl-fe/features/ui/components/profile-info-panel'));
export const ProfileMediaPanel = lazy(() => import('pl-fe/features/ui/components/profile-media-panel'));

View File

@ -5,7 +5,6 @@ import {
WhoToFollowPanel,
TrendsPanel,
SignUpPanel,
CtaBanner,
} from 'pl-fe/features/ui/util/async-components';
import { useAppSelector, useFeatures } from 'pl-fe/hooks';
@ -23,10 +22,6 @@ const DefaultLayout: React.FC<IDefaultLayout> = ({ children }) => {
<>
<Layout.Main>
{children}
{!me && (
<CtaBanner />
)}
</Layout.Main>
<Layout.Aside>

View File

@ -7,7 +7,6 @@ import PlaceholderStatus from 'pl-fe/features/placeholder/components/placeholder
import LinkFooter from 'pl-fe/features/ui/components/link-footer';
import {
EventHeader,
CtaBanner,
SignUpPanel,
TrendsPanel,
WhoToFollowPanel,
@ -74,10 +73,6 @@ const EventLayout: React.FC<IEventLayout> = ({ params, children }) => {
{children}
</div>
</Column>
{!me && (
<CtaBanner />
)}
</Layout.Main>
<Layout.Aside>

View File

@ -5,7 +5,6 @@ import {
WhoToFollowPanel,
TrendsPanel,
SignUpPanel,
CtaBanner,
} from 'pl-fe/features/ui/util/async-components';
import { useAppSelector, useFeatures } from 'pl-fe/hooks';
import { isStandalone } from 'pl-fe/utils/state';
@ -25,10 +24,6 @@ const ExternalLoginLayout: React.FC<IExternalLoginLayout> = ({ children }) => {
<>
<Layout.Main>
{children}
{!me && (
<CtaBanner />
)}
</Layout.Main>
<Layout.Aside>

View File

@ -7,7 +7,6 @@ import { Column, Icon, Layout, Stack, Text, Tabs } from 'pl-fe/components/ui';
import GroupHeader from 'pl-fe/features/group/components/group-header';
import LinkFooter from 'pl-fe/features/ui/components/link-footer';
import {
CtaBanner,
GroupMediaPanel,
SignUpPanel,
} from 'pl-fe/features/ui/util/async-components';
@ -105,10 +104,6 @@ const GroupLayout: React.FC<IGroupLayout> = ({ params, children }) => {
{renderChildren()}
</Column>
{!me && (
<CtaBanner />
)}
</Layout.Main>
<Layout.Aside>

View File

@ -12,7 +12,6 @@ import {
PromoPanel,
CryptoDonatePanel,
BirthdayPanel,
CtaBanner,
AnnouncementsPanel,
} from 'pl-fe/features/ui/util/async-components';
import { useAppSelector, useOwnAccount, useFeatures, usePlFeConfig, useDraggedFiles, useAppDispatch } from 'pl-fe/hooks';
@ -83,10 +82,6 @@ const HomeLayout: React.FC<IHomeLayout> = ({ children }) => {
)}
{children}
{!me && (
<CtaBanner />
)}
</Layout.Main>
<Layout.Aside>

View File

@ -4,7 +4,6 @@ import LinkFooter from 'pl-fe/features/ui/components/link-footer';
import {
TrendsPanel,
SignUpPanel,
CtaBanner,
} from 'pl-fe/features/ui/util/async-components';
import { useAppSelector, useFeatures } from 'pl-fe/hooks';
@ -22,10 +21,6 @@ const LandingLayout: React.FC<ILandingLayout> = ({ children }) => {
<>
<Layout.Main className='space-y-3 pt-3 sm:pt-0 dark:divide-gray-800'>
{children}
{!me && (
<CtaBanner />
)}
</Layout.Main>
<Layout.Aside>

View File

@ -12,7 +12,6 @@ import {
ProfileMediaPanel,
ProfileFieldsPanel,
SignUpPanel,
CtaBanner,
PinnedAccountsPanel,
AccountNotePanel,
} from 'pl-fe/features/ui/util/async-components';
@ -100,10 +99,6 @@ const ProfileLayout: React.FC<IProfileLayout> = ({ params, children }) => {
{children}
</div>
</Column>
{!me && (
<CtaBanner />
)}
</Layout.Main>
<Layout.Aside>

View File

@ -5,7 +5,6 @@ import {
WhoToFollowPanel,
TrendsPanel,
SignUpPanel,
CtaBanner,
} from 'pl-fe/features/ui/util/async-components';
import { useAppSelector, useFeatures } from 'pl-fe/hooks';
@ -23,10 +22,6 @@ const SearchLayout: React.FC<ISearchLayout> = ({ children }) => {
<>
<Layout.Main>
{children}
{!me && (
<CtaBanner />
)}
</Layout.Main>
<Layout.Aside>

View File

@ -5,7 +5,6 @@ import {
WhoToFollowPanel,
TrendsPanel,
SignUpPanel,
CtaBanner,
} from 'pl-fe/features/ui/util/async-components';
import { useAppSelector, useFeatures } from 'pl-fe/hooks';
@ -23,10 +22,6 @@ const StatusLayout: React.FC<IStatusLayout> = ({ children }) => {
<>
<Layout.Main>
{children}
{!me && (
<CtaBanner />
)}
</Layout.Main>
<Layout.Aside>