Skip to content
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

chore: merge main to develop #5231

Merged
merged 5 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"apps/cowswap-frontend": "1.93.2",
"apps/explorer": "2.39.0",
"apps/cowswap-frontend": "1.95.0",
"apps/explorer": "2.40.1",
"libs/permit-utils": "0.5.0",
"libs/widget-lib": "0.18.0",
"libs/widget-react": "0.11.0",
"apps/widget-configurator": "1.10.0",
"apps/widget-configurator": "1.10.1",
"libs/analytics": "1.9.0",
"libs/assets": "1.11.0",
"libs/common-const": "1.12.2",
"libs/assets": "1.12.0",
"libs/common-const": "1.13.0",
"libs/common-hooks": "1.6.0",
"libs/common-utils": "1.8.0",
"libs/core": "1.5.0",
"libs/core": "1.6.0",
"libs/ens": "1.3.0",
"libs/events": "1.5.0",
"libs/snackbars": "1.1.0",
"libs/tokens": "1.13.0",
"libs/tokens": "1.13.1",
"libs/types": "1.5.0",
"libs/ui": "1.16.0",
"libs/wallet": "1.7.0",
"libs/ui": "1.17.0",
"libs/wallet": "1.8.0",
"apps/cow-fi": "1.19.3",
"libs/wallet-provider": "1.0.0",
"libs/ui-utils": "1.1.0",
"libs/abis": "1.2.0",
"libs/abis": "1.2.1",
"libs/balances-and-allowances": "1.2.0",
"libs/iframe-transport": "1.0.0",
"libs/hook-dapp-lib": "1.4.0",
Expand Down
19 changes: 19 additions & 0 deletions apps/cowswap-frontend/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# Changelog

## [1.95.0](https://github.com/cowprotocol/cowswap/compare/cowswap-v1.94.0...cowswap-v1.95.0) (2024-12-18)


### Features

