Skip to content

Commit

Permalink
hide cross-chain from safe app (#2560)
Browse files Browse the repository at this point in the history
  • Loading branch information
tienkane authored Nov 15, 2024
1 parent 7b61749 commit 8318738
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/components/Header/groups/SwapNavGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ const SwapNavGroup = () => {
pathname.startsWith(path),
)

const ancestorOrigins = window.location.ancestorOrigins
const isSafeAppOrigin = !!ancestorOrigins?.[ancestorOrigins.length - 1]?.includes('app.safe.global')

return (
<NavGroup
dropdownAlign={upToXXSmall ? 'right' : 'left'}
Expand Down Expand Up @@ -101,7 +104,7 @@ const SwapNavGroup = () => {
</StyledNavLink>
)}

{CHAINS_SUPPORT_CROSS_CHAIN.includes(chainId) && (
{CHAINS_SUPPORT_CROSS_CHAIN.includes(chainId) && !isSafeAppOrigin && (
<StyledNavLink
id="cross-chain-nav-link"
to={APP_PATHS.CROSS_CHAIN}
Expand Down
5 changes: 4 additions & 1 deletion src/pages/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,9 @@ export default function App() {
const prevOnline = usePrevious(online)
useSessionExpiredGlobal()

const ancestorOrigins = window.location.ancestorOrigins
const isSafeAppOrigin = !!ancestorOrigins?.[ancestorOrigins.length - 1]?.includes('app.safe.global')

useEffect(() => {
if (prevOnline === false && online && account) {
// refresh page when network back to normal to prevent some issues: ex: stale data, ...
Expand Down Expand Up @@ -238,7 +241,7 @@ export default function App() {
{/* From [email protected], :fromCurrency-to-:toCurrency no long works, need to manually parse the params */}
<Route path={`${APP_PATHS.SWAP}/:network/:currency?`} element={<SwapPage />} />
<Route path={`${APP_PATHS.PARTNER_SWAP}`} element={<PartnerSwap />} />
{CHAINS_SUPPORT_CROSS_CHAIN.includes(chainId) && (
{CHAINS_SUPPORT_CROSS_CHAIN.includes(chainId) && !isSafeAppOrigin && (
<Route path={`${APP_PATHS.CROSS_CHAIN}`} element={<SwapV3 />} />
)}

Expand Down

0 comments on commit 8318738

Please sign in to comment.