Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DO NOT MERGE] Test auth stg #1962

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 12 additions & 5 deletions src/components/Announcement/PrivateAnnoucement/InboxItemLO.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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({
Expand All @@ -44,18 +45,22 @@ 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 ${increasedFilledPercent}`
: isFilled
? t`100% Filled`
: isPartialFilled
? t`${filledPercent} Filled ${increasedFilledPercent}`
: `${filledPercent}% Filled | Expired`

const navigate = useNavigate()
const onClick = () => {
navigate(APP_PATHS.LIMIT)
navigate(`${APP_PATHS.LIMIT}/${NETWORKS_INFO[+templateBody.order.chainId as ChainId]?.route}`)
onRead(announcement, statusMessage)
}

Expand All @@ -68,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} />
)}
Expand All @@ -87,7 +94,7 @@ function InboxItemBridge({
logoURL={takerAssetLogoURL}
/>
<PrimaryText>
{takingAmountRate} {makerAssetSymbol}/{takerAssetSymbol}
{takingAmountRate} {takerAssetSymbol}/{makerAssetSymbol}
</PrimaryText>
</InboxItemRow>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -33,15 +34,21 @@ export default function AnnouncementItem({
takingAmount,
takingAmountRate,
filledPercent,
increasedFilledPercent,
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 ? (
<Text as="span" color={theme.red}>
reverted {increasedFilledPercent}
</Text>
) : isFilled ? (
<Text as="span" color={theme.primary}>
successfully filled
</Text>
Expand All @@ -57,7 +64,7 @@ export default function AnnouncementItem({

const navigate = useNavigate()
return (
<Wrapper onClick={() => navigate(APP_PATHS.LIMIT)}>
<Wrapper onClick={() => navigate(`${APP_PATHS.LIMIT}/${NETWORKS_INFO[chainId || ChainId.MAINNET].route}`)}>
<Flex justifyContent="space-between" width="100%">
<Title>
<InboxIcon type={templateType} chainId={chainId} />
Expand Down
1 change: 1 addition & 0 deletions src/components/Announcement/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
8 changes: 4 additions & 4 deletions src/constants/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,21 +124,21 @@ 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',
[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',
},
}

Expand Down
Loading