Skip to content

Commit

Permalink
Merge pull request #4201 from cowprotocol/release/2024.04.09
Browse files Browse the repository at this point in the history
Release/2024.04.09
anxolin authored Apr 11, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 769f98c + 2c03138 commit da005b1
Showing 208 changed files with 2,302 additions and 1,909 deletions.
13 changes: 7 additions & 6 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -2,20 +2,21 @@

<<if there's an issue>>Fixes #issueNumber

*High-level description of what your changes are accomplishing*
High-level description of what your changes are accomplishing

*Add screenshots if applicable. Images are nice :)*
Add screenshots if applicable. Images are nice :)

# To Test
# To Test

1. <<Step one>> Open the page `about`

- [ ] <<What to expect?>> Verify it contains about information...
- [ ] Checkbox Style list of things a QA person could verify, i.e.
- [ ] Should display Text Input our storybook
- [ ] Input should not accept Numbers
2. <<Step two>> ...

# Background
2. <<Step two>> ...

*Optional: Give background information for changes you've made, that might be difficult to explain via comments*
# Background

Optional: Give background information for changes you've made, that might be difficult to explain via comments
29 changes: 0 additions & 29 deletions .github/workflows/kanban-in-progress.yml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/kanban-review.yml

This file was deleted.

23 changes: 23 additions & 0 deletions apps/cowswap-frontend/index.html
Original file line number Diff line number Diff line change
@@ -102,6 +102,15 @@
flex-flow: column wrap;
}

#skeleton.skeleton-dark {
--colorBorder: rgb(236 241 248 / 15%);
--colorShimmerColor1: rgba(236, 241, 248, 0) 0;
--colorShimmerColor2: rgba(236, 241, 248, 0.1) 20%;
--colorShimmerColor3: rgba(255, 255, 255, 0.2) 50%;
--colorShimmerColor4: rgba(236, 241, 248, 0.1) 80%;
--colorShimmerColor5: rgba(236, 241, 248, 0) 100%;
}

