Skip to content

Commit 2ed013f

Browse files
authored
Merge pull request #5121 from cowprotocol/release/2024-11-21
Release 2024-11-21
2 parents c0ee322 + cd9f2e1 commit 2ed013f

File tree

47 files changed

+597
-358
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+597
-358
lines changed

apps/cowswap-frontend/src/common/constants/routes.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
import EXPERIMENT_ICON from '@cowprotocol/assets/cow-swap/experiment.svg'
12
import { isInjectedWidget } from '@cowprotocol/common-utils'
3+
import { BadgeTypes } from '@cowprotocol/ui'
24

35
export const TRADE_WIDGET_PREFIX = isInjectedWidget() ? '/widget' : ''
46

@@ -39,29 +41,35 @@ export const Routes = {
3941
export type RoutesKeys = keyof typeof Routes
4042
export type RoutesValues = (typeof Routes)[RoutesKeys]
4143

42-
export const MENU_ITEMS: {
44+
export interface IMenuItem {
4345
route: RoutesValues
4446
label: string
4547
fullLabel?: string
4648
description: string
4749
badge?: string
48-
}[] = [
50+
badgeImage?: string
51+
badgeType?: (typeof BadgeTypes)[keyof typeof BadgeTypes]
52+
}
53+
54+
export const MENU_ITEMS: IMenuItem[] = [
4955
{ route: Routes.SWAP, label: 'Swap', description: 'Trade tokens' },
5056
{ route: Routes.LIMIT_ORDER, label: 'Limit', fullLabel: 'Limit order', description: 'Set your own price' },
5157
{ route: Routes.ADVANCED_ORDERS, label: 'TWAP', description: 'Place orders with a time-weighted average price' },
5258
]
5359

54-
export const HOOKS_STORE_MENU_ITEM = {
60+
export const HOOKS_STORE_MENU_ITEM: IMenuItem = {
5561
route: Routes.HOOKS,
5662
label: 'Hooks',
5763
description: 'Powerful tool to generate pre/post interaction for CoW Protocol',
58-
badge: '🧪',
64+
badgeImage: EXPERIMENT_ICON,
65+
badgeType: BadgeTypes.INFORMATION,
5966
}
6067

61-
export const YIELD_MENU_ITEM = {
68+
export const YIELD_MENU_ITEM: IMenuItem = {
6269
route: Routes.YIELD,
6370
label: 'Yield',
6471
fullLabel: 'Yield',
6572
description: 'Provide liquidity',
6673
badge: 'New',
74+
badgeType: BadgeTypes.ALERT,
6775
}

apps/cowswap-frontend/src/common/containers/CoWAmmBanner/useVampireAttack.ts

Lines changed: 0 additions & 101 deletions
This file was deleted.

apps/cowswap-frontend/src/common/containers/OrderHooksDetails/index.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,10 @@ interface OrderHooksDetailsProps {
1818
appData: string | AppDataInfo
1919
children: (content: ReactElement) => ReactElement
2020
margin?: string
21+
isTradeConfirmation?: boolean
2122
}
2223

23-
export function OrderHooksDetails({ appData, children, margin }: OrderHooksDetailsProps) {
24+
export function OrderHooksDetails({ appData, children, margin, isTradeConfirmation }: OrderHooksDetailsProps) {
2425
const [isOpen, setOpen] = useState(false)
2526
const appDataDoc = useMemo(() => {
2627
return typeof appData === 'string' ? decodeAppData(appData) : appData.doc
@@ -33,14 +34,14 @@ export function OrderHooksDetails({ appData, children, margin }: OrderHooksDetai
3334
const { mutate, isValidating, data } = useTenderlyBundleSimulation()
3435

3536
useEffect(() => {
36-
mutate()
37-
}, []) // eslint-disable-line react-hooks/exhaustive-deps
37+
if (isTradeConfirmation) mutate()
38+
}, [isTradeConfirmation, mutate])
3839

3940
if (!appDataDoc) return null
4041

4142
const metadata = appDataDoc.metadata as latest.Metadata
4243

43-
const hasSomeFailedSimulation = Object.values(data || {}).some((hook) => !hook.status)
44+
const hasSomeFailedSimulation = isTradeConfirmation && Object.values(data || {}).some((hook) => !hook.status)
4445

4546
const preHooksToDapp = matchHooksToDappsRegistry(metadata.hooks?.pre || [], preCustomHookDapps)
4647
const postHooksToDapp = matchHooksToDappsRegistry(metadata.hooks?.post || [], postCustomHookDapps)
@@ -76,8 +77,8 @@ export function OrderHooksDetails({ appData, children, margin }: OrderHooksDetai
7677
</styledEl.Summary>
7778
{isOpen && (
7879
<styledEl.Details>
79-
<HooksInfo data={preHooksToDapp} hooks={hooks.preHooks} title="Pre Hooks" />
80-
<HooksInfo data={postHooksToDapp} hooks={hooks.postHooks} title="Post Hooks" />
80+
<HooksInfo data={preHooksToDapp} hooks={isTradeConfirmation ? hooks.preHooks : []} title="Pre Hooks" />
81+
<HooksInfo data={postHooksToDapp} hooks={isTradeConfirmation ? hooks.postHooks : []} title="Post Hooks" />
8182
</styledEl.Details>
8283
)}
8384
</styledEl.Wrapper>,

apps/cowswap-frontend/src/common/hooks/useMenuItems.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ import { isLocal } from '@cowprotocol/common-utils'
55

66
import { useHooksEnabled } from 'legacy/state/user/hooks'
77

8-
import { HOOKS_STORE_MENU_ITEM, MENU_ITEMS, YIELD_MENU_ITEM } from '../constants/routes'
8+
import { HOOKS_STORE_MENU_ITEM, MENU_ITEMS, IMenuItem, YIELD_MENU_ITEM } from '../constants/routes'
99

10-
export function useMenuItems() {
10+
export function useMenuItems(): IMenuItem[] {
1111
const isHooksEnabled = useHooksEnabled()
1212
const { isYieldEnabled } = useFeatureFlags()
1313

apps/cowswap-frontend/src/common/pure/ExternalSourceAlert/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function ExternalSourceAlert({ className, onChange, title, children }: Ex
1616
return (
1717
<styledEl.Contents className={className}>
1818
<AlertTriangle size={48} strokeWidth={1} />
19-
<h3>{title}</h3>
19+
<styledEl.Title>{title}</styledEl.Title>
2020
{children}
2121

2222
<styledEl.AcceptanceBox>

apps/cowswap-frontend/src/common/pure/ExternalSourceAlert/styled.tsx

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,21 @@ export const Contents = styled.div`
1414
color: var(${UI.COLOR_DANGER_TEXT});
1515
background: var(${UI.COLOR_DANGER_BG});
1616
17-
h3 {
18-
font-size: 24px;
19-
text-align: center;
20-
margin: 16px 0;
21-
font-weight: bold;
22-
}
23-
24-
p {
25-
margin: 6px 0;
26-
}
27-
2817
> svg > path,
2918
> svg > line {
3019
stroke: var(${UI.COLOR_DANGER_TEXT});
3120
stroke-width: 2px;
3221
}
3322
`
3423

24+
export const Title = styled.h4`
25+
font-size: 24px;
26+
text-align: center;
27+
margin: 16px 0;
28+
font-weight: bold;
29+
width: 100%;
30+
`
31+
3532
export const AcceptanceBox = styled.label`
3633
display: flex;
3734
gap: 6px;

apps/cowswap-frontend/src/common/pure/RateInfo/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,9 @@ const InvertIcon = styled.div`
8484
min-width: var(--size);
8585
min-height: var(--size);
8686
border-radius: var(--size);
87-
transition: background var(${UI.ANIMATION_DURATION}) ease-in-out, var(${UI.ANIMATION_DURATION}) ease-in-out;
87+
transition:
88+
background var(${UI.ANIMATION_DURATION}) ease-in-out,
89+
var(${UI.ANIMATION_DURATION}) ease-in-out;
8890
}
8991
9092
> svg {
@@ -118,7 +120,7 @@ export const RateWrapper = styled.button`
118120
color: inherit;
119121
font-size: 13px;
120122
letter-spacing: -0.1px;
121-
text-align: right;
123+
text-align: left;
122124
font-weight: 500;
123125
width: 100%;
124126
`

apps/cowswap-frontend/src/common/pure/TradeDetailsAccordion/styled.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,17 @@ export const Details = styled.div`
2525

2626
export const Summary = styled.div`
2727
display: grid;
28-
grid-template-columns: auto 1fr;
28+
grid-template-columns: 1fr auto;
2929
justify-content: space-between;
3030
align-items: center;
3131
width: 100%;
32-
gap: 8px;
32+
gap: 10px;
3333
font-size: inherit;
3434
font-weight: inherit;
3535
3636
span {
3737
font-size: inherit;
3838
font-weight: inherit;
39-
white-space: nowrap;
4039
}
4140
`
4241

apps/cowswap-frontend/src/common/updaters/LpBalancesAndAllowancesUpdater.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,9 @@ export function LpBalancesAndAllowancesUpdater({ account, chainId, enablePolling
5050
return () => clearTimeout(timeout)
5151
}, [])
5252

53+
useEffect(() => {
54+
setAreLpBalancesLoaded(false)
55+
}, [account, setAreLpBalancesLoaded])
56+
5357
return null
5458
}

apps/cowswap-frontend/src/legacy/components/NumericalInput/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export const Input = React.memo(function InnerInput({
102102
pattern="^[0-9]*[.,]?[0-9]*$"
103103
placeholder={placeholder || '0.0'}
104104
minLength={1}
105-
maxLength={79}
105+
maxLength={32}
106106
spellCheck="false"
107107
/>
108108
)

0 commit comments

Comments
 (0)