Commit 8dc94e6b authored by tom's avatar tom

disable csv export feature if recaptcha key is not provided

parent be1277e6
......@@ -20,3 +20,4 @@ NEXT_PUBLIC_IS_L2_NETWORK=false
# api config
NEXT_PUBLIC_API_HOST=blockscout.com
NEXT_PUBLIC_STATS_API_HOST=https://stats-test.aws-k8s.blockscout.com
NEXT_PUBLIC_RE_CAPTCHA_APP_SITE_KEY=xxx
import type { NextPage } from 'next';
import type { GetServerSideProps, NextPage } from 'next';
import Head from 'next/head';
import React from 'react';
import appConfig from 'configs/app/config';
import getNetworkTitle from 'lib/networks/getNetworkTitle';
import type { Props } from 'lib/next/getServerSideProps';
import { getServerSideProps as getServerSidePropsBase } from 'lib/next/getServerSideProps';
import CsvExport from 'ui/pages/CsvExport';
const CsvExportPage: NextPage = () => {
......@@ -19,4 +22,12 @@ const CsvExportPage: NextPage = () => {
export default CsvExportPage;
export { getServerSideProps } from 'lib/next/getServerSideProps';
export const getServerSideProps: GetServerSideProps<Props> = async(args) => {
if (!appConfig.reCaptcha.siteKey) {
return {
notFound: true,
};
}
return getServerSidePropsBase(args);
};
......@@ -4,6 +4,7 @@ import React from 'react';
import type { CsvExportType } from 'types/client/address';
import appConfig from 'configs/app/config';
import svgFileIcon from 'icons/files/csv.svg';
import useIsMobile from 'lib/hooks/useIsMobile';
import LinkInternal from 'ui/shared/LinkInternal';
......@@ -17,6 +18,10 @@ interface Props {
const AddressCsvExportLink = ({ className, address, type }: Props) => {
const isMobile = useIsMobile();
if (!appConfig.reCaptcha.siteKey) {
return null;
}
return (
<Tooltip isDisabled={ !isMobile } label="Download CSV">
<LinkInternal
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment