-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(hooks-store): import custom hook-dapps (#4910)
* feat(hooks-store): add order params and signer to hook dapp context * feat(hooks-store): setup blank app for iframe hook * refactor: generalise CowEventEmitter in order to reuse it in hook dapps * feat: iframe transport library * feat: use iframe-transport lib for widget * feat: hook-dapp-lib for hook-dapps in iframe * feat(hooks-store): add omnibridge hook-dapp via iframe * chore: specify key * docs: doc @cowprotocol/hook-dapp-lib * chore: revert ff * refactor: simplify hooks store state * chore: fix build * chore: fix build * chore: remove boilerplate * Update libs/hook-dapp-lib/README.md Co-authored-by: Leandro <[email protected]> * chore: fix package json * chore: remove wrong permit check * feat: add isSmartContract to hook dapp context * refactor: fix WidgetEthereumProvider deps * chore: pull develop * chore: hook dapp lib deps * chore: fix permit hook adding * feat(hooks-store): callbacks to changes sell buy tokens * feat(hooks-store): import external hook-dapps * fix: rpc bridge duplication * chore: make conditions optional * chore: polish UI * chore: fix lint * refactor(events): generalise SimpleCowEventEmitter for reusing porposes (#4886) * refactor: generalise CowEventEmitter in order to reuse it in hook dapps * feat: library iframe-transport to communicate between app and iframe (#4887) * feat: iframe transport library * chore: specify key * feat(widget): integrate iframe-transport lib in widget (#4888) * feat: use iframe-transport lib for widget * feat(hooks-store): library for building external hook-dapps (#4889) * feat: hook-dapp-lib for hook-dapps in iframe * docs: doc @cowprotocol/hook-dapp-lib * Update libs/hook-dapp-lib/README.md Co-authored-by: Leandro <[email protected]> * chore: fix package json * feat(hooks-store): integrate an iframe hook-dapp for example (#4890) * feat(hooks-store): add omnibridge hook-dapp via iframe * chore: revert ff * refactor: simplify hooks store state * chore: fix build * chore: fix build * chore: remove wrong permit check * feat: add isSmartContract to hook dapp context * refactor: fix WidgetEthereumProvider deps * chore: pull develop * chore: hook dapp lib deps * chore: fix permit hook adding * feat(hooks-store): callbacks to changes sell buy tokens * chore: fix lint * chore: fix merge * chore: up version * chore: remove unused hook * chore: fix build * fix(hooks-store): use recipient override only in hooks page * chore: trim hook url * chore: fix build * feat(hooks-store): style custom hook-dapps (#4912) * feat: styling tabs + counter * feat: styling tabs + counter * feat: add inline search * chore: fix build * feat: style inline search and custom hooks add * feat: add simulatin styling * feat: merge conflic fixes * feat: handle walletcompat undefined * fix: missing property * refactor: simlify hooks-store code * refactor: rename externalHooks to customHooks * refactor: separate pre/post custom hooks * chore: fix UI * chore: fix tenderly simulation * chore: fix styles * chore: fix styles * chore: fix recipient resetting * chore: fix hooks-store ui issues * feat(hook-dapp-lib): add isDarkMode parameter to context * fix(hooks-store): always display SwapWidget to keep updaters active * chore: fix style * chore: fix style --------- Co-authored-by: Alexandr Kazachenko <[email protected]> --------- Co-authored-by: Leandro <[email protected]> Co-authored-by: fairlight <[email protected]>
- Loading branch information
1 parent
897ce91
commit 5847017
Showing
49 changed files
with
1,129 additions
and
220 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
apps/cowswap-frontend/src/common/pure/ExternalSourceAlert/index.tsx
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,27 @@ | ||
import { ReactElement } from 'react' | ||
|
||
import { Command } from '@cowprotocol/types' | ||
|
||
import { AlertTriangle } from 'react-feather' | ||
|
||
import * as styledEl from './styled' | ||
|
||
interface ExternalSourceAlertProps { | ||
children: ReactElement | ||
title: ReactElement | string | ||
onChange: Command | ||
} | ||
export function ExternalSourceAlert({ onChange, title, children }: ExternalSourceAlertProps) { | ||
return ( | ||
<styledEl.Contents> | ||
<AlertTriangle size={48} strokeWidth={1} /> | ||
<h3>{title}</h3> | ||
{children} | ||
|
||
<styledEl.AcceptanceBox> | ||
<input type="checkbox" onChange={onChange} /> | ||
<span>I understand</span> | ||
</styledEl.AcceptanceBox> | ||
</styledEl.Contents> | ||
) | ||
} |
76 changes: 76 additions & 0 deletions
76
apps/cowswap-frontend/src/common/pure/ExternalSourceAlert/styled.tsx
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,76 @@ | ||
import { UI } from '@cowprotocol/ui' | ||
|
||
import styled from 'styled-components/macro' | ||
|
||
export const Contents = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
text-align: center; | ||
gap: 5px; | ||
padding: 20px; | ||
margin: 0; | ||
border-radius: 20px; | ||
color: var(${UI.COLOR_DANGER_TEXT}); | ||
background: var(${UI.COLOR_DANGER_BG}); | ||
h3 { | ||
font-size: 24px; | ||
text-align: center; | ||
margin: 18px 0; | ||
font-weight: bold; | ||
} | ||
> svg > path, | ||
> svg > line { | ||
stroke: var(${UI.COLOR_DANGER_TEXT}); | ||
stroke-width: 2px; | ||
} | ||
` | ||
|
||
export const AcceptanceBox = styled.label` | ||
display: flex; | ||
gap: 6px; | ||
align-items: center; | ||
justify-content: center; | ||
cursor: pointer; | ||
margin: 24px auto 0; | ||
padding: 24px 0; | ||
border-top: 1px solid var(${UI.COLOR_DANGER_TEXT}); | ||
width: 100%; | ||
font-size: 18px; | ||
font-weight: bold; | ||
transition: all var(${UI.ANIMATION_DURATION}) ease-in-out; | ||
border-radius: 0; | ||
&:hover { | ||
background: var(${UI.COLOR_DANGER_BG}); | ||
border-radius: 12px; | ||
} | ||
> input { | ||
--size: 18px; | ||
width: var(--size); | ||
height: var(--size); | ||
border-radius: 4px; | ||
border: 1px solid var(${UI.COLOR_DANGER_TEXT}); | ||
background: var(${UI.COLOR_PAPER}); | ||
appearance: none; | ||
position: relative; | ||
&:checked { | ||
background: var(${UI.COLOR_DANGER_TEXT}); | ||
&::after { | ||
content: '✓'; | ||
position: absolute; | ||
top: 50%; | ||
left: 50%; | ||
transform: translate(-50%, -50%); | ||
color: var(${UI.COLOR_PAPER}); | ||
font-size: 14px; | ||
font-weight: bold; | ||
} | ||
} | ||
} | ||
` |
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
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.