From 134392840603a101492bd450a094c347257b4c9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?marcin=20miko=C5=82ajczak?= Date: Mon, 10 Oct 2022 00:41:47 +0200 Subject: [PATCH] Make CtaBanner and ThreadLoginCta optional MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: marcin mikołajczak --- app/soapbox/features/soapbox_config/index.tsx | 8 ++++++++ .../features/status/components/thread-login-cta.tsx | 5 ++++- app/soapbox/features/ui/components/cta-banner.tsx | 4 ++-- app/soapbox/normalizers/soapbox/soapbox_config.ts | 1 + 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/app/soapbox/features/soapbox_config/index.tsx b/app/soapbox/features/soapbox_config/index.tsx index fd339cf5c..222c44434 100644 --- a/app/soapbox/features/soapbox_config/index.tsx +++ b/app/soapbox/features/soapbox_config/index.tsx @@ -48,6 +48,7 @@ const messages = defineMessages({ promoPanelIconsLink: { id: 'soapbox_config.hints.promo_panel_icons.link', defaultMessage: 'Soapbox Icons List' }, authenticatedProfileLabel: { id: 'soapbox_config.authenticated_profile_label', defaultMessage: 'Profiles require authentication' }, authenticatedProfileHint: { id: 'soapbox_config.authenticated_profile_hint', defaultMessage: 'Users must be logged-in to view replies and media on user profiles.' }, + displayCtaLabel: { id: 'soapbox_config.cta_label', defaultMessage: 'Display call to action panels if not authenticated' }, singleUserModeLabel: { id: 'soapbox_config.single_user_mode_label', defaultMessage: 'Single user mode' }, singleUserModeHint: { id: 'soapbox_config.single_user_mode_hint', defaultMessage: 'Front page will redirect to a given user profile.' }, singleUserModeProfileLabel: { id: 'soapbox_config.single_user_mode_profile_label', defaultMessage: 'Main user handle' }, @@ -261,6 +262,13 @@ const SoapboxConfig: React.FC = () => { /> + + e.target.checked)} + /> + + { + const { displayCta } = useSoapboxConfig(); const siteTitle = useAppSelector(state => state.instance.title); + if (!displayCta) return null; + return ( diff --git a/app/soapbox/features/ui/components/cta-banner.tsx b/app/soapbox/features/ui/components/cta-banner.tsx index 9d83c6702..fa4ceba90 100644 --- a/app/soapbox/features/ui/components/cta-banner.tsx +++ b/app/soapbox/features/ui/components/cta-banner.tsx @@ -5,11 +5,11 @@ import { Banner, Button, HStack, Stack, Text } from 'soapbox/components/ui'; import { useAppSelector, useSoapboxConfig } from 'soapbox/hooks'; const CtaBanner = () => { - const { singleUserMode } = useSoapboxConfig(); + const { displayCta, singleUserMode } = useSoapboxConfig(); const siteTitle = useAppSelector((state) => state.instance.title); const me = useAppSelector((state) => state.me); - if (me || singleUserMode) return null; + if (me || !displayCta || singleUserMode) return null; return (
diff --git a/app/soapbox/normalizers/soapbox/soapbox_config.ts b/app/soapbox/normalizers/soapbox/soapbox_config.ts index 75426e6c0..d9f1e5bb3 100644 --- a/app/soapbox/normalizers/soapbox/soapbox_config.ts +++ b/app/soapbox/normalizers/soapbox/soapbox_config.ts @@ -112,6 +112,7 @@ export const SoapboxConfigRecord = ImmutableRecord({ singleUserModeProfile: '', linkFooterMessage: '', links: ImmutableMap(), + displayCta: true, }, 'SoapboxConfig'); type SoapboxConfigMap = ImmutableMap;