From ea7853eac2e633af212656ee8e22e9b1955da383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Mon, 9 Sep 2024 12:50:51 +0200 Subject: [PATCH] pl-fe: remove CTA banner MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- .../ui/components/cta-banner.test.tsx | 27 ------------ .../src/features/ui/components/cta-banner.tsx | 44 ------------------- .../src/features/ui/util/async-components.ts | 1 - packages/pl-fe/src/layouts/default-layout.tsx | 5 --- packages/pl-fe/src/layouts/event-layout.tsx | 5 --- .../src/layouts/external-login-layout.tsx | 5 --- packages/pl-fe/src/layouts/group-layout.tsx | 5 --- packages/pl-fe/src/layouts/home-layout.tsx | 5 --- packages/pl-fe/src/layouts/landing-layout.tsx | 5 --- packages/pl-fe/src/layouts/profile-layout.tsx | 5 --- packages/pl-fe/src/layouts/search-layout.tsx | 5 --- packages/pl-fe/src/layouts/status-layout.tsx | 5 --- 12 files changed, 117 deletions(-) delete mode 100644 packages/pl-fe/src/features/ui/components/cta-banner.test.tsx delete mode 100644 packages/pl-fe/src/features/ui/components/cta-banner.tsx diff --git a/packages/pl-fe/src/features/ui/components/cta-banner.test.tsx b/packages/pl-fe/src/features/ui/components/cta-banner.test.tsx deleted file mode 100644 index 88b554945..000000000 --- a/packages/pl-fe/src/features/ui/components/cta-banner.test.tsx +++ /dev/null @@ -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('', () => { - it('renders the banner', () => { - render(, undefined, storeOpen); - expect(screen.getByTestId('cta-banner')).toHaveTextContent(/sign up/i); - }); - - describe('with a logged in user', () => { - it('renders empty', () => { - render(, undefined, storeLoggedIn); - expect(screen.queryAllByTestId('cta-banner')).toHaveLength(0); - }); - }); - - describe('with registrations closed', () => { - it('renders empty', () => { - render(, undefined, storeClosed); - expect(screen.queryAllByTestId('cta-banner')).toHaveLength(0); - }); - }); -}); diff --git a/packages/pl-fe/src/features/ui/components/cta-banner.tsx b/packages/pl-fe/src/features/ui/components/cta-banner.tsx deleted file mode 100644 index d81c679ce..000000000 --- a/packages/pl-fe/src/features/ui/components/cta-banner.tsx +++ /dev/null @@ -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 ( -
- - - - - - - - - - - - - - - - - - - -
- ); -}; - -export { CtaBanner as default }; diff --git a/packages/pl-fe/src/features/ui/util/async-components.ts b/packages/pl-fe/src/features/ui/util/async-components.ts index 5d7edfee5..ca895043b 100644 --- a/packages/pl-fe/src/features/ui/util/async-components.ts +++ b/packages/pl-fe/src/features/ui/util/async-components.ts @@ -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')); diff --git a/packages/pl-fe/src/layouts/default-layout.tsx b/packages/pl-fe/src/layouts/default-layout.tsx index ff42dfbe4..4a2ecea49 100644 --- a/packages/pl-fe/src/layouts/default-layout.tsx +++ b/packages/pl-fe/src/layouts/default-layout.tsx @@ -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 = ({ children }) => { <> {children} - - {!me && ( - - )} diff --git a/packages/pl-fe/src/layouts/event-layout.tsx b/packages/pl-fe/src/layouts/event-layout.tsx index a35d5f1eb..8122c056c 100644 --- a/packages/pl-fe/src/layouts/event-layout.tsx +++ b/packages/pl-fe/src/layouts/event-layout.tsx @@ -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 = ({ params, children }) => { {children} - - {!me && ( - - )} diff --git a/packages/pl-fe/src/layouts/external-login-layout.tsx b/packages/pl-fe/src/layouts/external-login-layout.tsx index f5d86d5e6..90e5be94e 100644 --- a/packages/pl-fe/src/layouts/external-login-layout.tsx +++ b/packages/pl-fe/src/layouts/external-login-layout.tsx @@ -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 = ({ children }) => { <> {children} - - {!me && ( - - )} diff --git a/packages/pl-fe/src/layouts/group-layout.tsx b/packages/pl-fe/src/layouts/group-layout.tsx index f066f561f..d9ed5f7a1 100644 --- a/packages/pl-fe/src/layouts/group-layout.tsx +++ b/packages/pl-fe/src/layouts/group-layout.tsx @@ -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 = ({ params, children }) => { {renderChildren()} - - {!me && ( - - )} diff --git a/packages/pl-fe/src/layouts/home-layout.tsx b/packages/pl-fe/src/layouts/home-layout.tsx index 15680ac70..621413e4f 100644 --- a/packages/pl-fe/src/layouts/home-layout.tsx +++ b/packages/pl-fe/src/layouts/home-layout.tsx @@ -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 = ({ children }) => { )} {children} - - {!me && ( - - )} diff --git a/packages/pl-fe/src/layouts/landing-layout.tsx b/packages/pl-fe/src/layouts/landing-layout.tsx index 5d14ec6ce..116e3e6ce 100644 --- a/packages/pl-fe/src/layouts/landing-layout.tsx +++ b/packages/pl-fe/src/layouts/landing-layout.tsx @@ -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 = ({ children }) => { <> {children} - - {!me && ( - - )} diff --git a/packages/pl-fe/src/layouts/profile-layout.tsx b/packages/pl-fe/src/layouts/profile-layout.tsx index 46500b701..49af9c9fd 100644 --- a/packages/pl-fe/src/layouts/profile-layout.tsx +++ b/packages/pl-fe/src/layouts/profile-layout.tsx @@ -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 = ({ params, children }) => { {children} - - {!me && ( - - )} diff --git a/packages/pl-fe/src/layouts/search-layout.tsx b/packages/pl-fe/src/layouts/search-layout.tsx index afc177e1f..546b5a9ad 100644 --- a/packages/pl-fe/src/layouts/search-layout.tsx +++ b/packages/pl-fe/src/layouts/search-layout.tsx @@ -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 = ({ children }) => { <> {children} - - {!me && ( - - )} diff --git a/packages/pl-fe/src/layouts/status-layout.tsx b/packages/pl-fe/src/layouts/status-layout.tsx index e4b01071f..857c2a1c5 100644 --- a/packages/pl-fe/src/layouts/status-layout.tsx +++ b/packages/pl-fe/src/layouts/status-layout.tsx @@ -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 = ({ children }) => { <> {children} - - {!me && ( - - )}