-
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.
Merge pull request #4976 from cowprotocol/release/2024-10-10
chore(release): 2024 10 10
- Loading branch information
Showing
121 changed files
with
2,533 additions
and
912 deletions.
There are no files selected for viewing
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
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
67 changes: 67 additions & 0 deletions
67
apps/cowswap-frontend/src/common/containers/OrderHooksDetails/HookItem/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,67 @@ | ||
import { useState } from 'react' | ||
|
||
import { HookToDappMatch } from '@cowprotocol/hook-dapp-lib' | ||
|
||
import { ChevronDown, ChevronUp } from 'react-feather' | ||
|
||
import { clickOnHooks } from 'modules/analytics' | ||
|
||
import * as styledEl from './styled' | ||
|
||
export function HookItem({ item, index }: { item: HookToDappMatch; index: number }) { | ||
const [isOpen, setIsOpen] = useState(false) | ||
|
||
const handleLinkClick = () => { | ||
clickOnHooks(item.dapp?.name || 'Unknown hook dapp') | ||
} | ||
|
||
return ( | ||
<styledEl.HookItemWrapper as="li"> | ||
<styledEl.HookItemHeader onClick={() => setIsOpen(!isOpen)}> | ||
<styledEl.HookItemInfo> | ||
<styledEl.HookNumber>{index + 1}</styledEl.HookNumber> | ||
{item.dapp ? ( | ||
<> | ||
<img src={item.dapp.image} alt={item.dapp.name} /> | ||
<span>{item.dapp.name}</span> | ||
</> | ||
) : ( | ||
<span>Unknown hook dapp</span> | ||
)} | ||
</styledEl.HookItemInfo> | ||
<styledEl.ToggleIcon isOpen={isOpen}> | ||
{isOpen ? <ChevronUp size={16} /> : <ChevronDown size={16} />} | ||
</styledEl.ToggleIcon> | ||
</styledEl.HookItemHeader> | ||
{isOpen && ( | ||
<styledEl.HookItemContent> | ||
{item.dapp && ( | ||
<> | ||
<p> | ||
<b>Description:</b> {item.dapp.descriptionShort} | ||
</p> | ||
<p> | ||
<b>Version:</b> {item.dapp.version} | ||
</p> | ||
<p> | ||
<b>Website:</b>{' '} | ||
<a href={item.dapp.website} target="_blank" rel="noopener noreferrer" onClick={handleLinkClick}> | ||
{item.dapp.website} | ||
</a> | ||
</p> | ||
</> | ||
)} | ||
<p> | ||
<b>calldata:</b> {item.hook.callData} | ||
</p> | ||
<p> | ||
<b>target:</b> {item.hook.target} | ||
</p> | ||
<p> | ||
<b>gasLimit:</b> {item.hook.gasLimit} | ||
</p> | ||
</styledEl.HookItemContent> | ||
)} | ||
</styledEl.HookItemWrapper> | ||
) | ||
} |
Oops, something went wrong.