-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Widget UI + configurator #3227
Merged
Merged
Widget UI + configurator #3227
Changes from 24 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
2a1111d
feat: widget init mods
d6e6a76
feat: widget menu links
fc0113f
feat: select menu
6962653
feat: select menu
cd00476
feat: select menu
26de84c
Update apps/cowswap-frontend/src/modules/trade/containers/TradeWidget…
fairlighteth bac8ade
feat: fix semicolons
fairlighteth 07ea891
feat: menu styling
fairlighteth 3b76433
feat: general styling
fairlighteth a343871
feat: connect wallet internal
fairlighteth fe89695
feat: connect wallet internal
fairlighteth f931b09
feat: connect wallet internal
fairlighteth 9180d5e
feat: widget configurator app
fairlighteth d96c8c7
feat: widget configurator app
fairlighteth c23d531
feat: widget configurator app
fairlighteth 30565eb
feat: widget configurator app
fairlighteth 64c8533
feat: widget configurator app
fairlighteth d0b064e
feat: widget configurator app
fairlighteth 6c39e14
feat: widget configurator app
fairlighteth 8638950
feat: widget configurator app
fairlighteth 790abd0
feat: widget configurator app
fairlighteth 65c6f00
feat: widget configurator app
fairlighteth 527108a
Merge branch 'develop' into widget-ui-6
fairlighteth a133ca5
feat: widget configurator app
fairlighteth 0abd19e
refactor: extract AccountElement and AccountModalState
shoom3301 c7e94e0
Merge branch 'develop' of https://github.com/cowprotocol/cowswap into…
shoom3301 3e78f09
chore: update yarn.lock
shoom3301 7f5b699
chore: fix code style
shoom3301 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { useState, useCallback } from 'react'; | ||
|
||
interface UseOrdersPanel { | ||
isOrdersPanelOpen: boolean; | ||
handleOpenOrdersPanel: () => void; | ||
handleCloseOrdersPanel: () => void; | ||
} | ||
|
||
export const useOrdersPanel = (): UseOrdersPanel => { | ||
const [isOrdersPanelOpen, setIsOrdersPanelOpen] = useState<boolean>(false); | ||
|
||
const handleOpenOrdersPanel = useCallback(() => { | ||
setIsOrdersPanelOpen(true); | ||
}, []); | ||
|
||
const handleCloseOrdersPanel = useCallback(() => { | ||
setIsOrdersPanelOpen(false); | ||
}, []); | ||
|
||
return { | ||
isOrdersPanelOpen, | ||
handleOpenOrdersPanel, | ||
handleCloseOrdersPanel, | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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( | ||
<StrictMode> | ||
|
@@ -56,12 +58,18 @@ root.render( | |
<BlockNumberProvider> | ||
<WithLDProvider> | ||
<Updaters /> | ||
<FeatureGuard featureFlag="cowFortuneEnabled"> | ||
<FortuneWidget /> | ||
</FeatureGuard> | ||
|
||
{!isInjectedWidgetMode && ( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't render Fortune Widget and Appzi button for Widget mode |
||
<> | ||
<FeatureGuard featureFlag="cowFortuneEnabled"> | ||
<FortuneWidget /> | ||
</FeatureGuard> | ||
<AppziButton /> | ||
</> | ||
)} | ||
|
||
<Popups /> | ||
<SnackbarsWidget /> | ||
<AppziButton /> | ||
<App /> | ||
</WithLDProvider> | ||
</BlockNumberProvider> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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,6 +130,8 @@ export default class ErrorBoundary extends React.Component<PropsWithChildren, Er | |
|
||
return ( | ||
<AppWrapper> | ||
|
||
{!isInjectedWidget() && | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hide the normal header (logo/menu/etc) in Widget mode |
||
<HeaderWrapper> | ||
<HeaderRow marginRight="0"> | ||
<a href={Routes.HOME}> | ||
|
@@ -137,6 +141,8 @@ export default class ErrorBoundary extends React.Component<PropsWithChildren, Er | |
</a> | ||
</HeaderRow> | ||
</HeaderWrapper> | ||
} | ||
|
||
<Wrapper>{isChunkLoadError ? <ChunkLoadError /> : <ErrorWithStackTrace error={error} />}</Wrapper> | ||
<FooterWrapper> | ||
<Footer /> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
creating a reusable hook to control the orders panel (user activity modal)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refactored it into
accountModalStateAtom