chore: remove Status wallet requirement
This commit is contained in:
parent
dc84f5ba73
commit
2c82372b49
|
@ -1,12 +1,6 @@
|
|||
import React, { useState } from 'react'
|
||||
import { ProposeButton } from './Button'
|
||||
import { useEthers } from '@usedapp/core'
|
||||
import styled from 'styled-components'
|
||||
import { Modal } from './Modal'
|
||||
import { LinkExternal } from './Link'
|
||||
import statusLogo from '../assets/images/statusLogo.svg'
|
||||
import { ColumnFlexDiv } from '../constants/styles'
|
||||
import { config } from '../config'
|
||||
|
||||
export type ConnectButtonProps = {
|
||||
text?: string
|
||||
|
@ -14,86 +8,13 @@ export type ConnectButtonProps = {
|
|||
}
|
||||
|
||||
export function ConnectButton({ text, className }: ConnectButtonProps) {
|
||||
const [showModal, setShowModal] = useState(false)
|
||||
const { activateBrowserWallet } = useEthers()
|
||||
|
||||
const activateWallet = () => {
|
||||
if (config.statusWalletRequired && !(window as any).ethereum?.isStatus) {
|
||||
setShowModal(true)
|
||||
return
|
||||
}
|
||||
activateBrowserWallet()
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
{showModal && (
|
||||
<Modal heading={'Connect with Status'} setShowModal={setShowModal}>
|
||||
<StatusModal />{' '}
|
||||
</Modal>
|
||||
)}
|
||||
<ProposeButton className={className} onClick={activateWallet}>
|
||||
<ProposeButton className={className} onClick={activateBrowserWallet}>
|
||||
{!text ? 'Connect to Vote' : text}
|
||||
</ProposeButton>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function StatusModal() {
|
||||
return (
|
||||
<StatusInfo>
|
||||
<p>This DApp is only available for</p>
|
||||
<StatusTextBlock>
|
||||
<StatusLogo src={statusLogo} />
|
||||
<p>{window.innerWidth > 600 ? 'Secure Crypto' : ''} Wallet & Messenger</p>
|
||||
</StatusTextBlock>
|
||||
|
||||
<StatusLink href="https://status.im/get/" target="_blank">
|
||||
Get Status
|
||||
</StatusLink>
|
||||
</StatusInfo>
|
||||
)
|
||||
}
|
||||
|
||||
const StatusInfo = styled(ColumnFlexDiv)`
|
||||
& > p {
|
||||
font-weight: 500;
|
||||
font-size: 15px;
|
||||
line-height: 22px;
|
||||
}
|
||||
`
|
||||
|
||||
const StatusTextBlock = styled.div`
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
|
||||
@media (max-width: 600px) {
|
||||
flex-direction: row;
|
||||
}
|
||||
|
||||
@media (max-width: 340px) {
|
||||
flex-direction: column;
|
||||
}
|
||||
`
|
||||
const StatusLogo = styled.img`
|
||||
width: 120px;
|
||||
height: 45px;
|
||||
margin: 16px 0;
|
||||
|
||||
@media (max-width: 600px) {
|
||||
width: 83px;
|
||||
height: 31px;
|
||||
margin: 8px 0;
|
||||
margin-right: 8px;
|
||||
}
|
||||
`
|
||||
|
||||
const StatusLink = styled(LinkExternal)`
|
||||
margin-top: 45px;
|
||||
margin-bottom: 13px;
|
||||
|
||||
@media (max-width: 600px) {
|
||||
margin-top: 16px;
|
||||
}
|
||||
`
|
||||
|
|
|
@ -10,7 +10,6 @@ export interface Config {
|
|||
wakuFeatureTopic: string
|
||||
}
|
||||
daapConfig: DAppConfig
|
||||
statusWalletRequired: boolean
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -21,7 +20,6 @@ const configs: Record<typeof process.env.ENV, Config> = {
|
|||
* Localhost/Development.
|
||||
*/
|
||||
development: {
|
||||
statusWalletRequired: false,
|
||||
wakuConfig: {
|
||||
environment: 'test',
|
||||
wakuTopic: `/communitiesCuration/localhost/${uuidv4()}/${version}/directory/proto/`,
|
||||
|
@ -50,7 +48,6 @@ const configs: Record<typeof process.env.ENV, Config> = {
|
|||
* All preview deployments (from pull requests) will share voting history.
|
||||
*/
|
||||
preview: {
|
||||
statusWalletRequired: false,
|
||||
wakuConfig: {
|
||||
environment: 'production',
|
||||
wakuTopic: `/communitiesCuration/preview/${version}/directory/proto/`,
|
||||
|
@ -72,7 +69,6 @@ const configs: Record<typeof process.env.ENV, Config> = {
|
|||
* Production.
|
||||
*/
|
||||
production: {
|
||||
statusWalletRequired: true,
|
||||
wakuConfig: {
|
||||
environment: 'production',
|
||||
wakuTopic: `/communitiesCuration/${version}/directory/proto/`,
|
||||
|
|
Loading…
Reference in New Issue