@media (prefers-color-scheme: dark) {
#skeleton {
--colorBorder: rgb(236 241 248 / 15%);
@@ -200,6 +209,20 @@
</div>
</div>

<script>
(function(){
const search = window.location.hash ? window.location.hash.split('?')[1] : ''
const searchParams = new URLSearchParams(search)
const theme = searchParams.get('theme')

if (theme === 'dark') {
const skeleton = document.getElementById('skeleton')

if (skeleton) skeleton.classList.add('skeleton-dark')
}
})()
</script>

<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
Original file line number Diff line number Diff line change
@@ -2,41 +2,64 @@ import { useMemo } from 'react'

import { UiOrderType } from '@cowprotocol/types'

import { useRecentActivity } from 'legacy/hooks/useRecentActivity'
import { AddedOrder, TransactionAndOrder, useRecentActivity } from 'legacy/hooks/useRecentActivity'
import { useAllTransactions } from 'legacy/state/enhancedTransactions/hooks'
import { CREATING_STATES, Order, OrderStatus, PENDING_STATES } from 'legacy/state/orders/actions'

import { getIsFinalizedOrder } from 'utils/orderUtils/getIsFinalizedOrder'
import { getUiOrderType } from 'utils/orderUtils/getUiOrderType'

export const isPending = ({ status }: { status: OrderStatus }) => PENDING_STATES.includes(status)
export const isPending = ({ status, replacementType }: { status: OrderStatus; replacementType?: string }) => {
if (replacementType === 'replaced') return false

return PENDING_STATES.includes(status)
}

export const isCreating = ({ status }: { status: OrderStatus }) => CREATING_STATES.includes(status)

export function useCategorizeRecentActivity() {
// Returns all RECENT (last day) transaction and orders in 2 arrays: pending and confirmed
const allRecentActivity = useRecentActivity()
const allTransactions = useAllTransactions()

const [pendingActivity, confirmedActivity] = useMemo(
() =>
// Separate the array into 2: transitory (pending) and final (confirmed) states
allRecentActivity.reduce<[string[], string[]]>(
(acc, activity) => {
// Only display regular on-chain transactions (wrap, approval, etc) OR MARKET orders
if (!activity.class || getUiOrderType(activity as Order) === UiOrderType.SWAP) {
if (isPending(activity)) {
acc[0].push(activity.id)
} else if (getIsFinalizedOrder(activity)) {
acc[1].push(activity.id)
}
const [pendingActivity, confirmedActivity] = useMemo(() => {
// Separate the array into 2: transitory (pending) and final (confirmed) states
return allRecentActivity.reduce<[string[], string[]]>(
(acc, activity) => {
// Only display regular on-chain transactions (wrap, approval, etc) OR MARKET orders
if (!activity.class || getUiOrderType(activity as Order) === UiOrderType.SWAP) {
if (isEthFlowOrderNotCreated(allTransactions, activity)) {
acc[1].push(activity.id)
} else if (isPending(activity)) {
acc[0].push(activity.id)
} else if (getIsFinalizedOrder(activity)) {
acc[1].push(activity.id)
}
return acc
},
[[], []]
),

// Reducing unnecessary re-renders
// eslint-disable-next-line react-hooks/exhaustive-deps
[JSON.stringify(allRecentActivity)]
)
}
return acc
},
[[], []]
)
}, [allRecentActivity, allTransactions])
return { pendingActivity, confirmedActivity }
}

function isEthFlowOrderNotCreated(
transactions: ReturnType<typeof useAllTransactions>,
activity: TransactionAndOrder
): boolean {
const order = activity as AddedOrder

if (!order?.orderCreationHash) return false

const orderCreationTx = transactions[order.orderCreationHash]
const orderCreationLinkedTx = orderCreationTx?.linkedTransactionHash
? transactions[orderCreationTx.linkedTransactionHash]
: undefined

if (orderCreationLinkedTx) {
return orderCreationLinkedTx.replacementType === 'replaced' || orderCreationLinkedTx.replacementType === 'cancel'
}

return false
}
8 changes: 4 additions & 4 deletions apps/cowswap-frontend/src/common/pure/RateInfo/index.tsx
Original file line number Diff line number Diff line change
@@ -2,8 +2,7 @@ import React, { Dispatch, SetStateAction, useEffect, useMemo, useState } from 'r

import { getAddress } from '@cowprotocol/common-utils'
import { SupportedChainId } from '@cowprotocol/cow-sdk'
import { FiatAmount, TokenAmount, TokenSymbol } from '@cowprotocol/ui'
import { UI } from '@cowprotocol/ui'
import { FiatAmount, TokenAmount, TokenSymbol, UI } from '@cowprotocol/ui'
import { Currency, CurrencyAmount } from '@uniswap/sdk-core'

import { Trans } from '@lingui/macro'
@@ -134,6 +133,7 @@ export const FiatRate = styled.span`
opacity: 0.7;
font-weight: 400;
text-align: right;
white-space: nowrap;
`

export function InvertRateControl({ onClick, className }: { onClick(): void; className?: string }) {
@@ -232,8 +232,8 @@ export function RateInfo({
<span
title={
currentActiveRate.toFixed(rateOutputCurrency.decimals || DEFAULT_DECIMALS) +
' ' +
rateOutputCurrency.symbol || ''
' ' +
rateOutputCurrency.symbol || ''
}
>
{prependSymbol && (
Original file line number Diff line number Diff line change
@@ -40,6 +40,7 @@ const Summary = styled.div`
span {
font-size: inherit;
font-weight: inherit;
white-space: nowrap;
}
`

Original file line number Diff line number Diff line change
@@ -65,7 +65,10 @@ export function CancelReplaceTxUpdater(): null {
const { chainId, account } = useWalletInfo()
const dispatch = useAppDispatch()
const accountLowerCase = account?.toLowerCase() || ''
const pendingHashes = useAllTransactionHashes((tx) => !tx.receipt && tx.from.toLowerCase() === accountLowerCase)
const pendingHashes = useAllTransactionHashes(
(tx) =>
!tx.receipt && !tx.replacementType && !tx.linkedTransactionHash && tx.from.toLowerCase() === accountLowerCase
)

useEffect(() => {
if (!chainId || !provider) return
78 changes: 0 additions & 78 deletions apps/cowswap-frontend/src/common/updaters/LogsUpdater.ts

This file was deleted.

Loading

0 comments on commit da005b1

Please sign in to comment.