Skip to content

Commit

Permalink
Show DisclaimerBar only on /network/ pages. Also update copy.
Browse files Browse the repository at this point in the history
  • Loading branch information
tumppi committed Nov 16, 2023
1 parent 5dd4721 commit 80ad6d6
Showing 1 changed file with 50 additions and 32 deletions.
82 changes: 50 additions & 32 deletions src/components/DisclaimerBar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react'
import { useLocation } from 'react-router-dom'
import styled from 'styled-components'
import { toaster } from 'toasterhea'
import LightModal, { ModalProps } from '~/modals/LightModal'
Expand All @@ -8,38 +9,55 @@ import { Layer } from '~/utils/Layer'

const DisclaimerModal = (props: ModalProps) => <LightModal {...props} />

export const DisclaimerBar = () => (
<Root>
<SvgIcon name="infoBadge" />
<div>
Streamr risk disclaimer: Unproven technology, participate at your own risk.
Click to{' '}
<a
onClick={async () => {
try {
await toaster(DisclaimerModal, Layer.Modal).pop({
title: 'Disclaimer',
children: (
<p>
Streamr 1.0 testnets involve new, unproven technology
including smart contracts and new protocols, which
contain inherent risks. Users should conduct thorough
research before engaging, and participate at their own
risk. Participation can result in irreversible loss of
funds. Exercise caution. Never share your private key
with anyone.
</p>
),
})
} catch (e) {}
}}
>
learn more
</a>
.
</div>
</Root>
)
export const DisclaimerBar = () => {
const { pathname } = useLocation()

// Show disclaimer only for Overview, Sponsorships, Sponsorship, Operators, Operator pages
if (!pathname.includes('/hub/network/')) {
return null
}

return (
<Root>
<SvgIcon name="infoBadge" />
<div>
Streamr risk disclaimer: The sponsorship, staking & delegation smart
contracts are unproven technology, participate at your own risk.{' '}
<a
onClick={async () => {
try {
await toaster(DisclaimerModal, Layer.Modal).pop({
title: 'Disclaimer',
children: (
<p>
The Streamr 1.0 testnets involve new, unproven
technology including smart contracts and new
protocols, which contain inherent risks. Users
should conduct thorough research before engaging,
and participate at their own risk. Participation
can result in irreversible loss of funds. Exercise
caution. Never share your private key with anyone.{' '}
<a
href="https://docs.streamr.network/streamr-testnets/testnets"
target="_blank"
rel="noopener noreferrer"
>
Learn more
</a>
.
</p>
),
})
} catch (e) {}
}}
>
Learn more
</a>
.
</div>
</Root>
)
}

const Root = styled.div`
display: grid;
Expand Down

0 comments on commit 80ad6d6

Please sign in to comment.