Skip to content

Commit

Permalink
fix: fix merge conflicts from branch staging
Browse files Browse the repository at this point in the history
  • Loading branch information
datradito committed Apr 27, 2022
1 parent fd7d4a1 commit ba49e87
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import Row from 'src/components/layout/Row'
import { KeyRing } from 'src/components/AppLayout/Header/components/KeyRing'
// import { isPairingSupported } from 'src/logic/wallets/pairing/utils'
// import { wrapInSuspense } from 'src/utils/wrapInSuspense'
// We need lazy import because the component imports static css that should only be applied if the component is rendered
// const PairingDetails = lazy(() => import('src/components/AppLayout/Header/components/ProviderDetails/PairingDetails'))

const styles = () => ({
Expand Down Expand Up @@ -49,6 +48,8 @@ const ConnectDetails = ({ classes }): ReactElement => (
<Block className={classes.centerText}>
<ConnectButton data-testid="heading-connect-btn" />
</Block>

{/* {isPairingSupported() && wrapInSuspense(<PairingDetails classes={classes} />)} */}
</StyledCard>
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import coinbaseIcon from './icon-coinbase.svg'
import operaIcon from './icon-opera.png'
import squarelinkIcon from './icon-squarelink.png'
import keystoneIcon from './icon-keystone.png'
// import safeMobileIcon from './icon-safe-mobile.svg'
import safeMobileIcon from './icon-safe-mobile.svg'

import { WALLET_PROVIDER } from 'src/logic/wallets/getWeb3'

Expand Down Expand Up @@ -74,10 +74,10 @@ const WALLET_ICONS: { [key in WALLET_PROVIDER]: { src: string; height: number }
src: squarelinkIcon,
height: 25,
},
// [WALLET_PROVIDER.SAFE_MOBILE]: {
// src: safeMobileIcon,
// height: 25,
// },
[WALLET_PROVIDER.SAFE_MOBILE]: {
src: safeMobileIcon,
height: 25,
},
}

export default WALLET_ICONS
62 changes: 32 additions & 30 deletions src/components/AppLayout/Sidebar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { lazy, useMemo } from 'react'
import styled from 'styled-components'
import { Divider } from '@gnosis.pm/safe-react-components'
// import { useDispatch } from 'react-redux'
import { useDispatch } from 'react-redux'

import List, { ListItemType, StyledListItemText } from 'src/components/List'
import List, { ListItemType, StyledListItem, StyledListItemText } from 'src/components/List'
import SafeHeader from './SafeHeader'
import { IS_PRODUCTION } from 'src/utils/constants'
import { IS_PRODUCTION, BEAMER_ID } from 'src/utils/constants'
import { wrapInSuspense } from 'src/utils/wrapInSuspense'
import Track from 'src/components/Track'
import { OVERVIEW_EVENTS } from 'src/utils/events/overview'
import ListIcon from 'src/components/List/ListIcon'
// import { openCookieBanner } from 'src/logic/cookies/store/actions/openCookieBanner'
// import { loadFromCookie } from 'src/logic/cookies/utils'
// import { COOKIES_KEY, BannerCookiesType, COOKIE_IDS } from 'src/logic/cookies/model/cookie'
import { openCookieBanner } from 'src/logic/cookies/store/actions/openCookieBanner'
import { loadFromCookie } from 'src/logic/cookies/utils'
import { COOKIES_KEY, BannerCookiesType, COOKIE_IDS } from 'src/logic/cookies/model/cookie'

const StyledDivider = styled(Divider)`
margin: 16px -8px 0;
Expand Down Expand Up @@ -70,7 +70,7 @@ const lazyLoad = (path: string): React.ReactElement => {
return wrapInSuspense(<Component />)
}

// const isDesktop = process.env.REACT_APP_BUILD_FOR_DESKTOP
const isDesktop = process.env.REACT_APP_BUILD_FOR_DESKTOP

const Sidebar = ({
items,
Expand All @@ -83,23 +83,23 @@ const Sidebar = ({
onNewTransactionClick,
}: Props): React.ReactElement => {
const debugToggle = useMemo(() => (IS_PRODUCTION ? null : lazyLoad('./DebugToggle')), [])
// const dispatch = useDispatch()

// const handleClick = (): void => {
// const cookiesState = loadFromCookie<BannerCookiesType>(COOKIES_KEY)
// if (!cookiesState) {
// dispatch(openCookieBanner({ cookieBannerOpen: true }))
// return
// }
// if (!cookiesState.acceptedSupportAndUpdates) {
// dispatch(
// openCookieBanner({
// cookieBannerOpen: true,
// key: COOKIE_IDS.BEAMER,
// }),
// )
// }
// }
const dispatch = useDispatch()

const handleClick = (): void => {
const cookiesState = loadFromCookie<BannerCookiesType>(COOKIES_KEY)
if (!cookiesState) {
dispatch(openCookieBanner({ cookieBannerOpen: true }))
return
}
if (!cookiesState.acceptedSupportAndUpdates) {
dispatch(
openCookieBanner({
cookieBannerOpen: true,
key: COOKIE_IDS.BEAMER,
}),
)
}
}

return (
<>
Expand All @@ -126,12 +126,14 @@ const Sidebar = ({
<StyledDivider />

<HelpList>
{/* {!isDesktop && BEAMER_ID && (
<StyledListItem id="whats-new-button" button onClick={handleClick}>
<ListIcon type="gift" />
<StyledListItemText>What&apos;s new</StyledListItemText>
</StyledListItem>
)} */}
{!isDesktop && BEAMER_ID && (
<Track {...OVERVIEW_EVENTS.WHATS_NEW}>
<StyledListItem id="whats-new-button" button onClick={handleClick}>
<ListIcon type="gift" />
<StyledListItemText>What&apos;s new</StyledListItemText>
</StyledListItem>
</Track>
)}

<Track {...OVERVIEW_EVENTS.HELP_CENTER}>
<HelpCenterLink href="https://help.gnosis-safe.io/en/" target="_blank" title="Help Center of Gnosis Safe">
Expand Down
34 changes: 22 additions & 12 deletions src/components/CookiesBanner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ import { closeCookieBanner, openCookieBanner } from 'src/logic/cookies/store/act
import { cookieBannerState } from 'src/logic/cookies/store/selectors'
import { loadFromCookie, saveCookie } from 'src/logic/cookies/utils'
import { mainFontFamily, md, primary, screenSm } from 'src/theme/variables'
import { loadGoogleTagManager, unloadGoogleTagManager } from 'src/utils/googleTagManager'
import { isIntercomLoaded, loadIntercom } from 'src/utils/intercom'
import { closeIntercom, isIntercomLoaded, loadIntercom } from 'src/utils/intercom'
import AlertRedIcon from './assets/alert-red.svg'
// import IntercomIcon from './assets/intercom.png'
import { useSafeAppUrl } from 'src/logic/hooks/useSafeAppUrl'
// import { loadBeamer, unloadBeamer } from 'src/utils/beamer'
import { loadGoogleTagManager, unloadGoogleTagManager } from 'src/utils/googleTagManager'
import { loadBeamer, unloadBeamer } from 'src/utils/beamer'

const isDesktop = process.env.REACT_APP_BUILD_FOR_DESKTOP

Expand Down Expand Up @@ -139,6 +139,15 @@ const CookiesBannerForm = (props: {
value={formNecessary}
/>
</div>
<div className={classes.formItem}>
<FormControlLabel
control={<Checkbox checked={formSupportAndUpdates} />}
label="Community support & updates"
name="Community support & updates"
onChange={() => setFormSupportAndUpdates((prev) => !prev)}
value={formSupportAndUpdates}
/>
</div>
<div className={classes.formItem}>
<FormControlLabel
control={<Checkbox checked={formAnalytics} />}
Expand Down Expand Up @@ -167,6 +176,7 @@ const CookiesBannerForm = (props: {
// const FakeIntercomButton = ({ onClick }: { onClick: () => void }): ReactElement => {
// return (
// <img
// alt="Open Intercom"
// style={{
// position: 'fixed',
// cursor: 'pointer',
Expand Down Expand Up @@ -267,25 +277,25 @@ const CookiesBanner = isDesktop

// Toggle Intercom
useEffect(() => {
// if (isSafeAppView || !localSupportAndUpdates) {
// isIntercomLoaded() && closeIntercom()
// return
// }
if (isSafeAppView || !localSupportAndUpdates) {
isIntercomLoaded() && closeIntercom()
return
}

if (!isSafeAppView && localSupportAndUpdates) {
!isIntercomLoaded() && loadIntercom()
}
}, [localSupportAndUpdates, isSafeAppView])

// Toggle Beamer
// useEffect(() => {
// localSupportAndUpdates ? loadBeamer() : unloadBeamer()
// }, [localSupportAndUpdates])
useEffect(() => {
localSupportAndUpdates ? loadBeamer() : unloadBeamer()
}, [localSupportAndUpdates])

return (
<>
{/* A fake Intercom button before Intercom is loaded
{!localSupportAndUpdates && !isSafeAppView && (
{/* A fake Intercom button before Intercom is loaded */}
{/* {!localSupportAndUpdates && !isSafeAppView && (
<FakeIntercomButton onClick={() => openBanner(COOKIE_IDS.INTERCOM)} />
)} */}

Expand Down
2 changes: 1 addition & 1 deletion src/logic/wallets/getWeb3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export enum WALLET_PROVIDER {
LATTICE = 'LATTICE',
KEYSTONE = 'KEYSTONE',
// Safe name as PAIRING_MODULE_NAME
// SAFE_MOBILE = 'SAFE MOBILE',
SAFE_MOBILE = 'SAFE MOBILE',
}

// With some wallets from web3connect you have to use their provider instance only for signing
Expand Down
2 changes: 1 addition & 1 deletion src/logic/wallets/pairing/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { getWCWalletInterface, getWalletConnectProvider } from 'src/logic/wallet
// Modified version of the built in WC module in Onboard v1.35.5
// https://github.com/blocknative/onboard/blob/release/1.35.5/src/modules/select/wallets/wallet-connect.ts

export const PAIRING_MODULE_NAME = ''
export const PAIRING_MODULE_NAME = 'Safe Mobile'

let client = ''
const getClientMeta = (): IClientMeta => {
Expand Down
4 changes: 2 additions & 2 deletions src/logic/wallets/utils/walletList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { WalletInitOptions, WalletModule, WalletSelectModuleOptions } from 'bnc-
import { getRpcServiceUrl, getDisabledWallets, getChainById } from 'src/config'
import { ChainId, WALLETS } from 'src/config/chain.d'
import { FORTMATIC_KEY, PORTIS_ID } from 'src/utils/constants'
// import getPairingModule from 'src/logic/wallets/pairing/module'
import getPairingModule from 'src/logic/wallets/pairing/module'
import { isPairingSupported } from 'src/logic/wallets/pairing/utils'
import getPatchedWCModule from 'src/logic/wallets/walletConnect/module'

Expand Down Expand Up @@ -93,5 +93,5 @@ export const getSupportedWallets = (chainId: ChainId): WalletSelectModuleOptions
}

// Pairing must be 1st in list (to hide via CSS)
return isPairingSupported() ? [...supportedWallets] : supportedWallets
return isPairingSupported() ? [getPairingModule(chainId), ...supportedWallets] : supportedWallets
}
10 changes: 5 additions & 5 deletions src/utils/intercom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ export const loadIntercom = (): void => {
}
}

// export const closeIntercom = (): void => {
// if (!isIntercomLoaded()) return
// intercomLoaded = false
// ;(window as any).Intercom('shutdown')
// }
export const closeIntercom = (): void => {
if (!isIntercomLoaded()) return
intercomLoaded = false
;(window as any).Intercom('shutdown')
}
6 changes: 1 addition & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4848,14 +4848,10 @@ caniuse-api@^3.0.0:
lodash.memoize "^4.1.2"
lodash.uniq "^4.5.0"

caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000929, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001125, caniuse-lite@^1.0.30001271:
caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000929, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001125, caniuse-lite@^1.0.30001271, caniuse-lite@^1.0.30001332:
version "1.0.30001332"
resolved "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001332.tgz"

caniuse-lite@^1.0.30001332:
version "1.0.30001332"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001332.tgz#39476d3aa8d83ea76359c70302eafdd4a1d727dd"

capture-exit@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/capture-exit/-/capture-exit-2.0.0.tgz#fb953bfaebeb781f62898239dabb426d08a509a4"
Expand Down

0 comments on commit ba49e87

Please sign in to comment.