Skip to content

Commit

Permalink
feat(adviser): add texts (#1069)
Browse files Browse the repository at this point in the history
  • Loading branch information
happylolonly authored Dec 19, 2023
1 parent 0d44f4a commit 530a6c6
Show file tree
Hide file tree
Showing 19 changed files with 221 additions and 19 deletions.
12 changes: 12 additions & 0 deletions src/containers/energy/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { useRobotContext } from 'src/pages/robot/robot.context';
import Display from 'src/components/containerGradient/Display/Display';
import { useAppSelector } from 'src/redux/hooks';
import { selectCurrentAddress } from 'src/redux/features/pocket';
import { useAdviser } from 'src/features/adviser/context';

function RoutedEnergy() {
const location = useLocation();
Expand All @@ -21,6 +22,17 @@ function RoutedEnergy() {

const isOwner = currentAddress === address;

const { setAdviser } = useAdviser();

useEffect(() => {
setAdviser(
<>
place to manage energy wisely. investmint and route <br />
both volts and amperes allow to create cyberlinks
</>
);
}, [setAdviser]);

const {
slotsData,
loadingAuthAccounts,
Expand Down
13 changes: 13 additions & 0 deletions src/containers/gol/table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,25 @@ import { useRobotContext } from 'src/pages/robot/robot.context';
import Display from 'src/components/containerGradient/Display/Display';
import { formatNumber } from '../../utils/utils';
import useGetGol from './getGolHooks';
import { useAdviser } from 'src/features/adviser/context';
import { useEffect } from 'react';

function TableDiscipline() {
const { address } = useRobotContext();

const { resultGol } = useGetGol(address);

const { setAdviser } = useAdviser();

useEffect(() => {
setAdviser(
<>
something really special and rare <br />
it ain't for sale, but you can hustle to earn it
</>
);
}, [setAdviser]);

return (
<Display noPaddingX>
<Table
Expand Down
11 changes: 11 additions & 0 deletions src/containers/governance/governance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { AcceptedCard, ActiveCard, RejectedCard } from './components/card';
import { CardStatisics } from '../../components';
import { CYBER, PROPOSAL_STATUS } from '../../utils/config';
import { formatNumber, coinDecimals } from '../../utils/utils';
import { useAdviser } from 'src/features/adviser/context';

const dateFormat = require('dateformat');

Expand Down Expand Up @@ -46,10 +47,20 @@ function Governance() {
const [communityPoolCyber, setCommunityPoolCyber] = useState(0);
const [staked, setStaked] = useState(0);

const { setAdviser } = useAdviser();

useEffect(() => {
feachMinDeposit();
}, []);

useEffect(() => {
setAdviser(
<>
the place where community will hear you. <br /> propose your idea here
</>
);
}, [setAdviser]);

useEffect(() => {
const getStatistics = async () => {
if (queryClient) {
Expand Down
7 changes: 7 additions & 0 deletions src/containers/nebula/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { replaceSlash, getDisplayAmount } from '../../utils/utils';
// import { getMarketData } from './getMarketData';
import { ColItem, RowItem, NebulaImg } from './components';
import { CYBER } from '../../utils/config';
import { useAdviser } from 'src/features/adviser/context';

function Title({
capData,
Expand Down Expand Up @@ -45,6 +46,12 @@ function Nebula() {
const { dataTotalSupply, marketData } = useAppData();
const [capData, setCapData] = useState({ currentCap: 0, change: 0 });

const { setAdviser } = useAdviser();

useEffect(() => {
setAdviser('nebula');
}, [setAdviser]);

useEffect(() => {
if (Object.keys(dataTotalSupply).length > 0) {
let cap = 0;
Expand Down
9 changes: 8 additions & 1 deletion src/containers/network/customNetwork.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState, useCallback } from 'react';
import { useState, useCallback, useEffect } from 'react';
import { useNavigate } from 'react-router-dom';
import { useNetworks } from 'src/contexts/networks';
import { ActionBarSteps } from '../portal/components';
Expand All @@ -8,6 +8,7 @@ import {
ContainerGradientText,
MainContainer,
} from '../../components';
import { useAdviser } from 'src/features/adviser/context';

function ValueItem({ text, value, onChange }) {
return (
Expand Down Expand Up @@ -44,6 +45,12 @@ function CustomNetwork() {
const { networks, updateNetworks } = useNetworks();
const [customConfig, setCustomConfig] = useState({ ...initValue });

const { setAdviser } = useAdviser();

useEffect(() => {
setAdviser('run your public network inside bostrom ');
}, [setAdviser]);

const onChangeValue = (e, key) => {
const { value } = e.target;
switch (key) {
Expand Down
9 changes: 8 additions & 1 deletion src/containers/network/listNetwork.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { useCallback } from 'react';
import { useCallback, useEffect } from 'react';
import { Link } from 'react-router-dom';
import { useNetworks } from 'src/contexts/networks';
import { CYBER } from '../../utils/config';
import { MainContainer } from '../portal/components';
import { ContainerGradientText } from '../../components';
import BtnPasport from '../portal/pasport/btnPasport';
import { useAdviser } from 'src/features/adviser/context';

function ValueItem({ children }) {
return (
Expand Down Expand Up @@ -35,6 +36,12 @@ const statusCard = (status) => {
function ListNetwork() {
const { networks, updateNetworks } = useNetworks();

const { setAdviser } = useAdviser();

useEffect(() => {
setAdviser('runing cyber networks');
}, [setAdviser]);

const onClickDeleteAddress = useCallback(
(key) => {
const newList = { ...networks };
Expand Down
7 changes: 7 additions & 0 deletions src/containers/sigma/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import ActionBarPortalGift from '../portal/gift/ActionBarPortalGift';
import STEP_INFO from '../portal/gift/utils';
import styles from './Sigma.module.scss';
import DisplayTitle from 'src/components/containerGradient/DisplayTitle/DisplayTitle';
import { useAdviser } from 'src/features/adviser/context';

const valueContext = {
totalCap: 0,
Expand Down Expand Up @@ -44,6 +45,12 @@ function Sigma() {
defaultAccount?.account?.cyber?.bech32 || null
);

const { setAdviser } = useAdviser();

useEffect(() => {
setAdviser('current neurons capital valuation');
}, [setAdviser]);

const superSigma = location.pathname === routes.sigma.path;

const accountsData = useMemo(() => {
Expand Down
11 changes: 11 additions & 0 deletions src/containers/taverna/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import useGetTweets from './useGetTweets';
import ActionBarCont from '../market/actionBarContainer';
import useSetActiveAddress from '../../hooks/useSetActiveAddress';
import { CID_TWEET } from 'src/utils/config';
import { useAdviser } from 'src/features/adviser/context';

const LOAD_COUNT = 10;

Expand All @@ -26,6 +27,16 @@ function Taverna() {

const [itemsToShow, setItemsToShow] = useState(20);

const { setAdviser } = useAdviser();

useEffect(() => {
setAdviser(
<>
real feed. <br /> no ad, no spam, no scam.
</>
);
}, [setAdviser]);

useEffect(() => {
setRankLink(null);
}, [update]);
Expand Down
7 changes: 6 additions & 1 deletion src/containers/temple/Temple.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ function Temple() {
const { setAdviser } = useAdviser();

useEffect(() => {
setAdviser('welcome to cyb');
setAdviser(
<>
welcome to the temple, home for knowledge about cyber and cyb <br />
cybertemple reduces uncertainty
</>
);
}, [setAdviser]);

return (
Expand Down
30 changes: 30 additions & 0 deletions src/containers/warp/Warp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
getMyTokenBalanceNumber,
calculateCounterPairAmount,
} from './utils';
import { useAdviser } from 'src/features/adviser/context';

const tokenADefaultValue = CYBER.DENOM_CYBER;
const tokenBDefaultValue = CYBER.DENOM_LIQUID_TOKEN;
Expand Down Expand Up @@ -69,6 +70,35 @@ function Warp() {
);
const firstEffectOccured = useRef(false);

const { setAdviser } = useAdviser();

useEffect(() => {
let text;

switch (tab) {
case 'add-liquidity':
text = 'play with pools earn more values';
break;
case 'create-pool':
text = (
<>
the unlimited number of variations. combine your favorite tokens{' '}
<br /> cultivate your values. place of cyber alchemists
</>
);

break;
case 'sub-liquidity':
text = 'manage your liquidity';
break;

default:
break;
}

setAdviser(text);
}, [setAdviser, tab]);

useEffect(() => {
if (firstEffectOccured.current) {
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down
2 changes: 1 addition & 1 deletion src/containers/warp/WarpDashboardPools.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function WarpDashboardPools() {
if (loading) {
setAdviser('loading...', 'yellow');
} else {
setAdviser('bostrom pools');
setAdviser('add or sub liquidity. create a pool');
}
}, [setAdviser, loading]);

Expand Down
24 changes: 18 additions & 6 deletions src/features/ipfs/ipfsSettings/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import ComponentLoader from './ipfsComponents/ipfsLoader';
import Drive from '../Drive';
import { useBackend } from 'src/contexts/backend';
import { IPFSNodes } from 'src/services/ipfs/ipfs.d.ts';
import { AdviserColors } from 'src/features/adviser/Adviser/Adviser';

const dataOpts = [IPFSNodes.EXTERNAL, IPFSNodes.EMBEDDED, IPFSNodes.HELIA];

Expand All @@ -45,14 +46,25 @@ function IpfsSettings() {
}
}, []);

const adviserContext = useAdviser();
const { setAdviser } = useAdviser();

useEffect(() => {
adviserContext.setAdviser(
!isIpfsInitialized ? 'trying to connect to ipfs...' : null,
'yellow'
);
}, [adviserContext, isIpfsInitialized]);
let text;
let status: AdviserColors = undefined;
if (!isIpfsInitialized) {
text = 'trying to connect to ipfs...';
status = 'yellow';
} else {
text = (
<>
manage and store neurones public data drive <br />
drive storing data forever before the 6th great extinction
</>
);
}

setAdviser(text, status);
}, [setAdviser, isIpfsInitialized]);

const onChangeSelect = (item) => {
setValueSelect(item);
Expand Down
24 changes: 24 additions & 0 deletions src/pages/robot/Brain/Brain.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { useEffect } from 'react';
import { useAdviser } from 'src/features/adviser/context';
import CyberlinksGraphContainer from 'src/features/cyberlinks/CyberlinksGraph/CyberlinksGraphContainer';
import { useRobotContext } from '../robot.context';

const limit = 1000;

function Brain() {
const { address } = useRobotContext();
const { setAdviser } = useAdviser();

useEffect(() => {
setAdviser(
<>
neurons public knowledge cybergraph <br />
that is how last {limit} cyberlinks looks like
</>
);
}, [setAdviser]);

return <CyberlinksGraphContainer limit={limit} address={address} toPortal />;
}

export default Brain;
17 changes: 15 additions & 2 deletions src/pages/robot/Karma/Karma.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
import { ContainerGradientText } from 'src/components';
import UnderConstruction from '../UnderConstruction/UnderConstruction';
import { useAdviser } from 'src/features/adviser/context';
import { useEffect } from 'react';

function Karma() {
return <ContainerGradientText>Karma page</ContainerGradientText>;
const { setAdviser } = useAdviser();

useEffect(() => {
setAdviser(
<>
the invisible power of cyber graph influence <br />
more karma more particles weight
</>
);
}, [setAdviser]);

return <UnderConstruction />;
}

export default Karma;
10 changes: 4 additions & 6 deletions src/pages/robot/Robot.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ import TableDiscipline from 'src/containers/gol/table';
import IpfsSettings from 'src/features/ipfs/ipfsSettings';
import Sigma from 'src/containers/sigma';
import Taverna from 'src/containers/taverna';
import CyberlinksGraphContainer from 'src/features/cyberlinks/CyberlinksGraph/CyberlinksGraphContainer';
import Layout from './Layout/Layout';
import RoutedEnergy from '../../containers/energy/index';
import UnderConstruction from './UnderConstruction/UnderConstruction';
import ZeroUser from './ZeroUser/ZeroUser';
import RobotContextProvider, { useRobotContext } from './robot.context';
import Brain from './Brain/Brain';
import Karma from './Karma/Karma';

function RobotRoutes() {
const { isOwner, isLoading, address } = useRobotContext();
Expand All @@ -38,11 +39,8 @@ function RobotRoutes() {
<Route path="log" element={<FeedsTab />} />
<Route path="energy/*" element={<RoutedEnergy />} />
<Route path="swarm" element={<FollowsTab />} />
<Route
path="brain"
element={<CyberlinksGraphContainer address={address} toPortal />}
/>
<Route path="karma" element={<UnderConstruction />} />
<Route path="brain" element={<Brain />} />
<Route path="karma" element={<Karma />} />
<Route path="soul" element={<UnderConstruction />} />

<Route path="*" element={<p>Page should not exist</p>} />
Expand Down
Loading

0 comments on commit 530a6c6

Please sign in to comment.