Skip to content

Commit 42e4464

Browse files
committed
Squash
Try to implement Shadow liquidity widget UI Continue Refactor Chore Refactor add liquidity UI Route preview Information tab layout Apr chart first look Continue Try improve Update review modal Refactor add liquidity Continue Update packages typesVersions Update import Add useFeedback Continue Refactor hooks Minor logic components Refactor components Continue Continue Just push but no verify Skeleton responsive Continue Update TokenSelector sort behavior Chore Refactor Information tab Refactor Chore fix Chore Update review modal Cont update TokenSelector Chore Improve logic REviewModal Improve review modal Continue Analytics first look
1 parent 54bc410 commit 42e4464

File tree

76 files changed

+8378
-103
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+8378
-103
lines changed

apps/kyberswap-interface/.env.production

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ VITE_REFERRAL_URL=https://referral.kyberswap.com/api
4545

4646
VITE_TOKEN_API_URL=https://token-api.kyberswap.com/api
4747
VITE_ZAP_EARN_URL=https://earn-service.kyberswap.com/api
48+
VITE_ZAP_EARN_ANALYTICS_URL=https://pre-zap-earn-service.kyberengineering.io/api
4849

4950
VITE_AFFILIATE_SERVICE=https://affiliate-service.kyberswap.com/api
5051
VITE_SOLANA_RPC=https://solana.kyberengineering.io

