From a8dfff1887fa0894e43ed4feda2b789c18600483 Mon Sep 17 00:00:00 2001 From: viet-nv Date: Thu, 11 Jan 2024 15:20:14 +0700 Subject: [PATCH 1/5] feat: add lo revert notification --- .../Announcement/PrivateAnnoucement/InboxItemLO.tsx | 1 + src/constants/env.ts | 4 ++-- src/pages/NotificationCenter/PrivateAnnouncement.tsx | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/Announcement/PrivateAnnoucement/InboxItemLO.tsx b/src/components/Announcement/PrivateAnnoucement/InboxItemLO.tsx index 853f48254c..737c4286df 100644 --- a/src/components/Announcement/PrivateAnnoucement/InboxItemLO.tsx +++ b/src/components/Announcement/PrivateAnnoucement/InboxItemLO.tsx @@ -44,6 +44,7 @@ function InboxItemBridge({ takingAmountRate, chainId: rawChainId, } = templateBody?.order || {} + const isFilled = status === LimitOrderStatus.FILLED const isPartialFilled = status === LimitOrderStatus.PARTIALLY_FILLED const chainId = rawChainId && rawChainId !== '{{.chainId}}' ? (Number(rawChainId) as ChainId) : undefined diff --git a/src/constants/env.ts b/src/constants/env.ts index abde3ec43e..2158a67363 100644 --- a/src/constants/env.ts +++ b/src/constants/env.ts @@ -124,12 +124,12 @@ const ANNOUNCEMENT_TEMPLATE_IDS: { [key in EnvKeys]: TemplateConfig } = { }, staging: { [PrivateAnnouncementType.PRICE_ALERT]: '30', - [PrivateAnnouncementType.LIMIT_ORDER]: '14,15,16,17', + [PrivateAnnouncementType.LIMIT_ORDER]: '14,15,16,17,31', [PrivateAnnouncementType.BRIDGE_ASSET]: '12,13', [PrivateAnnouncementType.CROSS_CHAIN]: '25,26', [PrivateAnnouncementType.ELASTIC_POOLS]: '20,21', [PrivateAnnouncementType.DIRECT_MESSAGE]: '', - EXCLUDE: '2,11,1,28,29,22,23', + EXCLUDE: '2,11,1,28,29,22,23,27', }, production: { [PrivateAnnouncementType.PRICE_ALERT]: '29', diff --git a/src/pages/NotificationCenter/PrivateAnnouncement.tsx b/src/pages/NotificationCenter/PrivateAnnouncement.tsx index f05816e153..ff528fd835 100644 --- a/src/pages/NotificationCenter/PrivateAnnouncement.tsx +++ b/src/pages/NotificationCenter/PrivateAnnouncement.tsx @@ -46,6 +46,7 @@ export default function GeneralAnnouncement({ type }: { type?: PrivateAnnounceme isLoading: isLoadingAll, } = useGetPrivateAnnouncementsQuery({ page, pageSize: ITEMS_PER_PAGE }, { skip: !!templateIds }) + console.log(type, respNotificationByType, dataAllNotification) const [ackAnnouncement] = useAckPrivateAnnouncementsByIdsMutation() const [clearAllAnnouncement] = useClearAllPrivateAnnouncementByIdMutation() From d9adc64e4a6d34b366a16aa9f8285ed836699b71 Mon Sep 17 00:00:00 2001 From: viet-nv Date: Mon, 15 Jan 2024 13:52:47 +0700 Subject: [PATCH 2/5] feat(lo): add revert type notification --- .../Announcement/PrivateAnnoucement/InboxItemLO.tsx | 8 ++++++-- .../NotificationCenter/LimitOrder.tsx | 10 ++++++++-- src/components/Announcement/type.ts | 1 + src/pages/NotificationCenter/PrivateAnnouncement.tsx | 1 - 4 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/components/Announcement/PrivateAnnoucement/InboxItemLO.tsx b/src/components/Announcement/PrivateAnnoucement/InboxItemLO.tsx index 737c4286df..9ebbe3c94d 100644 --- a/src/components/Announcement/PrivateAnnoucement/InboxItemLO.tsx +++ b/src/components/Announcement/PrivateAnnoucement/InboxItemLO.tsx @@ -18,6 +18,7 @@ import { CheckCircle } from 'components/Icons' import DeltaTokenAmount from 'components/WalletPopup/Transactions/DeltaTokenAmount' import { LimitOrderStatus } from 'components/swapv2/LimitOrder/type' import { APP_PATHS } from 'constants/index' +import { NETWORKS_INFO } from 'constants/networks' import useTheme from 'hooks/useTheme' function InboxItemBridge({ @@ -44,11 +45,14 @@ function InboxItemBridge({ takingAmountRate, chainId: rawChainId, } = templateBody?.order || {} + const isReorg = templateBody.isReorg const isFilled = status === LimitOrderStatus.FILLED const isPartialFilled = status === LimitOrderStatus.PARTIALLY_FILLED const chainId = rawChainId && rawChainId !== '{{.chainId}}' ? (Number(rawChainId) as ChainId) : undefined - const statusMessage = isFilled + const statusMessage = isReorg + ? t`Reverted` + : isFilled ? t`100% Filled` : isPartialFilled ? t`${filledPercent} Filled ${increasedFilledPercent}` @@ -56,7 +60,7 @@ function InboxItemBridge({ const navigate = useNavigate() const onClick = () => { - navigate(APP_PATHS.LIMIT) + navigate(`${APP_PATHS.LIMIT}/${NETWORKS_INFO[+templateBody.order.chainId as ChainId]?.route}`) onRead(announcement, statusMessage) } diff --git a/src/components/Announcement/PrivateAnnoucement/NotificationCenter/LimitOrder.tsx b/src/components/Announcement/PrivateAnnoucement/NotificationCenter/LimitOrder.tsx index b46b03ccb0..5a9b59807d 100644 --- a/src/components/Announcement/PrivateAnnoucement/NotificationCenter/LimitOrder.tsx +++ b/src/components/Announcement/PrivateAnnoucement/NotificationCenter/LimitOrder.tsx @@ -9,6 +9,7 @@ import { AnnouncementTemplateLimitOrder } from 'components/Announcement/type' import Logo from 'components/Logo' import { LimitOrderStatus } from 'components/swapv2/LimitOrder/type' import { APP_PATHS } from 'constants/index' +import { NETWORKS_INFO } from 'constants/networks' import useTheme from 'hooks/useTheme' import { formatTime } from 'utils/time' @@ -36,12 +37,17 @@ export default function AnnouncementItem({ chainId: rawChainId, takerAssetLogoURL, } = templateBody?.order || {} + const isReorg = templateBody.isReorg const isFilled = status === LimitOrderStatus.FILLED const isPartialFilled = status === LimitOrderStatus.PARTIALLY_FILLED const chainId = rawChainId && rawChainId !== '{{.chainId}}' ? (Number(rawChainId) as ChainId) : undefined const theme = useTheme() - const statusMessage = isFilled ? ( + const statusMessage = isReorg ? ( + + reverted ({filledPercent} filled) + + ) : isFilled ? ( successfully filled @@ -57,7 +63,7 @@ export default function AnnouncementItem({ const navigate = useNavigate() return ( - navigate(APP_PATHS.LIMIT)}> + navigate(`${APP_PATHS.LIMIT}/${NETWORKS_INFO[chainId || ChainId.MAINNET].route}`)}> <InboxIcon type={templateType} chainId={chainId} /> diff --git a/src/components/Announcement/type.ts b/src/components/Announcement/type.ts index aaeabef73b..ef631ffa3d 100644 --- a/src/components/Announcement/type.ts +++ b/src/components/Announcement/type.ts @@ -67,6 +67,7 @@ type PoolPositionAnnouncement = { export type AnnouncementTemplateLimitOrder = { order: LimitOrderAnnouncement popupType: PopupType + isReorg: boolean } export type AnnouncementTemplateCrossChain = { transaction: CrossChainTransfer; popupType: PopupType } export type AnnouncementTemplateBridge = { transaction: MultichainTransfer; popupType: PopupType } diff --git a/src/pages/NotificationCenter/PrivateAnnouncement.tsx b/src/pages/NotificationCenter/PrivateAnnouncement.tsx index ff528fd835..f05816e153 100644 --- a/src/pages/NotificationCenter/PrivateAnnouncement.tsx +++ b/src/pages/NotificationCenter/PrivateAnnouncement.tsx @@ -46,7 +46,6 @@ export default function GeneralAnnouncement({ type }: { type?: PrivateAnnounceme isLoading: isLoadingAll, } = useGetPrivateAnnouncementsQuery({ page, pageSize: ITEMS_PER_PAGE }, { skip: !!templateIds }) - console.log(type, respNotificationByType, dataAllNotification) const [ackAnnouncement] = useAckPrivateAnnouncementsByIdsMutation() const [clearAllAnnouncement] = useClearAllPrivateAnnouncementByIdMutation() From 5dedaaa1f0e54476381c5ed28970badc8d744135 Mon Sep 17 00:00:00 2001 From: viet-nv <vietnv1304@gmail.com> Date: Mon, 15 Jan 2024 16:47:55 +0700 Subject: [PATCH 3/5] test stg --- .github/workflows/pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 2c6ed536fc..795a6814b0 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -114,7 +114,7 @@ jobs: VITE_TAG: ${{ needs.prepare.outputs.image_tag }} CURRENT_BRANCH: ${{ needs.prepare.outputs.current_branch }} NODE_OPTIONS: '--max_old_space_size=4096' - run: yarn build + run: yarn build-stg - name: Docker build and push uses: docker/build-push-action@v2 From e5adfd52ca6b6d12015ea67b1c26e2115bf54fad Mon Sep 17 00:00:00 2001 From: viet-nv <vietnv1304@gmail.com> Date: Mon, 15 Jan 2024 16:47:55 +0700 Subject: [PATCH 4/5] test stg --- .github/workflows/pr.yaml | 2 +- .../Announcement/PrivateAnnoucement/InboxItemLO.tsx | 10 ++++++---- .../NotificationCenter/LimitOrder.tsx | 3 ++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 2c6ed536fc..795a6814b0 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -114,7 +114,7 @@ jobs: VITE_TAG: ${{ needs.prepare.outputs.image_tag }} CURRENT_BRANCH: ${{ needs.prepare.outputs.current_branch }} NODE_OPTIONS: '--max_old_space_size=4096' - run: yarn build + run: yarn build-stg - name: Docker build and push uses: docker/build-push-action@v2 diff --git a/src/components/Announcement/PrivateAnnoucement/InboxItemLO.tsx b/src/components/Announcement/PrivateAnnoucement/InboxItemLO.tsx index 9ebbe3c94d..b6fb73fcac 100644 --- a/src/components/Announcement/PrivateAnnoucement/InboxItemLO.tsx +++ b/src/components/Announcement/PrivateAnnoucement/InboxItemLO.tsx @@ -1,6 +1,6 @@ import { ChainId } from '@kyberswap/ks-sdk-core' import { t } from '@lingui/macro' -import { Repeat } from 'react-feather' +import { Repeat, XCircle } from 'react-feather' import { useNavigate } from 'react-router-dom' import { PrivateAnnouncementProp } from 'components/Announcement/PrivateAnnoucement' @@ -51,7 +51,7 @@ function InboxItemBridge({ const isPartialFilled = status === LimitOrderStatus.PARTIALLY_FILLED const chainId = rawChainId && rawChainId !== '{{.chainId}}' ? (Number(rawChainId) as ChainId) : undefined const statusMessage = isReorg - ? t`Reverted` + ? t`Reverted (${increasedFilledPercent})` : isFilled ? t`100% Filled` : isPartialFilled @@ -73,11 +73,13 @@ function InboxItemBridge({ {!isRead && <Dot />} </RowItem> <RowItem> - <PrimaryText>{statusMessage}</PrimaryText> + <PrimaryText color={isReorg ? theme.red : undefined}>{statusMessage}</PrimaryText> {isFilled ? ( <CheckCircle color={theme.primary} /> ) : isPartialFilled ? ( <Repeat color={theme.warning} size={12} /> + ) : isReorg ? ( + <XCircle color={theme.red} size={12} /> ) : ( <CheckCircle color={theme.warning} /> )} @@ -92,7 +94,7 @@ function InboxItemBridge({ logoURL={takerAssetLogoURL} /> <PrimaryText> - {takingAmountRate} {makerAssetSymbol}/{takerAssetSymbol} + {takingAmountRate} {takerAssetSymbol}/{makerAssetSymbol} </PrimaryText> </InboxItemRow> diff --git a/src/components/Announcement/PrivateAnnoucement/NotificationCenter/LimitOrder.tsx b/src/components/Announcement/PrivateAnnoucement/NotificationCenter/LimitOrder.tsx index 5a9b59807d..3c6486882e 100644 --- a/src/components/Announcement/PrivateAnnoucement/NotificationCenter/LimitOrder.tsx +++ b/src/components/Announcement/PrivateAnnoucement/NotificationCenter/LimitOrder.tsx @@ -34,6 +34,7 @@ export default function AnnouncementItem({ takingAmount, takingAmountRate, filledPercent, + increasedFilledPercent, chainId: rawChainId, takerAssetLogoURL, } = templateBody?.order || {} @@ -45,7 +46,7 @@ export default function AnnouncementItem({ const statusMessage = isReorg ? ( <Text as="span" color={theme.red}> - reverted ({filledPercent} filled) + reverted ({increasedFilledPercent}) </Text> ) : isFilled ? ( <Text as="span" color={theme.primary}> From c7fe712622ee0cc54571e3eebd9b34988c6edff7 Mon Sep 17 00:00:00 2001 From: viet-nv <vietnv1304@gmail.com> Date: Wed, 31 Jan 2024 11:36:26 +0700 Subject: [PATCH 5/5] update prod env --- .../Announcement/PrivateAnnoucement/InboxItemLO.tsx | 2 +- .../PrivateAnnoucement/NotificationCenter/LimitOrder.tsx | 2 +- src/constants/env.ts | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/Announcement/PrivateAnnoucement/InboxItemLO.tsx b/src/components/Announcement/PrivateAnnoucement/InboxItemLO.tsx index b6fb73fcac..23898d57d5 100644 --- a/src/components/Announcement/PrivateAnnoucement/InboxItemLO.tsx +++ b/src/components/Announcement/PrivateAnnoucement/InboxItemLO.tsx @@ -51,7 +51,7 @@ function InboxItemBridge({ const isPartialFilled = status === LimitOrderStatus.PARTIALLY_FILLED const chainId = rawChainId && rawChainId !== '{{.chainId}}' ? (Number(rawChainId) as ChainId) : undefined const statusMessage = isReorg - ? t`Reverted (${increasedFilledPercent})` + ? t`Reverted ${increasedFilledPercent}` : isFilled ? t`100% Filled` : isPartialFilled diff --git a/src/components/Announcement/PrivateAnnoucement/NotificationCenter/LimitOrder.tsx b/src/components/Announcement/PrivateAnnoucement/NotificationCenter/LimitOrder.tsx index 3c6486882e..591991e81d 100644 --- a/src/components/Announcement/PrivateAnnoucement/NotificationCenter/LimitOrder.tsx +++ b/src/components/Announcement/PrivateAnnoucement/NotificationCenter/LimitOrder.tsx @@ -46,7 +46,7 @@ export default function AnnouncementItem({ const statusMessage = isReorg ? ( <Text as="span" color={theme.red}> - reverted ({increasedFilledPercent}) + reverted {increasedFilledPercent} </Text> ) : isFilled ? ( <Text as="span" color={theme.primary}> diff --git a/src/constants/env.ts b/src/constants/env.ts index 2158a67363..f8de26a7a4 100644 --- a/src/constants/env.ts +++ b/src/constants/env.ts @@ -133,12 +133,12 @@ const ANNOUNCEMENT_TEMPLATE_IDS: { [key in EnvKeys]: TemplateConfig } = { }, production: { [PrivateAnnouncementType.PRICE_ALERT]: '29', - [PrivateAnnouncementType.LIMIT_ORDER]: '12,13,14,15', + [PrivateAnnouncementType.LIMIT_ORDER]: '12,13,14,15,31', [PrivateAnnouncementType.BRIDGE_ASSET]: '10,11', [PrivateAnnouncementType.CROSS_CHAIN]: '27,28', [PrivateAnnouncementType.ELASTIC_POOLS]: '17,18', [PrivateAnnouncementType.DIRECT_MESSAGE]: '', - EXCLUDE: '2,16,19,9,25,24,21,22', + EXCLUDE: '2,16,19,9,25,24,21,22,25,26,30', }, }