pl-fe: i'm not interested in supporting use cases that require the 'gdpr banner'
Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
@@ -1,69 +0,0 @@
|
||||
import clsx from 'clsx';
|
||||
import React, { useState } from 'react';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
|
||||
import Banner from 'pl-fe/components/ui/banner';
|
||||
import Button from 'pl-fe/components/ui/button';
|
||||
import HStack from 'pl-fe/components/ui/hstack';
|
||||
import Stack from 'pl-fe/components/ui/stack';
|
||||
import Text from 'pl-fe/components/ui/text';
|
||||
import { useInstance } from 'pl-fe/hooks/use-instance';
|
||||
import { usePlFeConfig } from 'pl-fe/hooks/use-pl-fe-config';
|
||||
|
||||
const acceptedGdpr = !!localStorage.getItem('plfe:gdpr');
|
||||
|
||||
/** Displays a cookie consent banner. */
|
||||
const GdprBanner: React.FC = () => {
|
||||
/** Track whether the banner has already been displayed once. */
|
||||
const [shown, setShown] = useState<boolean>(acceptedGdpr);
|
||||
const [slideout, setSlideout] = useState(false);
|
||||
|
||||
const instance = useInstance();
|
||||
const { gdprUrl } = usePlFeConfig();
|
||||
|
||||
const handleAccept = () => {
|
||||
localStorage.setItem('plfe:gdpr', 'true');
|
||||
setSlideout(true);
|
||||
setTimeout(() => setShown(true), 200);
|
||||
};
|
||||
|
||||
if (shown) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<Banner theme='opaque' className={clsx('transition-transform', { 'translate-y-full': slideout })}>
|
||||
<div className='flex flex-col space-y-4 lg:flex-row lg:items-center lg:justify-between lg:space-x-4 lg:space-y-0 rtl:space-x-reverse'>
|
||||
<Stack space={2}>
|
||||
<Text size='xl' weight='bold'>
|
||||
<FormattedMessage id='gdpr.title' defaultMessage='{siteTitle} uses cookies' values={{ siteTitle: instance.title }} />
|
||||
</Text>
|
||||
|
||||
<Text weight='medium' className='opacity-60'>
|
||||
<FormattedMessage
|
||||
id='gdpr.message'
|
||||
defaultMessage="{siteTitle} uses session cookies, which are essential to the website's functioning."
|
||||
values={{ siteTitle: instance.title }}
|
||||
/>
|
||||
</Text>
|
||||
</Stack>
|
||||
|
||||
<HStack space={2} alignItems='center' className='flex-none'>
|
||||
{gdprUrl && (
|
||||
<a href={gdprUrl} tabIndex={-1} className='inline-flex'>
|
||||
<Button theme='secondary'>
|
||||
<FormattedMessage id='gdpr.learn_more' defaultMessage='Learn more' />
|
||||
</Button>
|
||||
</a>
|
||||
)}
|
||||
|
||||
<Button theme='accent' onClick={handleAccept}>
|
||||
<FormattedMessage id='gdpr.accept' defaultMessage='Accept' />
|
||||
</Button>
|
||||
</HStack>
|
||||
</div>
|
||||
</Banner>
|
||||
);
|
||||
};
|
||||
|
||||
export { GdprBanner as default };
|
||||
@@ -13,7 +13,6 @@ import { useLoggedIn } from 'pl-fe/hooks/use-logged-in';
|
||||
import { usePlFeConfig } from 'pl-fe/hooks/use-pl-fe-config';
|
||||
import { useCachedLocationHandler } from 'pl-fe/utils/redirect';
|
||||
|
||||
const GdprBanner = React.lazy(() => import('pl-fe/components/gdpr-banner'));
|
||||
const EmbeddedStatus = React.lazy(() => import('pl-fe/features/embedded-status'));
|
||||
const UI = React.lazy(() => import('pl-fe/features/ui'));
|
||||
|
||||
@@ -24,7 +23,7 @@ const PlFeMount = () => {
|
||||
const { isLoggedIn } = useLoggedIn();
|
||||
const plFeConfig = usePlFeConfig();
|
||||
|
||||
const { redirectRootNoLogin, gdpr } = plFeConfig;
|
||||
const { redirectRootNoLogin } = plFeConfig;
|
||||
|
||||
// @ts-ignore: I don't actually know what these should be, lol
|
||||
const shouldUpdateScroll = (prevRouterProps, { location }) =>
|
||||
@@ -61,12 +60,6 @@ const PlFeMount = () => {
|
||||
<ModalRoot />
|
||||
</Suspense>
|
||||
|
||||
{(gdpr && !isLoggedIn) && (
|
||||
<Suspense>
|
||||
<GdprBanner />
|
||||
</Suspense>
|
||||
)}
|
||||
|
||||
<div id='toaster'>
|
||||
<Toaster
|
||||
position='top-right'
|
||||
|
||||
@@ -908,10 +908,6 @@
|
||||
"filters.updated": "Filter updated.",
|
||||
"follow_request.authorize": "Authorize",
|
||||
"follow_request.reject": "Reject",
|
||||
"gdpr.accept": "Accept",
|
||||
"gdpr.learn_more": "Learn more",
|
||||
"gdpr.message": "{siteTitle} uses session cookies, which are essential to the website's functioning.",
|
||||
"gdpr.title": "{siteTitle} uses cookies",
|
||||
"generic.logo": "Logo",
|
||||
"generic.saved": "Saved",
|
||||
"getting_started.footer_notice": "Proudly made in Poland. {emoji}",
|
||||
|
||||
@@ -56,8 +56,6 @@ const plFeConfigSchema = coerceObject({
|
||||
)), null),
|
||||
copyright: v.fallback(v.string(), 'skibidi dop dop dop yes yes'),
|
||||
defaultSettings: v.fallback(v.partial(settingsSchema), {}),
|
||||
gdpr: v.fallback(v.boolean(), false),
|
||||
gdprUrl: v.fallback(v.string(), ''),
|
||||
greentext: v.fallback(v.boolean(), false),
|
||||
promoPanel: promoPanelSchema,
|
||||
navlinks: v.fallback(v.record(v.string(), filteredArray(footerItemSchema)), {}),
|
||||
|
||||
Reference in New Issue
Block a user