From 2a1111db95491bd80649bc726df934e20c4a0651 Mon Sep 17 00:00:00 2001 From: Michel Date: Thu, 28 Sep 2023 18:01:33 +0100 Subject: [PATCH 01/26] feat: widget init mods --- apps/cowswap-frontend/src/cow-react/index.tsx | 16 ++++++++++++---- .../legacy/components/ErrorBoundary/index.tsx | 7 +++++++ .../src/legacy/theme/baseTheme.tsx | 5 ++--- apps/cowswap-frontend/src/legacy/theme/index.tsx | 13 +++++++++---- .../src/legacy/theme/styled.d.ts | 1 + .../modules/application/containers/App/index.tsx | 13 ++++++++++--- .../modules/application/containers/App/styled.ts | 8 ++++---- 7 files changed, 45 insertions(+), 18 deletions(-) diff --git a/apps/cowswap-frontend/src/cow-react/index.tsx b/apps/cowswap-frontend/src/cow-react/index.tsx index 550ac9907f..eb78e960c7 100644 --- a/apps/cowswap-frontend/src/cow-react/index.tsx +++ b/apps/cowswap-frontend/src/cow-react/index.tsx @@ -7,6 +7,7 @@ import { Provider as AtomProvider } from 'jotai' import { StrictMode } from 'react' import { BlockNumberProvider } from '@cowprotocol/common-hooks' +import { isInjectedWidget } from '@cowprotocol/common-utils' import { nodeRemoveChildFix } from '@cowprotocol/common-utils' import { jotaiStore } from '@cowprotocol/core' import { SnackbarsWidget } from '@cowprotocol/snackbars' @@ -41,6 +42,7 @@ if (window.ethereum) { } const root = createRoot(document.getElementById('root')!) +const isInjectedWidgetMode = isInjectedWidget() root.render( @@ -56,12 +58,18 @@ root.render( - - - + + {!isInjectedWidgetMode && ( + <> + + + + + + )} + - diff --git a/apps/cowswap-frontend/src/legacy/components/ErrorBoundary/index.tsx b/apps/cowswap-frontend/src/legacy/components/ErrorBoundary/index.tsx index 74d286ca67..ef462a670d 100644 --- a/apps/cowswap-frontend/src/legacy/components/ErrorBoundary/index.tsx +++ b/apps/cowswap-frontend/src/legacy/components/ErrorBoundary/index.tsx @@ -1,10 +1,12 @@ import React, { ErrorInfo, PropsWithChildren } from 'react' import { sendError } from '@cowprotocol/analytics' +import { isInjectedWidget } from '@cowprotocol/common-utils' import * as Sentry from '@sentry/react' import styled from 'styled-components/macro' + import { ChunkLoadError } from 'legacy/components/ErrorBoundary/ChunkLoadError' import { ErrorWithStackTrace } from 'legacy/components/ErrorBoundary/ErrorWithStackTrace' import Footer from 'legacy/components/Footer' @@ -128,7 +130,10 @@ export default class ErrorBoundary extends React.Component + + {!isInjectedWidget() && +

Test!!!!!!!!!!!!!

@@ -137,6 +142,8 @@ export default class ErrorBoundary extends React.Component
+ } + {isChunkLoadError ? : }