diff --git a/src/components/containerGradient/Display/Display.module.scss b/src/components/containerGradient/Display/Display.module.scss index 11a60f623..097ce75fe 100644 --- a/src/components/containerGradient/Display/Display.module.scss +++ b/src/components/containerGradient/Display/Display.module.scss @@ -1,11 +1,10 @@ -@import '../saber/index.module.scss'; -@import './variables.module.scss'; -@import '../../../style/mixins.scss'; +@import '../saber/index.module'; +@import './variables.module'; +@import '../../../style/mixins'; .wrapper { // TODO: remove this z-index: 0; - display: flex; flex-direction: column; @@ -46,13 +45,9 @@ .inner { padding: $display-padding-top $display-padding-x; overflow: auto; - height: 100%; max-height: 100%; - // unclear gap, because of overflow:auto - margin-top: -0.5px; - @include blueScroll; } @@ -71,4 +66,4 @@ } @include blueScroll; -} \ No newline at end of file +} diff --git a/src/components/ledger/stageActionBar.jsx b/src/components/ledger/stageActionBar.jsx index c02175441..41259c60c 100644 --- a/src/components/ledger/stageActionBar.jsx +++ b/src/components/ledger/stageActionBar.jsx @@ -59,9 +59,9 @@ export function TransactionSubmitted() { export function Confirmed({ txHash, txHeight, cosmos, onClickBtnClose }) { return ( - + - Transaction + Transaction successful:{' '} {cosmos ? ( {trimString(txHash, 6, 6)} diff --git a/src/containers/mint/index.tsx b/src/containers/mint/index.tsx index 202fab037..484fb0147 100644 --- a/src/containers/mint/index.tsx +++ b/src/containers/mint/index.tsx @@ -16,6 +16,7 @@ import { FormatNumberTokens, } from 'src/components'; import { formatNumber, getDisplayAmount } from 'src/utils/utils'; +import { DENOM_LIQUID } from 'src/constants/config'; import useGetSlots from './useGetSlots'; import { TableSlots } from '../energy/ui'; import ActionBar from './actionBar'; @@ -32,7 +33,6 @@ import RcSlider from './components/Slider/Slider'; import InfoText from './InfoText/InfoText'; import LiquidBalances from './LiquidBalances/LiquidBalances'; import ERatio from './components/ERatio/ERatio'; -import { DENOM_LIQUID } from 'src/constants/config'; const returnColorDot = (marks) => { return { @@ -228,7 +228,7 @@ function Mint() { {loadingAuthAccounts ? ( ) : ( - + )} diff --git a/src/hocs/withIpfsAndKeplr.tsx b/src/hocs/withIpfsAndKeplr.tsx index 3d06e5638..59ea25851 100644 --- a/src/hocs/withIpfsAndKeplr.tsx +++ b/src/hocs/withIpfsAndKeplr.tsx @@ -1,19 +1,24 @@ +import React from 'react'; import { useBackend } from 'src/contexts/backend/backend'; +import { useQueryClient } from 'src/contexts/queryClient'; import { useSigningClient } from 'src/contexts/signerClient'; -const withIpfsAndKeplr = (Component) => (props) => { - const { ipfsApi, senseApi } = useBackend(); - const { signer, signingClient } = useSigningClient(); +const withIpfsAndKeplr = (Component: React.ComponentType) => + function WithIpfsAndKeplr(props: any) { + const { ipfsApi, senseApi } = useBackend(); + const { signer, signingClient } = useSigningClient(); + const queryClient = useQueryClient(); - return ( - - ); -}; + return ( + + ); + }; export default withIpfsAndKeplr; diff --git a/src/pages/Social/Discord/Discord.tsx b/src/pages/Social/Discord/Discord.tsx index ed89421c5..a5660f41e 100644 --- a/src/pages/Social/Discord/Discord.tsx +++ b/src/pages/Social/Discord/Discord.tsx @@ -3,7 +3,7 @@ import discordIcon from './discord-icon.svg'; function Discord() { return ( - + Discord Discord diff --git a/src/pages/Social/Social.tsx b/src/pages/Social/Social.tsx index 8d8493c40..95a8a882a 100644 --- a/src/pages/Social/Social.tsx +++ b/src/pages/Social/Social.tsx @@ -1,11 +1,10 @@ import { LinkWindow, MainContainer } from 'src/components'; import Discord from 'src/pages/Social/Discord/Discord'; import { GitHub } from 'src/pages/Social/GitHub/GitHub'; -import { Telegram } from 'src/pages/Social/Telegram/Telegram'; +import Telegram from 'src/pages/Social/Telegram/Telegram'; import Display from 'src/components/containerGradient/Display/Display'; import DisplayTitle from 'src/components/containerGradient/DisplayTitle/DisplayTitle'; -import { useAdviser } from 'src/features/adviser/context'; -import { useEffect } from 'react'; +import useAdviserTexts from 'src/features/adviser/useAdviserTexts'; import Twitter from './Twitter/Twitter'; import styles from './Social.module.scss'; @@ -13,11 +12,9 @@ export const HUB_LINK = 'https://docs.cyb.ai/#/page/aicosystem'; // TODO: folder is dirty, can be refactored function Social() { - const { setAdviser } = useAdviser(); - - useEffect(() => { - setAdviser('join our community!'); - }, [setAdviser]); + useAdviserTexts({ + defaultText: 'join our community 🤖', + }); return ( diff --git a/src/pages/Social/Telegram/Telegram.tsx b/src/pages/Social/Telegram/Telegram.tsx index 20437bfec..9de4f4ee0 100644 --- a/src/pages/Social/Telegram/Telegram.tsx +++ b/src/pages/Social/Telegram/Telegram.tsx @@ -1,133 +1,29 @@ -import Tooltip from '../../../components/tooltip/tooltip'; -import share from '../../../image/share.svg'; import telegram from './telegram-icon.svg'; import { LinkWindow } from '../../../components/link/link'; -import useMediaQuery from '../../../hooks/useMediaQuery'; -import React from 'react'; import styles from './Telegram.module.scss'; -export function Telegram() { - // const mediaQuery = useMediaQuery('(min-width: 768px)'); - - if (true) { - return ( -
- - telegram - - t/eng - +function Telegram() { + return ( +
+ + telegram - - telegram + t/eng + - t/ru - + + telegram - - telegram + t/news + - t/news - -
- ); - } + + telegram - return ( - //
- - -
- feedback{' '} - share -
-
- -
- join movement{' '} - share -
-
-
- } - > - -
- telegram -
+ t/validators
- - // {/*
*/} + ); } + +export default Telegram; diff --git a/src/pages/Social/Twitter/Twitter.tsx b/src/pages/Social/Twitter/Twitter.tsx index 3ae8c1690..dbdac688b 100644 --- a/src/pages/Social/Twitter/Twitter.tsx +++ b/src/pages/Social/Twitter/Twitter.tsx @@ -5,7 +5,7 @@ function Twitter() { return ( Twitter - twitter + x (twitter) ); } diff --git a/src/pages/oracle/landing/OracleLanding.tsx b/src/pages/oracle/landing/OracleLanding.tsx index 22aad12e3..dce4162d8 100644 --- a/src/pages/oracle/landing/OracleLanding.tsx +++ b/src/pages/oracle/landing/OracleLanding.tsx @@ -1,14 +1,13 @@ import { ActionBar, Button, Tabs } from 'src/components'; import { routes } from 'src/routes'; -import { useRef, useState } from 'react'; +import { useEffect, useRef, useState } from 'react'; // import CyberlinksGraphContainer from 'src/features/cyberlinks/CyberlinksGraph/CyberlinksGraphContainer'; import { Stars } from 'src/containers/portal/components'; -import { useDevice } from 'src/contexts/device'; - import { useAppDispatch } from 'src/redux/hooks'; import { setFocus } from 'src/containers/application/Header/Commander/commander.redux'; -import { Link, useNavigate, useSearchParams } from 'react-router-dom'; + +import { Link, useSearchParams } from 'react-router-dom'; import useAdviserTexts from 'src/features/adviser/useAdviserTexts'; import styles from './OracleLanding.module.scss'; import KeywordButton from './components/KeywordButton/KeywordButton'; @@ -33,9 +32,8 @@ const listConfig = { ), description: ( <> - decentralized search is just one{' '} - cyber app{' '} - aip + decentralized ipfs{' '} + search ), }, @@ -77,40 +75,16 @@ function OracleLanding() { const [titleType, setTitleType] = useState(TitleType.ai); - const [isRenderGraph, setIsRenderGraph] = useState(false); - - const { viewportWidth } = useDevice(); - const navigate = useNavigate(); - const ref = useRef(null); const dispatch = useAppDispatch(); - const graphSize = 220; - const isMobile = - viewportWidth <= Number(styles.mobileBreakpoint.replace('px', '')); - useAdviserTexts({ defaultText: 'ask your question', }); - // useEffect(() => { - // dispatch(setFocus(true)); - - // const timeout = setTimeout(() => { - // setIsRenderGraph(true); - // }, 1000 * 1.5); - - // return () => { - // clearTimeout(timeout); - // }; - // }, [dispatch]); - - // useEffect(() => { - // if (!ref.current) { - // return; - // } - // ref.current.style.setProperty('--graph-size', `${graphSize}px`); - // }, [ref, graphSize]); + useEffect(() => { + dispatch(setFocus(true)); + }, [dispatch]); const { title, description, text } = listConfig[titleType]; diff --git a/src/pages/robot/_refactor/account/actionBar.tsx b/src/pages/robot/_refactor/account/actionBar.tsx index 583d1027f..b4220f25b 100644 --- a/src/pages/robot/_refactor/account/actionBar.tsx +++ b/src/pages/robot/_refactor/account/actionBar.tsx @@ -1,11 +1,22 @@ -/* eslint-disable */ import React, { Component } from 'react'; import { ActionBar } from '@cybercongress/gravity'; +import { PATTERN_IPFS_HASH } from 'src/constants/patterns'; + +import { sendCyberlink } from 'src/services/neuron/neuronApi'; +import { CID_FOLLOW, CID_TWEET } from 'src/constants/app'; +import { routes } from 'src/routes'; +import { createSearchParams } from 'react-router-dom'; +import { AccountValue } from 'src/types/defaultAccount'; +import { useBackend } from 'src/contexts/backend/backend'; +import { useSigningClient } from 'src/contexts/signerClient'; +import { useQueryClient } from 'src/contexts/queryClient'; +import withIpfsAndKeplr from '../../../../hocs/withIpfsAndKeplr'; +import { getTxs } from '../../../../utils/search/utils'; +import { LEDGER } from '../../../../utils/config'; import { TransactionSubmitted, Confirmed, RewardsDelegators, - Cyberlink, StartStageSearchActionBar, TransactionError, Dots, @@ -13,18 +24,6 @@ import { ActionBar as ActionBarComp, Button, } from '../../../../components'; -import { LEDGER } from '../../../../utils/config'; -import { PATTERN_IPFS_HASH } from 'src/constants/patterns'; - -import { getTotalRewards, getTxs } from '../../../../utils/search/utils'; - -import withIpfsAndKeplr from '../../../../hocs/withIpfsAndKeplr'; -import { sendCyberlink } from 'src/services/neuron/neuronApi'; -import { CID_FOLLOW, CID_TWEET } from 'src/constants/app'; -import { routes } from 'src/routes'; -import { createSearchParams } from 'react-router-dom'; -import { AccountValue } from 'src/types/defaultAccount'; -import { DIVISOR_CYBER_G, DEFAULT_GAS_LIMITS } from 'src/constants/config'; const { STAGE_INIT, @@ -46,6 +45,12 @@ type Props = { follow: boolean; tweets: boolean; + signer: ReturnType['signer']; + signingClient: ReturnType['signingClient']; + ipfsApi: ReturnType['ipfsApi']; + senseApi: ReturnType['senseApi']; + queryClient: ReturnType; + updateAddress: () => void; // add more @@ -101,12 +106,13 @@ class ActionBarContainer extends Component { signingClient, ipfsApi, senseApi, + queryClient, } = this.props; - const amount = parseFloat(toSend) * DIVISOR_CYBER_G; - const fee = { - amount: [], - gas: DEFAULT_GAS_LIMITS.toString(), - }; + // const amount = parseFloat(toSend) * DIVISOR_CYBER_G; + // const fee = { + // amount: [], + // gas: DEFAULT_GAS_LIMITS.toString(), + // }; if (signer && signingClient) { const [{ address }] = await signer.getAccounts(); @@ -115,16 +121,23 @@ class ActionBarContainer extends Component { if (type === 'security') { if (address === addressSend) { - const dataTotalRewards = await getTotalRewards(address); - console.log(`dataTotalRewards`, dataTotalRewards); - if (dataTotalRewards !== null && dataTotalRewards.rewards) { + if (!queryClient) { + return; + } + + const dataTotalRewards = await queryClient.delegationTotalRewards( + address + ); + + if (dataTotalRewards?.rewards) { const { rewards } = dataTotalRewards; const validatorAddress = []; Object.keys(rewards).forEach((key) => { - if (rewards[key].reward !== null) { - validatorAddress.push(rewards[key].validator_address); + if (rewards[key].reward) { + validatorAddress.push(rewards[key].validatorAddress); } }); + const gasLimitsRewards = 100000 * Object.keys(validatorAddress).length; const feeRewards = { @@ -132,7 +145,7 @@ class ActionBarContainer extends Component { gas: gasLimitsRewards.toString(), }; - response = await signingClient.withdrawAllRewards( + const response = await signingClient.withdrawAllRewards( address, validatorAddress, feeRewards @@ -294,15 +307,11 @@ class ActionBarContainer extends Component { if (!isOwner) { content.push( diff --git a/src/pages/teleport/bridge/actionBar.bridge.tsx b/src/pages/teleport/bridge/actionBar.bridge.tsx index f5478a0bf..2ca3e3c80 100644 --- a/src/pages/teleport/bridge/actionBar.bridge.tsx +++ b/src/pages/teleport/bridge/actionBar.bridge.tsx @@ -252,7 +252,7 @@ function ActionBar({ stateActionBar }: { stateActionBar: Props }) { return ( - Transaction Successful:{' '} + Transaction successful:{' '} {trimString(txHashIbc, 6, 6)} diff --git a/src/utils/search/utils.ts b/src/utils/search/utils.ts index c0c2e6eaf..2c6d97ae2 100644 --- a/src/utils/search/utils.ts +++ b/src/utils/search/utils.ts @@ -173,19 +173,6 @@ export const getDelegators = async (validatorAddr) => { } }; -export const getTotalRewards = async (delegatorAddr) => { - try { - const response = await axios({ - method: 'get', - url: `${LCD_URL}/distribution/delegators/${delegatorAddr}/rewards`, - }); - return response.data.result; - } catch (e) { - console.log(e); - return null; - } -}; - const getParamSlashing = async () => { try { const response = await axios({ @@ -638,7 +625,8 @@ export const getCreator = async (cid) => { if (h1 === 0) { return response2.data; - } else if (h2 === 0) { + } + if (h2 === 0) { return response.data; }