Skip to content
Open
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
9 changes: 7 additions & 2 deletions src/components/Footer/Footer.component.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { socialLinks } from '@/constants/socialLinks'
import { Link } from 'react-router-dom'
import { Link, useLocation } from 'react-router-dom'
import { Icon } from '../icon'
import { type FC } from 'react'
import { useAccount } from 'wagmi'
import { privateRoutes } from '@/constants'

export const Footer: FC = () => {
const { isConnected: isWalletConnected } = useAccount()

const location = useLocation()
const isPrivateRoute = privateRoutes.includes(location.pathname)

return (
<footer className={`${!isWalletConnected ? 'disconnected' : ''}`}>
<footer className={`${(!isWalletConnected && isPrivateRoute) ? 'disconnected' : ''}`}>
<div className="info">&copy; 2024 Cedro Labs All rights reserved</div>
<div className="socials">
{socialLinks.map((social, key) => (
Expand Down
38 changes: 20 additions & 18 deletions src/components/Navbar/NavbarSharedCompoent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export const WalletActions: FC = () => {
/>
{isWalletConnected
? (
<>
<div className="right">
{
NETWORK_TYPE !== 'mainnet'
Expand All @@ -100,33 +101,34 @@ export const WalletActions: FC = () => {
: null
}

<div className="switch-network">
<SwitchNetworkDropdown />
<div className="switch-network">
<SwitchNetworkDropdown />
</div>

<div className="wallet-info">
<span className="wallet-balance">
${' '}
{toFixedCutZero(aggregateDollarValue.toString() ?? '', 2, true)}
</span>
<AvailableTokens />
</div>
</div>
<div className="line-separator txn-history-line-seperator"></div>

<div className="wallet-info">
<span className="wallet-balance">
$ {toFixedCutZero(aggregateDollarValue.toString() ?? '', 2, true)}
</span>
<AvailableTokens />
<div className="txn-history-link-btn">
<div className="transaction-history">
<Link to={'/history'}>
<Icon name="history" height={24} width={24} color="#5549F9" />
</Link>
</div>
</div>
</div>
</>
)
: (
<div className="right-false">
<WalletConnect togglerVariant='ghost' />
</div>
)}

<div className="line-separator txn-history-line-seperator"></div>

<div className="txn-history-link-btn">
<div className="transaction-history">
<Link to={'/history'}>
<Icon name="history" height={24} width={24} color="#5549F9" />
</Link>
</div>
</div>
</>
)
}
8 changes: 6 additions & 2 deletions src/components/layout/Layout.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import { type FC, type ReactNode } from 'react'
import { Icon, type IconStackData, MobileNav, Navbar, WalletConnect, MobileNotSupported, DashboardHeader } from '@/components'
import { Tooltip } from 'react-tooltip'
import { useScreenSize } from '@/hooks/useScreenSize'
import { MOBILE_SCREEN_SIZE } from '@/constants'
import { MOBILE_SCREEN_SIZE, privateRoutes } from '@/constants'
import { Footer } from '../Footer'
import { useAccount } from 'wagmi'
import { useLocation } from 'react-router-dom'

interface LayoutProps {
children: ReactNode
Expand All @@ -17,14 +18,17 @@ export const Layout: FC<LayoutProps> = ({
}): JSX.Element => {
const screenSize = useScreenSize()
const { isConnected: isWalletConnected } = useAccount()
const location = useLocation()

const isPrivateRoute = privateRoutes.includes(location.pathname)

if (screenSize.width < 500) return <MobileNotSupported />

return (
<div className={`site-layout ${className}`}>
<div className="dashboard-layout wrapper">
{screenSize.width > MOBILE_SCREEN_SIZE ? <Navbar /> : <MobileNav />}
{!isWalletConnected
{(!isWalletConnected && isPrivateRoute)
? (
<div className='dashboard-not-connected'>
<DashboardHeader showInfo />
Expand Down
2 changes: 2 additions & 0 deletions src/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ export const NETWORK_SWITCH_TYPE = {
ASSETS_IN: 'assets',
ACTIONS_ORIGINATE: 'actions'
} as const

export const privateRoutes = ['/dashboard', '/history']
32 changes: 27 additions & 5 deletions src/containers/market.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
AccordionTable,
Price,
LiquidityTooltip,
TokenInfo
TokenInfo,
WalletConnect
// TableLayout,
// TokenInfo
} from '@/components'
Expand Down Expand Up @@ -39,7 +40,7 @@ import { IconStack, type IconStackData } from '@/components'
import { NETWORK_TYPE } from '@/configs/env'
import { BarDiagram } from '@/components/BarDiagram'
import { floatSortingFn } from '@/utils/misc'
import { useNetwork } from 'wagmi'
import { useAccount, useNetwork } from 'wagmi'
import { type IChain } from '@/@types'
import { cedroClient } from '@/configs/chainConfig'
import { type TChipRateDirection } from '@/components/ChipRate/ChipRate.component'
Expand Down Expand Up @@ -230,11 +231,32 @@ export const MarketColumnDefinition: Array<ColumnDef<IDashboardData>> = [
const { nativeChain, supportedChains } = cedroClient.Config.getPoolSupportedChains(poolId)

const selectedChain = connectedChain && supportedChains.includes(connectedChain.chain as tSupportedChains) ? connectedChain.chain as tSupportedChains : nativeChain ?? supportedChains[0]

const { isConnected: isWalletConnected } = useAccount()
return (
<div className="datatable-action-group">
<ProtocolActionButton action = {eProtocolAction.DEPOSIT} poolId={poolId} chain={selectedChain} icon='doubleTriangleUp' />
<ProtocolActionButton action={eProtocolAction.BORROW} poolId={poolId} chain={selectedChain} variant='secondary' icon='doubleTriangleDown' />
{isWalletConnected
? (
<>
<ProtocolActionButton
action={eProtocolAction.DEPOSIT}
poolId={poolId}
chain={selectedChain}
icon="doubleTriangleUp"
/>
<ProtocolActionButton
action={eProtocolAction.BORROW}
poolId={poolId}
chain={selectedChain}
variant="secondary"
icon="doubleTriangleDown"
/>
</>
)
: (
<div onClick={e => { e.stopPropagation() }}>
<WalletConnect />
</div>
)}
</div>
)
},
Expand Down