* force release to release, pleaseeee ([a59eb27](https://github.com/cowprotocol/cowswap/commit/a59eb275a96fb13c9521784a051f734d947a1b1f))

## [1.94.0](https://github.com/cowprotocol/cowswap/compare/cowswap-v1.93.2...cowswap-v1.94.0) (2024-12-18)


### Features

* allow 1 year max deadline ([#5227](https://github.com/cowprotocol/cowswap/issues/5227)) ([64e3f40](https://github.com/cowprotocol/cowswap/commit/64e3f40a19da19ba7d44f4ebcb1b494fd4426882))


### Bug Fixes

* account for a bad CMS request ([#5221](https://github.com/cowprotocol/cowswap/issues/5221)) ([8d2edd7](https://github.com/cowprotocol/cowswap/commit/8d2edd7d87f0622fdc5885b45175b89b49eae1ec))

## [1.93.2](https://github.com/cowprotocol/cowswap/compare/cowswap-v1.93.1...cowswap-v1.93.2) (2024-12-13)


Expand Down
1 change: 0 additions & 1 deletion apps/cowswap-frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
<meta name="twitter:site" content="@CoWSwap" />
<meta name="twitter:title" content="CoW Swap | The smartest way to trade cryptocurrencies" />
<meta name="twitter:image" content="https://swap.cow.fi/images/og-meta-cowswap.png?v=4" />

<style>
html,
body {
Expand Down
2 changes: 1 addition & 1 deletion apps/cowswap-frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cowprotocol/cowswap",
"version": "1.93.2",
"version": "1.95.0",
"description": "CoW Swap",
"main": "index.js",
"author": "",
Expand Down
2 changes: 1 addition & 1 deletion apps/cowswap-frontend/src/common/constants/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ms from 'ms.macro'

export const HIGH_FEE_WARNING_PERCENTAGE = new Percent(1, 10)

export const MAX_ORDER_DEADLINE = ms`182d` + ms`12h` // 6 months, matching backend's https://github.com/cowprotocol/infrastructure/blob/901ed8e2fe3ea57956585f107bdd7539c2e7d3d1/services/Pulumi.yaml#L15
export const MAX_ORDER_DEADLINE = ms`1y` // https://github.com/cowprotocol/infrastructure/blob/staging/services/Pulumi.yaml#L7

// Use a 150K gas as a fallback if there's issue calculating the gas estimation (fixes some issues with some nodes failing to calculate gas costs for SC wallets)
export const GAS_LIMIT_DEFAULT = BigNumber.from('150000')
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export const LIMIT_ORDERS_DEADLINES: LimitOrderDeadline[] = [
{ title: '3 Days', value: ms`3d` },
defaultLimitOrderDeadline,
{ title: '1 Month', value: ms`30d` },
{ title: '6 Months (max)', value: MAX_CUSTOM_DEADLINE },
{ title: '1 Year (max)', value: MAX_CUSTOM_DEADLINE },
]

/**
Expand Down
14 changes: 14 additions & 0 deletions apps/explorer/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# Changelog

## [2.40.1](https://github.com/cowprotocol/cowswap/compare/explorer-v2.40.0...explorer-v2.40.1) (2024-12-18)


### Bug Fixes

* fix lint issues ([#5229](https://github.com/cowprotocol/cowswap/issues/5229)) ([25d30bb](https://github.com/cowprotocol/cowswap/commit/25d30bb6496a1fa51719b639948cc4d7b8ec5f20))

## [2.40.0](https://github.com/cowprotocol/cowswap/compare/explorer-v2.39.0...explorer-v2.40.0) (2024-12-18)


### Features

* improve orders table when hidden orders ([#5226](https://github.com/cowprotocol/cowswap/issues/5226)) ([a4aaff9](https://github.com/cowprotocol/cowswap/commit/a4aaff94980fad15030bb057bbc45baa20f8336c))

## [2.39.0](https://github.com/cowprotocol/cowswap/compare/explorer-v2.38.0...explorer-v2.39.0) (2024-12-17)


Expand Down
2 changes: 1 addition & 1 deletion apps/explorer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cowprotocol/explorer",
"version": "2.39.0",
"version": "2.40.1",
"description": "CoW Swap Explorer",
"main": "src/main.tsx",
"author": "",
Expand Down
6 changes: 3 additions & 3 deletions apps/explorer/src/components/common/Tabs/Tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export interface Props {
readonly tabTheme: TabTheme
readonly selectedTab?: TabId
readonly extra?: TabBarExtraContent
readonly extraPosition?: 'top' | 'bottom'
readonly extraPosition?: 'top' | 'bottom' | 'both'
readonly updateSelectedTab?: (activeId: TabId) => void
}

Expand Down Expand Up @@ -129,10 +129,10 @@ const Tabs: React.FC<Props> = (props) => {
tabTheme={tabTheme}
/>
))}
{extraPosition === 'top' && <ExtraContent extra={tabBarExtraContent} />}
{['top', 'both'].includes(extraPosition) && <ExtraContent extra={tabBarExtraContent} />}
</TabList>
<TabContent tabItems={tabItems} activeTab={selectedTab} />
{extraPosition === 'bottom' && <ExtraContent extra={tabBarExtraContent} />}
{['bottom', 'both'].includes(extraPosition) && <ExtraContent extra={tabBarExtraContent} />}
</Wrapper>
)
}
Expand Down
147 changes: 104 additions & 43 deletions apps/explorer/src/components/orders/OrdersUserDetailsTable/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React, { useEffect, useState } from 'react'

import { Command } from '@cowprotocol/types'
import { TruncatedText } from '@cowprotocol/ui/pure/TruncatedText'

import { faExchangeAlt } from '@fortawesome/free-solid-svg-icons'
Expand All @@ -23,6 +24,7 @@ import { getLimitPrice } from 'utils/getLimitPrice'
import { OrderSurplusDisplayStyledByRow } from './OrderSurplusTooltipStyledByRow'
import { ToggleFilter } from './ToggleFilter'

import { TableState } from '../../../explorer/components/TokensTableWidget/useTable'
import { SimpleTable, SimpleTableProps } from '../../common/SimpleTable'
import { StatusLabel } from '../StatusLabel'
import { UnsignedOrderWarning } from '../UnsignedOrderWarning'
Expand All @@ -35,7 +37,7 @@ function isExpiredOrCanceled(order: Order): boolean {
if (!executedSellAmount.isZero() || !executedBuyAmount.isZero()) return false

// Otherwise, return if the order is expired or canceled
return EXPIRED_CANCELED_STATES.includes(order.status)
return EXPIRED_CANCELED_STATES.includes(status)
}

const tooltip = {
Expand All @@ -53,6 +55,8 @@ const Wrapper = styled.div`

export type Props = SimpleTableProps & {
orders: Order[] | undefined
tableState: TableState
handleNextPage: Command
messageWhenEmpty?: string | React.ReactNode
}

Expand All @@ -68,23 +72,48 @@ interface RowProps {
const FilterRow = styled.tr`
background-color: ${({ theme }) => theme.background};

th {
@media (max-width: 1155px) {
div:first-child {
max-width: 90vw;
}
}

td {
padding: 2rem;
text-align: right;
padding-right: 10px;

max-width: 100%;
& > * {
margin-left: 10px;
}
}

p {
word-wrap: break-word;
white-space: normal;
}
`

const NoOrdersContainer = styled.div`
const Filters = styled.div`
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
flex-direction: column;
padding: 2rem;
flex-wrap: wrap;
flex-direction: row;
gap: 1rem;
`

const HiddenOrdersLegend = styled.div`
p {
text-align: center;
}

a {
text-decoration: underline;
}

a:hover {
color: ${({ theme }) => theme.textSecondary2};
}
`

const RowOrder: React.FC<RowProps> = ({ order, isPriceInverted, showCanceledAndExpired, showPreSigning }) => {
Expand Down Expand Up @@ -159,16 +188,19 @@ const RowOrder: React.FC<RowProps> = ({ order, isPriceInverted, showCanceledAndE
}

const OrdersUserDetailsTable: React.FC<Props> = (props) => {
const { orders, messageWhenEmpty } = props
const { orders, messageWhenEmpty, tableState, handleNextPage } = props
const [isPriceInverted, setIsPriceInverted] = useState(false)
const [showCanceledAndExpired, setShowCanceledAndExpired] = useState(false)
const [showPreSigning, setShowPreSigning] = useState(false)

const canceledAndExpiredCount = orders?.filter(isExpiredOrCanceled).length || 0
const preSigningCount = orders?.filter((order) => order.status === 'signing').length || 0
const showFilter = canceledAndExpiredCount > 0 || preSigningCount > 0
const areOrdersAllHidden =
orders?.length === (showPreSigning ? 0 : preSigningCount) + (showCanceledAndExpired ? 0 : canceledAndExpiredCount)

const hiddenOrdersCount =
(showPreSigning ? 0 : preSigningCount) + (showCanceledAndExpired ? 0 : canceledAndExpiredCount)

const areOrdersAllHidden = orders?.length === hiddenOrdersCount

const invertLimitPrice = (): void => {
setIsPriceInverted((previousValue) => !previousValue)
Expand All @@ -182,31 +214,6 @@ const OrdersUserDetailsTable: React.FC<Props> = (props) => {
<SimpleTable
header={
<>
{showFilter && (
<FilterRow>
<th colSpan={8}>
{canceledAndExpiredCount > 0 && (
<ToggleFilter
checked={showCanceledAndExpired}
onChange={() => setShowCanceledAndExpired((previousValue) => !previousValue)}
label={(showCanceledAndExpired ? 'Hide' : 'Show') + ' canceled/expired'}
count={canceledAndExpiredCount}
/>
)}
{preSigningCount > 0 && (
<>
<ToggleFilter
checked={showPreSigning}
onChange={() => setShowPreSigning((previousValue) => !previousValue)}
label={(showPreSigning ? 'Hide' : 'Show') + ' unsigned'}
count={preSigningCount}
/>
{showPreSigning && <UnsignedOrderWarning />}
</>
)}
</th>
</FilterRow>
)}
{!areOrdersAllHidden && (
<tr>
<th>
Expand All @@ -227,11 +234,20 @@ const OrdersUserDetailsTable: React.FC<Props> = (props) => {
<th>Status</th>
</tr>
)}
{showPreSigning && (
<FilterRow>
<td colSpan={8}>
<div>
<UnsignedOrderWarning />
</div>
</td>
</FilterRow>
)}
</>
}
body={
<>
{!areOrdersAllHidden ? (
{!areOrdersAllHidden &&
orders.map((item) => (
<RowOrder
key={item.uid}
Expand All @@ -240,12 +256,57 @@ const OrdersUserDetailsTable: React.FC<Props> = (props) => {
showCanceledAndExpired={showCanceledAndExpired}
showPreSigning={showPreSigning}
/>
))
) : (
<NoOrdersContainer>
<p>No orders found.</p>
<p>You can toggle the filters to show the {orders.length} hidden orders.</p>
</NoOrdersContainer>
))}

{showFilter && (
<FilterRow>
<td colSpan={8}>
<div>
<HiddenOrdersLegend>
{hiddenOrdersCount > 0 ? (
<>
<p>
Showing {orders.length - hiddenOrdersCount} out of {orders.length} orders for the current
page.
</p>
<p>
{hiddenOrdersCount} orders are hidden, you can make them visible using the filters below
{tableState.hasNextPage ? (
<span>
, or go to&nbsp;<a onClick={handleNextPage}>next page</a>&nbsp;for more orders.
</span>
) : (
'.'
)}
</p>
</>
) : (
<p>Showing all {orders.length} orders for the current page.</p>
)}
</HiddenOrdersLegend>
<Filters>
{canceledAndExpiredCount > 0 && (
<ToggleFilter
checked={showCanceledAndExpired}
onChange={() => setShowCanceledAndExpired((previousValue) => !previousValue)}
label={(showCanceledAndExpired ? 'Hide' : 'Show') + ' canceled/expired'}
count={canceledAndExpiredCount}
/>
)}
{preSigningCount > 0 && (
<>
<ToggleFilter
checked={showPreSigning}
onChange={() => setShowPreSigning((previousValue) => !previousValue)}
label={(showPreSigning ? 'Hide' : 'Show') + ' unsigned'}
count={preSigningCount}
/>
</>
)}
</Filters>
</div>
</td>
</FilterRow>
)}
</>
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ export const OrdersTableWithData: React.FC = () => {
const {
data: orders,
addressAccountParams: { ownerAddress, networkId },
tableState,
handleNextPage,
} = useContext(OrdersTableContext)
const isFirstRender = useFirstRender()
const [isFirstLoading, setIsFirstLoading] = useState(true)
Expand Down Expand Up @@ -46,6 +48,8 @@ export const OrdersTableWithData: React.FC = () => {
) : (
<OrdersTable
orders={orders}
tableState={tableState}
handleNextPage={handleNextPage}
messageWhenEmpty={
<EmptyOrdersMessage
isLoading={searchInAnotherNetworkState}
Expand Down
Loading
Loading