Skip to content
This repository has been archived by the owner on Jun 24, 2022. It is now read-only.

Price out of market message iteration. #1320

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
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
Prev Previous commit
Next Next commit
Alert message iteration.
  • Loading branch information
biocom committed Aug 26, 2021
commit 3fd583e1cda344fb31cf08f18cf1619fa8944172
42 changes: 25 additions & 17 deletions src/custom/components/AccountDetails/Transaction/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ function ActivitySummary(params: {
activityData: ReturnType<typeof useActivityDescriptors>
isCancelled?: boolean
isExpired?: boolean
isUnfillable?: boolean
}) {
const { id, activityData, isCancelled, isExpired } = params
const { id, activityData, isCancelled, isExpired, isUnfillable } = params

if (!activityData) return null

Expand Down Expand Up @@ -185,6 +186,7 @@ function ActivitySummary(params: {
</>
)}
</SummaryInnerRow>
{!isUnfillable && unfillableAlert()}
<SummaryInnerRow isCancelled={isCancelled} isExpired={isExpired}>
{fulfillmentTime ? (
<>
Expand Down Expand Up @@ -302,6 +304,21 @@ function CancellationModal(props: CancellationModalProps): JSX.Element | null {
)
}

function unfillableAlert(): JSX.Element {
return (
<>
<TransactionAlertMessage>
<p>
<span role="img" aria-label="alert">
🚨
</span>{' '}
Limit price out of range. Wait for a matching price or cancel your order.
</p>
</TransactionAlertMessage>
</>
)
}

export default function Transaction({ hash: id }: { hash: string }) {
const { chainId } = useActiveWeb3React()
// Return info necessary for rendering order/transaction info from the incoming id
Expand Down Expand Up @@ -352,7 +369,13 @@ export default function Transaction({ hash: id }: { hash: string }) {
</IconType>
)}
<TransactionStatusText>
<ActivitySummary activityData={activityData} id={id} isCancelled={isCancelled} isExpired={isExpired} />
<ActivitySummary
activityData={activityData}
id={id}
isCancelled={isCancelled}
isExpired={isExpired}
isUnfillable={isUnfillable}
/>
</TransactionStatusText>
</RowFixed>
</TransactionState>
Expand Down Expand Up @@ -398,21 +421,6 @@ export default function Transaction({ hash: id }: { hash: string }) {
)}
</StatusLabelWrapper>
</TransactionWrapper>

{isUnfillable && (
<TransactionAlertMessage>
<p>
<span role="img" aria-label="alert">
🚨
</span>{' '}
Price out of range.{' '}
<a href="#/faq" target="_blank" rel="noopener ">
Read more
</a>
.
</p>
</TransactionAlertMessage>
)}
</Wrapper>
)
}
20 changes: 15 additions & 5 deletions src/custom/components/AccountDetails/Transaction/styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,19 +282,29 @@ export const CancellationSummary = styled.span`
export const TransactionAlertMessage = styled.div`
width: 100%;
padding: 0;
background: ${({ theme }) => theme.yellow};
color: black;
font-size: 13px;
color: ${({ theme }) => theme.text2};
display: flex;
justify-content: center;
margin: 0;
font-size: 12px;

> p {
margin: 6px 20px 6px 0;
padding: 10px;
margin: 0;
margin: 0 auto;
border-radius: 6px;
display: flex;
align-items: center;
line-height: 1.4;
background: ${({ theme }) => theme.yellow};
width: 100%;
height: 100%;
}

> p > a {
color: ${({ theme }) => theme.primary1};
}

> p > span {
margin: 0 6px 0 0;
}
`