Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
8dc94e6b
Commit
8dc94e6b
authored
Apr 18, 2023
by
tom
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
disable csv export feature if recaptcha key is not provided
parent
be1277e6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
2 deletions
+19
-2
.env.pw
configs/envs/.env.pw
+1
-0
csv-export.tsx
pages/csv-export.tsx
+13
-2
AddressCsvExportLink.tsx
ui/address/AddressCsvExportLink.tsx
+5
-0
No files found.
configs/envs/.env.pw
View file @
8dc94e6b
...
...
@@ -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
pages/csv-export.tsx
View file @
8dc94e6b
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
);
};
ui/address/AddressCsvExportLink.tsx
View file @
8dc94e6b
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment