Moved telemetry code to script.

This commit is contained in:
Mike Cao 2022-08-02 00:24:17 -07:00
parent 3d7e9392f0
commit a4a6888248
4 changed files with 25 additions and 11 deletions

View file

@ -1,15 +1,15 @@
import React from 'react';
import { useRouter } from 'next/router';
import Script from 'next/script';
import classNames from 'classnames';
import { FormattedMessage } from 'react-intl';
import Link from 'components/common/Link';
import styles from './Footer.module.css';
import useStore from 'store/version';
import { HOMEPAGE_URL, REPO_URL } from 'lib/constants';
import useConfig from 'hooks/useConfig';
export default function Footer() {
const { current } = useStore();
const { telemetryDisabled } = useConfig();
const { pathname } = useRouter();
return (
<footer className={classNames(styles.footer, 'row')}>
@ -30,7 +30,7 @@ export default function Footer() {
<div className={classNames(styles.version, 'col-12 col-md-4')}>
<Link href={REPO_URL}>{`v${current}`}</Link>
</div>
{telemetryDisabled && <img src={`https://i.umami.is/a.png?v=${current}`} alt="" />}
{!pathname.includes('/share/') && <Script src={`/telemetry.js?v=${current}`} />}
</footer>
);
}