Skip to content

Commit

Permalink
Add support for displaying privacy policy when required
Browse files Browse the repository at this point in the history
  • Loading branch information
csillag committed Feb 28, 2024
1 parent 89a040f commit 1a52fca
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 0 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ REACT_APP_SHOW_BUILD_BANNERS=false
# REACT_APP_FIXED_NETWORK=testnet
REACT_APP_FIXED_LAYER=pontusx
REACT_APP_SHOW_FIAT_VALUES=false
# REACT_APP_SHOW_PRIVACY_POLICY=true
1 change: 1 addition & 0 deletions .env.production
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ REACT_APP_SHOW_BUILD_BANNERS=false
# REACT_APP_FIXED_NETWORK=testnet
REACT_APP_FIXED_LAYER=pontusx
REACT_APP_SHOW_FIAT_VALUES=false
# REACT_APP_SHOW_PRIVACY_POLICY=true
9 changes: 9 additions & 0 deletions src/app/components/PageLayout/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import Box from '@mui/material/Box'
import Typography from '@mui/material/Typography'
import { useScreenSize } from '../../hooks/useScreensize'
import { styled } from '@mui/material/styles'
import { Link as RouterLink } from 'react-router-dom'
import Link from '@mui/material/Link'
import { useTheme } from '@mui/material/styles'
import { useConstant } from '../../hooks/useConstant'
import { AppendMobileSearch } from '../AppendMobileSearch'
import { SearchScope } from '../../../types/searchScope'
import { api, github } from '../../utils/externalLinks'
import { showPrivacyPolicy } from '../../../config'

const FooterBox = styled(Box)(({ theme }) => ({
display: 'flex',
Expand Down Expand Up @@ -128,6 +130,13 @@ export const Footer: FC<FooterProps> = ({ scope, mobileSearchAction }) => {
</Typography>
</StyledLinksGroup>
</StyledBox>
{showPrivacyPolicy && (
<Typography variant="footer">
<Link component={RouterLink} to={'/privacy'} sx={{ color: theme.palette.layout.main }}>
{t('privacyPolicy.title')}
</Link>
</Typography>
)}
<Typography variant="footer">
{isTablet ? t('footer.mobileTitle') : t('footer.title')} | {currentYear}
</Typography>
Expand Down
17 changes: 17 additions & 0 deletions src/app/pages/PrivacyPage/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import React, { FC } from 'react'
import { useTranslation } from 'react-i18next'

import { PageLayout } from '../../components/PageLayout'
import { SubPageCard } from '../../components/SubPageCard'

export const PrivacyPage: FC = () => {
const { t } = useTranslation()

return (
<PageLayout>
<SubPageCard featured title={t('privacyPolicy.title')}>
<span>{t('common.missing')}</span>
</SubPageCard>
</PageLayout>
)
}
2 changes: 2 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,5 @@ export const getFiatCurrencyForScope = (scope: SearchScope | undefined) =>
(scope ? paraTimesConfig[scope.layer]?.[scope.network]?.fiatCurrency : undefined) ?? 'usd'

export const showFiatValues = process.env.REACT_APP_SHOW_FIAT_VALUES === 'true'

export const showPrivacyPolicy = process.env.REACT_APP_SHOW_PRIVACY_POLICY === 'true'
3 changes: 3 additions & 0 deletions src/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,9 @@
"noData": "No data available",
"nodes": "Nodes:"
},
"privacyPolicy": {
"title": "Privacy Policy"
},
"search": {
"placeholder": "Address, Block, Contract, Transaction hash, Token name, etc.",
"error": {
Expand Down
10 changes: 10 additions & 0 deletions src/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ import { ConsensusAccountsPage } from './app/pages/ConsensusAccountsPage'
import { ConsensusTransactionsPage } from './app/pages/ConsensusTransactionsPage'
import { ConsensusAccountDetailsPage } from './app/pages/ConsensusAccountDetailsPage'
import { FC, useEffect } from 'react'
import { PrivacyPage } from './app/pages/PrivacyPage'
import { showPrivacyPolicy } from './config'

const NetworkSpecificPart = () => (
<ThemeByNetwork network={useRequiredScopeParam().network}>
Expand Down Expand Up @@ -264,6 +266,14 @@ export const routes: RouteObject[] = [
},
],
},
...(showPrivacyPolicy
? [
{
path: '/privacy',
element: withDefaultTheme(<PrivacyPage />),
},
]
: []),
],
},
]
1 change: 1 addition & 0 deletions src/types/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ declare global {
REACT_APP_FIXED_NETWORK?: string
REACT_APP_FIXED_LAYER?: string
REACT_APP_SHOW_FIAT_VALUES?: string
REACT_APP_SHOW_PRIVACY_POLICY?: string
}
}
}
Expand Down

0 comments on commit 1a52fca

Please sign in to comment.