forked from deriv-com/deriv-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEQ] / Ameerul / FEQ-1713 Create the order details section (deriv-co…
…m#14236) * chore: added OrderDetails, Header, Info components * chore: added PaymentMethodAccordion component * chore: updated styles for PaymentMethodAccordion * chore: added routing and functionality for order details * chore: added review/rating block * chore: added responsive view * chore: fixed footer styles and added key in ActiveOrderInfo * fix: routing issues from BuySellForm to orderDetails * chore: added TOrder type for p2p_order_info * chore: combined chat with order details, added orderDetails provider * chore: added useState to handle showing chat on responsive * chore: added test cases for OrderDetails related components * fix: review order not showing disabled prompt * chore: updated TODO * chore: added error handler, updated ui issues * fix: failing test cases * chore: added suggestions * fix: remove useOrderInfo from useSendbird, pass order info using provider * chore: moved OrderDetailsProvider to providers folder under src, added comments * chore: remove !important * chore: remove TOrders * chore: added comment explainining recommended * chore: empty commit * chore: separated component out for recommended status * chore: updated test case for recommended status * chore: empty commit * chore: added comment
- Loading branch information
1 parent
515cc24
commit 0c4900f
Showing
47 changed files
with
1,556 additions
and
52 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
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
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
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
10 changes: 7 additions & 3 deletions
10
packages/p2p-v2/src/components/PaymentMethodWithIcon/PaymentMethodWithIcon.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
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
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
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
14 changes: 14 additions & 0 deletions
14
packages/p2p-v2/src/pages/orders/components/OrderDetailsCard/OrderDetailsCard.scss
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,14 @@ | ||
.p2p-v2-order-details-card { | ||
display: flex; | ||
flex-direction: column; | ||
background-color: #fff; | ||
border: 8px solid #f2f3f4; | ||
border-radius: 8px; | ||
width: 45.6rem; | ||
height: fit-content; | ||
|
||
@include mobile { | ||
width: 100%; | ||
border: none; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
packages/p2p-v2/src/pages/orders/components/OrderDetailsCard/OrderDetailsCard.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,24 @@ | ||
import React from 'react'; | ||
import { Divider, useDevice } from '@deriv-com/ui'; | ||
import { OrderDetailsCardFooter } from './OrderDetailsCardFooter'; | ||
import { OrderDetailsCardHeader } from './OrderDetailsCardHeader'; | ||
import { OrderDetailsCardInfo } from './OrderDetailsCardInfo'; | ||
import { OrderDetailsCardReview } from './OrderDetailsCardReview'; | ||
import './OrderDetailsCard.scss'; | ||
|
||
const OrderDetailsCard = () => { | ||
const { isDesktop } = useDevice(); | ||
|
||
return ( | ||
<div className='p2p-v2-order-details-card'> | ||
<OrderDetailsCardHeader /> | ||
<Divider color='#f2f3f4' /> | ||
<OrderDetailsCardInfo /> | ||
<Divider color='#f2f3f4' /> | ||
<OrderDetailsCardReview /> | ||
{isDesktop && <OrderDetailsCardFooter />} | ||
</div> | ||
); | ||
}; | ||
|
||
export default OrderDetailsCard; |
8 changes: 8 additions & 0 deletions
8
...ges/orders/components/OrderDetailsCard/OrderDetailsCardFooter/OrderDetailsCardFooter.scss
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,8 @@ | ||
.p2p-v2-order-details-card-footer { | ||
display: flex; | ||
padding: 1.6rem; | ||
|
||
@include mobile { | ||
border-top: 2px solid #f2f3f4; | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
...ages/orders/components/OrderDetailsCard/OrderDetailsCardFooter/OrderDetailsCardFooter.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,63 @@ | ||
import React from 'react'; | ||
import { useOrderDetails } from '@/providers/OrderDetailsProvider'; | ||
import { Button, useDevice } from '@deriv-com/ui'; | ||
import './OrderDetailsCardFooter.scss'; | ||
|
||
// TODO: Implement functionality for each button when integrating with the API and disable buttons while chat is loading | ||
const OrderDetailsCardFooter = () => { | ||
const { orderDetails } = useOrderDetails(); | ||
const { | ||
shouldShowCancelAndPaidButton, | ||
shouldShowComplainAndReceivedButton, | ||
shouldShowOnlyComplainButton, | ||
shouldShowOnlyReceivedButton, | ||
} = orderDetails; | ||
const { isMobile } = useDevice(); | ||
const textSize = isMobile ? 'md' : 'sm'; | ||
|
||
if (shouldShowCancelAndPaidButton) | ||
return ( | ||
<div className='p2p-v2-order-details-card-footer justify-end gap-3'> | ||
<Button className='border-2' color='black' size='lg' textSize={textSize} variant='outlined'> | ||
Cancel order | ||
</Button> | ||
<Button size='lg' textSize={textSize}> | ||
I’ve paid | ||
</Button> | ||
</div> | ||
); | ||
|
||
if (shouldShowComplainAndReceivedButton) | ||
return ( | ||
<div className='p2p-v2-order-details-card-footer justify-between'> | ||
<Button className='border-2' color='primary-light' size='lg' textSize={textSize} variant='ghost'> | ||
Complain | ||
</Button> | ||
<Button size='lg' textSize={textSize}> | ||
I’ve received payment | ||
</Button> | ||
</div> | ||
); | ||
|
||
if (shouldShowOnlyComplainButton) | ||
return ( | ||
<div className='p2p-v2-order-details-card-footer justify-end'> | ||
<Button className='border-2' color='primary-light' size='lg' textSize={textSize} variant='ghost'> | ||
Complain | ||
</Button> | ||
</div> | ||
); | ||
|
||
if (shouldShowOnlyReceivedButton) | ||
return ( | ||
<div className='p2p-v2-order-details-card-footer justify-end'> | ||
<Button size='lg' textSize={textSize}> | ||
I’ve received payment | ||
</Button> | ||
</div> | ||
); | ||
|
||
return null; | ||
}; | ||
|
||
export default OrderDetailsCardFooter; |
Oops, something went wrong.