-
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: warn about unsigned orders, and hide not relevant orders (#5214)
* feat: create a warning banner for unsigned orders * feat: add a toggle filter * feat: filter in the client side for canceled/expired orders * feat: show warning * feat: style the no orders container * fix: fix lint * chore: delete debug line * fix: show partially fillable orders * chore: simplify Co-authored-by: Leandro <[email protected]> --------- Co-authored-by: Leandro <[email protected]>
- Loading branch information
1 parent
83667f9
commit 0d19616
Showing
4 changed files
with
191 additions
and
24 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
38 changes: 38 additions & 0 deletions
38
apps/explorer/src/components/orders/OrdersUserDetailsTable/ToggleFilter.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,38 @@ | ||
import React from 'react' | ||
|
||
import styled from 'styled-components/macro' | ||
|
||
interface BadgeProps { | ||
checked: boolean | ||
onChange: () => void | ||
label: string | ||
count: number | ||
} | ||
|
||
const Wrapper = styled.div<{ checked: boolean }>` | ||
display: inline-block; | ||
padding: 5px 10px; | ||
border-radius: 20px; | ||
background-color: ${({ checked }) => (checked ? '#007bff' : '#e0e0e0')}; | ||
color: ${({ checked }) => (checked ? '#fff' : '#000')}; | ||
cursor: pointer; | ||
user-select: none; | ||
font-size: 11px; | ||
` | ||
|
||
const Label = styled.span` | ||
margin-right: 10px; | ||
` | ||
|
||
const Count = styled.span` | ||
font-weight: bold; | ||
` | ||
|
||
export const ToggleFilter: React.FC<BadgeProps> = ({ checked, onChange, label, count }) => { | ||
return ( | ||
<Wrapper checked={checked} onClick={onChange}> | ||
<Label>{label}</Label> | ||
<Count>{count}</Count> | ||
</Wrapper> | ||
) | ||
} |
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
15 changes: 15 additions & 0 deletions
15
apps/explorer/src/components/orders/UnsignedOrderWarning/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,15 @@ | ||
import { BannerOrientation, InlineBanner } from '@cowprotocol/ui' | ||
|
||
import styled from 'styled-components/macro' | ||
|
||
const StyledInlineBanner = styled(InlineBanner)` | ||
--cow-color-danger-text: ${({ theme }): string => theme.alert2}; | ||
` | ||
|
||
export const UnsignedOrderWarning: React.FC = () => { | ||
return ( | ||
<StyledInlineBanner orientation={BannerOrientation.Horizontal} bannerType="danger" padding="0"> | ||
An unsigned order is not necessarily placed by the owner's account. Please be cautious. | ||
</StyledInlineBanner> | ||
) | ||
} |