diff --git a/src/App.tsx b/src/App.tsx index 6672603f..ee293338 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,3 +1,4 @@ +import { Suspense } from 'react'; import { BrowserRouter } from 'react-router-dom'; import { QueryParamProvider } from 'use-query-params'; import { ReactRouter5Adapter } from 'use-query-params/adapters/react-router-5'; @@ -5,7 +6,7 @@ import { AppFooter, AppHeader, DerivIframe } from '@/components'; import { useRedirectToOauth } from '@/hooks'; import AppContent from '@/routes/AppContent'; import { initializeI18n, TranslationProvider } from '@deriv-com/translations'; -import { useDevice } from '@deriv-com/ui'; +import { Loader, useDevice } from '@deriv-com/ui'; const { VITE_CROWDIN_BRANCH_NAME, VITE_PROJECT_NAME, VITE_TRANSLATIONS_CDN_URL } = import.meta.env; const i18nInstance = initializeI18n({ @@ -22,10 +23,12 @@ const App = () => { - - - - {isDesktop && } + }> + + + + {isDesktop && } + diff --git a/src/components/PaymentMethodForm/PaymentMethodForm.scss b/src/components/PaymentMethodForm/PaymentMethodForm.scss index a98fa4f7..b19e2ef6 100644 --- a/src/components/PaymentMethodForm/PaymentMethodForm.scss +++ b/src/components/PaymentMethodForm/PaymentMethodForm.scss @@ -143,6 +143,11 @@ & .deriv-input__right-content { display: flex; align-items: center; + & .deriv-dropdown__button { + &--active { + transform: none; + } + } } } } diff --git a/src/hooks/custom-hooks/useSendbird.ts b/src/hooks/custom-hooks/useSendbird.ts index 8ba7135f..617803e8 100644 --- a/src/hooks/custom-hooks/useSendbird.ts +++ b/src/hooks/custom-hooks/useSendbird.ts @@ -272,15 +272,16 @@ const useSendbird = (orderId: string | undefined, isErrorOrderInfo: boolean, cha useEffect(() => { // if the user has not created a chat URL for the order yet, create one using p2p_create_chat endpoint - if (orderId && !chatChannelUrl) { + // chatChannelUrl is received from order details, hence check if chat url was already created using p2p_create_chat + if (!chatChannel?.url && sendbirdServiceToken?.app_id && orderId) { + initialiseChat(); + } else if (orderId && !chatChannelUrl && !chatChannel?.url) { createChat({ order_id: orderId, }); - } else if (sendbirdServiceToken?.app_id) { - initialiseChat(); } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [orderId, chatChannelUrl, sendbirdServiceToken?.app_id]); + }, [orderId, chatChannelUrl, chatChannel?.url, sendbirdServiceToken?.app_id]); return { activeChatChannel: chatChannel, diff --git a/src/pages/orders/components/ChatMessageReceipt/ChatMessageReceipt.tsx b/src/pages/orders/components/ChatMessageReceipt/ChatMessageReceipt.tsx index ebdda9d6..f9686207 100644 --- a/src/pages/orders/components/ChatMessageReceipt/ChatMessageReceipt.tsx +++ b/src/pages/orders/components/ChatMessageReceipt/ChatMessageReceipt.tsx @@ -1,4 +1,4 @@ -import { ComponentType, SVGAttributes } from 'react'; +import { ComponentType, memo, SVGAttributes } from 'react'; import { CHAT_MESSAGE_STATUS } from '@/constants'; import { useSendbird } from '@/hooks/custom-hooks'; import { ReactComponent as MessageDeliveredIcon } from '../../../../public/ic-message-delivered.svg'; @@ -37,4 +37,4 @@ const ChatMessageReceipt = ({ chatChannel, message, userId }: TChatMessageReceip return ; }; -export default ChatMessageReceipt; +export default memo(ChatMessageReceipt); diff --git a/src/pages/orders/components/ChatMessages/ChatMessages.scss b/src/pages/orders/components/ChatMessages/ChatMessages.scss index 28ea7af5..e54254d1 100644 --- a/src/pages/orders/components/ChatMessages/ChatMessages.scss +++ b/src/pages/orders/components/ChatMessages/ChatMessages.scss @@ -2,7 +2,9 @@ background-color: #ffffff; margin-top: auto; margin-right: 0.8rem; - height: calc(60vh - 16rem); + display: flex; + flex-direction: column; + flex-grow: 1; overflow-y: auto; @include mobile { @@ -15,7 +17,11 @@ &__item { display: flex; flex-direction: column; - margin: 1.6rem 1.2rem 1.6rem 2.4rem; + margin: 1.6rem 1.2rem 0 2.4rem; + + &:last-child { + margin-bottom: 1.6rem; + } &__file { color: inherit; diff --git a/src/pages/orders/screens/OrderDetails/OrderDetails.scss b/src/pages/orders/screens/OrderDetails/OrderDetails.scss index f4cdcde4..1f265390 100644 --- a/src/pages/orders/screens/OrderDetails/OrderDetails.scss +++ b/src/pages/orders/screens/OrderDetails/OrderDetails.scss @@ -1,6 +1,6 @@ .order-details { overflow: overlay; - height: calc(100vh - 22rem); + height: calc(100vh - 27rem); @include mobile { position: absolute; diff --git a/src/pages/orders/screens/OrderDetails/OrderDetails.tsx b/src/pages/orders/screens/OrderDetails/OrderDetails.tsx index 3d694f15..e48e4cd0 100644 --- a/src/pages/orders/screens/OrderDetails/OrderDetails.tsx +++ b/src/pages/orders/screens/OrderDetails/OrderDetails.tsx @@ -140,7 +140,7 @@ const OrderDetails = () => { {warningMessage} )} -
+
({ }, }), useSendbird: () => ({ + activeChatChannel: { + isFrozen: false, + }, isOnline: true, lastOnlineTime: 123546789, nickname: 'John Doe', diff --git a/src/pages/orders/screens/Orders/OrdersTable/OrdersTable.scss b/src/pages/orders/screens/Orders/OrdersTable/OrdersTable.scss index 1536edd0..fe9d910c 100644 --- a/src/pages/orders/screens/Orders/OrdersTable/OrdersTable.scss +++ b/src/pages/orders/screens/Orders/OrdersTable/OrdersTable.scss @@ -8,7 +8,7 @@ height: calc(100vh - 35rem) !important; @include mobile { - height: calc(100vh - 17rem) !important; + height: calc(100vh - 20rem) !important; } &__row { diff --git a/src/pages/orders/screens/Orders/OrdersTableRow/OrdersTableRow.scss b/src/pages/orders/screens/Orders/OrdersTableRow/OrdersTableRow.scss index e9d6d4e9..9125482a 100644 --- a/src/pages/orders/screens/Orders/OrdersTableRow/OrdersTableRow.scss +++ b/src/pages/orders/screens/Orders/OrdersTableRow/OrdersTableRow.scss @@ -5,6 +5,7 @@ align-items: center; grid-template-columns: 1fr 1.5fr 2fr 3fr 1.5fr 1.5fr 1.5fr; cursor: pointer; + min-height: 7.3rem; } @include mobile { diff --git a/src/pages/orders/screens/OrdersChatSection/OrdersChatSection.scss b/src/pages/orders/screens/OrdersChatSection/OrdersChatSection.scss index 00c2464d..34920557 100644 --- a/src/pages/orders/screens/OrdersChatSection/OrdersChatSection.scss +++ b/src/pages/orders/screens/OrdersChatSection/OrdersChatSection.scss @@ -2,6 +2,12 @@ border-radius: 4px; border: 8px solid #f2f3f4; width: 44rem; + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + min-height: 60vh; + height: 100%; @include mobile { width: unset; @@ -29,7 +35,7 @@ } &--closed { - height: calc(100vh - 2rem); + height: calc(100vh - 5rem); & .mobile-wrapper { &__footer { diff --git a/src/pages/orders/screens/OrdersChatSection/OrdersChatSection.tsx b/src/pages/orders/screens/OrdersChatSection/OrdersChatSection.tsx index 0b5ceece..050cdbf3 100644 --- a/src/pages/orders/screens/OrdersChatSection/OrdersChatSection.tsx +++ b/src/pages/orders/screens/OrdersChatSection/OrdersChatSection.tsx @@ -29,7 +29,7 @@ const OrdersChatSection = ({ isInactive, onReturn, otherUserDetails, ...sendBird if (isError) { return ( -
+
); @@ -48,7 +48,7 @@ const OrdersChatSection = ({ isInactive, onReturn, otherUserDetails, ...sendBird )} renderHeader={() => } > - {isChatLoading ? ( + {isChatLoading || !activeChatChannel ? ( ) : ( @@ -57,8 +57,8 @@ const OrdersChatSection = ({ isInactive, onReturn, otherUserDetails, ...sendBird ); } return ( -
- {isChatLoading ? ( +
+ {isChatLoading || !activeChatChannel ? ( ) : ( <>