Add noreferrer automatically to link tags. Closes #1941

This commit is contained in:
Gabe Kangas
2022-06-26 20:09:07 -07:00
parent b08393295f
commit 8fc922588b
2 changed files with 53 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
import { Layout } from 'antd';
import { useRecoilValue } from 'recoil';
import Head from 'next/head';
import { useEffect, useRef } from 'react';
import {
ClientConfigStore,
isChatAvailableSelector,
@@ -11,6 +12,7 @@ import { Content, Header } from '../ui';
import { ClientConfig } from '../../interfaces/client-config.model';
import { DisplayableError } from '../../types/displayable-error';
import FatalErrorStateModal from '../modals/FatalErrorModal';
import setupNoLinkReferrer from '../../utils/no-link-referrer';
function Main() {
const clientConfig = useRecoilValue<ClientConfig>(clientConfigStateAtom);
@@ -18,6 +20,12 @@ function Main() {
const isChatAvailable = useRecoilValue<boolean>(isChatAvailableSelector);
const fatalError = useRecoilValue<DisplayableError>(fatalErrorStateAtom);
const layoutRef = useRef<HTMLDivElement>(null);
useEffect(() => {
setupNoLinkReferrer(layoutRef.current);
}, []);
return (
<>
<Head>
@@ -80,7 +88,7 @@ function Main() {
</Head>
<ClientConfigStore />
<Layout>
<Layout ref={layoutRef}>
<Header name={title || name} chatAvailable={isChatAvailable} />
<Content />
{fatalError && (