Skip to content

Commit

Permalink
Make sure we link inside the iframe without reloading or new tab
Browse files Browse the repository at this point in the history
  • Loading branch information
asgeir-s committed Dec 7, 2022
1 parent 8287f5f commit b6d4274
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export const ConnectWalletBox = () => {
address={address}
emptyText="No Wallet Connected"
onClick={walletType !== WalletType.GNOSIS_SAFE ? () => setShowWalletOption(!showWalletOption) : undefined}
linkToZodiac={walletType === WalletType.GNOSIS_SAFE}
/>
{showWalletOption && (
<Box className={classes.connectWalletBoxMenu}>
Expand Down
18 changes: 6 additions & 12 deletions packages/app/src/components/views/Header/HeaderAddressBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import { ArrowForward } from "@material-ui/icons"
import { EthHashInfo } from "@gnosis.pm/safe-react-components"
import { truncateEthAddress } from "../../../utils/address"
import classNames from "classnames"
import { useRootSelector } from "../../../store"
import { getChainId, getRolesModifierAddress } from "../../../store/main/selectors"
import { getNetwork, NETWORKS } from "../../../utils/networks"

const useStyles = makeStyles((theme) => ({
root: {
Expand Down Expand Up @@ -51,16 +48,12 @@ interface HeaderAddressBoxProps {
address?: string
emptyText: string
onClick?: () => void
linkToZodiac?: boolean
}

const networkConfigs = NETWORKS.map(getNetwork)

export const HeaderAddressBox = ({ address, emptyText, onClick }: HeaderAddressBoxProps) => {
export const HeaderAddressBox = ({ address, emptyText, onClick, linkToZodiac }: HeaderAddressBoxProps) => {
const classes = useStyles()
const network = useRootSelector(getChainId)
const rolesModifierAddress = useRootSelector(getRolesModifierAddress)

const networkShortname = networkConfigs.find((chain) => chain.chainId === network)?.shortName
return (
<HeaderBox
icon={
Expand All @@ -84,11 +77,12 @@ export const HeaderAddressBox = ({ address, emptyText, onClick }: HeaderAddressB
>
{address ? truncateEthAddress(address) : emptyText}
</Typography>
{address && (
{address && linkToZodiac && (
<Link
target="_blank"
rel="noredirect"
href={`https://app.safe.global/${networkShortname}:${rolesModifierAddress}/apps?appUrl=https%3A%2F%2Fzodiac.gnosisguild.org%2F`}
onClick={() => {
window.location.href = `https://zodiac.gnosisguild.org/`
}}
className={classes.zodiacLink}
underline="always"
>
Expand Down

0 comments on commit b6d4274

Please sign in to comment.