const StyledContainer = styled.div` padding-top: 34px; width: 1244px; margin: 0 auto; `; const StyledHeader = styled.div` display: flex; align-items: center; justify-content: space-between; `; State.init({ tab: "market", chainId: -1, chainIndex: 0, }); const { CHAIN_LIST, curChain, dexConfig, wethAddress, multicallAddress, multicall, prices, onSwitchChain, switchingChain, addAction, toast, chainId, nativeCurrency, isChainSupported, account, from, } = props; const { type } = dexConfig; if (!account || !isChainSupported) { return ( <Widget src="bluebiu.near/widget/Swap.ChainWarnigBox" props={{ chain: curChain, onSwitchChain: onSwitchChain, switchingChain: switchingChain, theme: dexConfig.theme?.button, }} /> ); } let tabsArray = [ { key: "market", label: "Market" }, { key: "yours", label: "Yours" }, ]; function handleChangeChainIndex(index) { const chain = CHAIN_LIST[index]; onSwitchChain({ chainId: `0x${Number(chain.chain_id).toString(16)}`, }); } return ( <StyledContainer style={dexConfig.theme}> <StyledHeader> <Widget src="bluebiu.near/widget/Lending.CardTabs" props={{ tabs: tabsArray, active: state.tab, onChange: (tab) => { State.update({ tab: tab.key, }); }, }} /> {/* <Widget src="bluebiu.near/widget/Lending.Chains" props={{ chains: CHAIN_LIST, curChain, onSwitchChain, from, onChange: (tab) => { State.update({ tab: tab.key, }); }, }} /> */} <Widget src="bluebiu.near/widget/Lending.CompoundV2.Chains" props={{ from, chains: CHAIN_LIST, chainIndex: state.chainIndex, onChangeChainIndex: handleChangeChainIndex, }} /> </StyledHeader> <Widget src="bluebiu.near/widget/Lending.Content" props={{ dexConfig, wethAddress, multicallAddress, multicall, prices, chainIdNotSupport: !isChainSupported, account, addAction, toast, chainId, nativeCurrency, tab: state.tab, from, }} /> </StyledContainer> );