apps/kyberswap-interface/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@
3939
"ChromeAndroid >= 52"
4040
],
4141
"dependencies": {
42-
"@kyber/rpc-client": "workspace:*",
4342
"@across-protocol/app-sdk": "^0.4.4",
4443
"@bitcoinerlab/secp256k1": "^1.2.0",
4544
"@defuse-protocol/one-click-sdk-typescript": "^0.1.2",
@@ -192,6 +191,8 @@
192191
"@babel/preset-react": "^7.18.6",
193192
"@babel/preset-typescript": "^7.21.4",
194193
"@cypress/grep": "^3.1.5",
194+
"@kyber/hooks": "workspace:^",
195+
"@kyber/rpc-client": "workspace:*",
195196
"@kyber/schema": "workspace:^",
196197
"@kyber/token-selector": "workspace:^",
197198
"@kyber/ui": "workspace:^",
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 10 additions & 0 deletions
Loading
Lines changed: 8 additions & 0 deletions
Loading
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
import type { CSSProperties, ComponentProps } from 'react'
2+
import { Box } from 'rebass/styled-components'
3+
import styled from 'styled-components'
4+
5+
const getSpacing = (value?: CSSProperties['gap']) => {
6+
if (typeof value === 'number') {
7+
return `${value}px`
8+
}
9+
return value
10+
}
11+
12+
const getLength = (value?: CSSProperties['borderRadius']) => {
13+
if (typeof value === 'number') return `${value}px`
14+
return value
15+
}
16+
17+
type BoxProps = ComponentProps<typeof Box>
18+
19+
type StackStyleProps = Pick<
20+
CSSProperties,
21+
| 'alignItems'
22+
| 'background'
23+
| 'border'
24+
| 'borderRadius'
25+
| 'columnGap'
26+
| 'flexDirection'
27+
| 'flexWrap'
28+
| 'gap'
29+
| 'justifyContent'
30+
| 'position'
31+
| 'rowGap'
32+
>
33+
34+
export type StackProps = BoxProps &
35+
StackStyleProps & {
36+
direction?: StackStyleProps['flexDirection']
37+
spacing?: StackStyleProps['gap']
38+
align?: StackStyleProps['alignItems']
39+
justify?: StackStyleProps['justifyContent']
40+
wrap?: StackStyleProps['flexWrap']
41+
}
42+
43+
export const Stack = styled(Box)<StackProps>`
44+
display: flex;
45+
position: ${({ position }) => position};
46+
flex-direction: ${({ direction }) => direction || 'column'};
47+
align-items: ${({ alignItems, align }) => alignItems || align || 'stretch'};
48+
justify-content: ${({ justifyContent, justify }) => justifyContent || justify || 'flex-start'};
49+
flex-wrap: ${({ wrap }) => wrap || 'nowrap'};
50+
gap: ${({ gap, spacing }) => getSpacing(gap || spacing)};
51+
row-gap: ${({ rowGap }) => getSpacing(rowGap)};
52+
column-gap: ${({ columnGap }) => getSpacing(columnGap)};
53+
background: ${({ background }) => background};
54+
border: ${({ border }) => border};
55+
border-radius: ${({ borderRadius }) => getLength(borderRadius)};
56+
`
57+
58+
export const HStack = styled(Stack)`
59+
flex-direction: row;
60+
`

apps/kyberswap-interface/src/components/TradeRouting/index.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,10 @@ const Routing = ({
184184
handleScroll()
185185
}, [tradeComposition, maxHeight, handleScroll])
186186

187-
const isSwapRouteV3 = tradeComposition?.every(item => 'pool' in item)
187+
const isSwapRouteV3 =
188+
(tradeComposition as Array<SwapRouteV2 | SwapRouteV3> | undefined)?.every(
189+
(item): item is SwapRouteV3 => 'pool' in item,
190+
) ?? false
188191

189192
return (
190193
<Shadow ref={shadowRef}>

apps/kyberswap-interface/src/components/ZapCreatePool/CreatePoolModal.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,15 +281,13 @@ const CreatePoolModal = ({ isOpen, filterChainId, onDismiss, onSubmit }: Props)
281281
fullWidth
282282
options={chainOptions}
283283
value={selectedChainId.toString()}
284-
alignLeft
285284
mobileFullWidth
286285
onChange={value => setSelectedChainId(Number(value) as ChainId)}
287286
/>
288287
<DropdownMenu
289288
fullWidth
290289
options={protocolOptions}
291290
value={selectedProtocol}
292-
alignLeft
293291
mobileFullWidth
294292
onChange={value => setSelectedProtocol(value as Exchange)}
295293
/>

apps/kyberswap-interface/src/constants/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ export const APP_PATHS = {
147147
PARTNER_SWAP: '/partner-swap',
148148
FIND_POOL: '/find',
149149
POOLS: '/pools',
150+
ADD_LIQUIDITY: '/pools/add-liquidity',
150151
CLASSIC_CREATE_POOL: '/create',
151152
CLASSIC_ADD_LIQ: '/add',
152153
CLASSIC_REMOVE_POOL: '/remove',

apps/kyberswap-interface/src/hooks/usePermitNft.ts

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ export const usePermitNft = ({ contractAddress, tokenId, spender, deadline, vers
4949
const notify = useNotify()
5050
const [isSigningInProgress, setIsSigningInProgress] = useState(false)
5151
const [permitData, setPermitData] = useState<PermitNftResult | null>(null)
52-
const [detectedVersion, setDetectedVersion] = useState<'v3' | 'v4' | null>(null)
5352

5453
const nftContract = useReadingContract(contractAddress, NFT_PERMIT_ABI)
5554

@@ -66,20 +65,11 @@ export const usePermitNft = ({ contractAddress, tokenId, spender, deadline, vers
6665
const actualVersion = useMemo(() => {
6766
if (version !== 'auto') return version
6867

69-
if (detectedVersion) return detectedVersion
68+
if (noncesState?.result && !noncesState.error) return 'v4'
69+
if (positionsState?.result && !positionsState.error) return 'v3'
7070

71-
if (noncesState?.result && !noncesState.error) {
72-
setDetectedVersion('v4')
73-
return 'v4'
74-
}
75-
76-
// Try to detect based on available data
77-
if (positionsState?.result && !positionsState.error) {
78-
setDetectedVersion('v3')
79-
return 'v3'
80-
}
8171
return 'v4' // Default to v4 if uncertain
82-
}, [version, detectedVersion, positionsState, noncesState])
72+
}, [version, positionsState, noncesState])
8373

8474
const permitState = useMemo(() => {
8575
if (!account || !contractAddress || !tokenId || !spender) {

0 commit comments

Comments
 (0)