diff --git a/src/components/actionBar/index.tsx b/src/components/actionBar/index.tsx
index a54a09431..e63c93db8 100644
--- a/src/components/actionBar/index.tsx
+++ b/src/components/actionBar/index.tsx
@@ -91,7 +91,9 @@ function ActionBar({ children, text, onClickBack, button }: Props) {
) {
return (
- {noAccount && }
+ {noAccount && (
+
+ )}
{noPassport && location.pathname !== routes.citizenship.path && (
diff --git a/src/containers/application/Header/CurrentApp/ui/AppName/AppName.tsx b/src/containers/application/Header/CurrentApp/ui/AppName/AppName.tsx
index 3a58090f4..97c7abdd0 100644
--- a/src/containers/application/Header/CurrentApp/ui/AppName/AppName.tsx
+++ b/src/containers/application/Header/CurrentApp/ui/AppName/AppName.tsx
@@ -9,7 +9,10 @@ import styles from './AppName.module.scss';
function AppName() {
let { pathname } = useLocation();
- const isRobot = pathname.includes('@') || pathname.includes('neuron/');
+ const isRobot =
+ pathname.includes('@') ||
+ pathname.includes('neuron/') ||
+ pathname.includes('robot');
const isOracle = pathname.includes('oracle');
if (isRobot) {
diff --git a/src/containers/application/Header/CurrentApp/utils/findSelectAppByUrl.ts b/src/containers/application/Header/CurrentApp/utils/findSelectAppByUrl.ts
index aa7ff0cb1..a6f10212d 100644
--- a/src/containers/application/Header/CurrentApp/utils/findSelectAppByUrl.ts
+++ b/src/containers/application/Header/CurrentApp/utils/findSelectAppByUrl.ts
@@ -10,7 +10,8 @@ const findSelectAppByUrl = (
address: Option
) => {
let pathname = url;
- const isRobot = url.includes('@') || url.includes('neuron/');
+ const isRobot =
+ url.includes('@') || url.includes('neuron/') || url.includes('robot');
const isOracle = url.includes('oracle');
const isCyberver = url.includes('cyberver');
diff --git a/src/containers/application/Header/SwitchAccount/SwitchAccount.tsx b/src/containers/application/Header/SwitchAccount/SwitchAccount.tsx
index 7a72f1897..b76bc1ff5 100644
--- a/src/containers/application/Header/SwitchAccount/SwitchAccount.tsx
+++ b/src/containers/application/Header/SwitchAccount/SwitchAccount.tsx
@@ -240,12 +240,12 @@ function SwitchAccount() {
setControlledVisible={setControlledVisible}
image={require('../../../../image/sigma.png')}
/>
-
+ /> */}
);
diff --git a/src/pages/Hub/components/DisplayHub/DisplayHub.tsx b/src/pages/Hub/components/DisplayHub/DisplayHub.tsx
index d4e81559e..15d9d1500 100644
--- a/src/pages/Hub/components/DisplayHub/DisplayHub.tsx
+++ b/src/pages/Hub/components/DisplayHub/DisplayHub.tsx
@@ -18,6 +18,7 @@ function DisplayHub({
}) {
return (
) => {
return (
{links.map((link, index) => {
const count = counts[link.name] || 0;
+ if (link.onlyOwner && !isOwner) {
+ return null;
+ }
+
return (
-
}>
{newUser ? (
- } />
+ <>
+ } />
+ } />
+ >
) : (
}>
- : } />
+ } />
} />
+
+ {/* energy */}
+ }
+ />
{['energy', 'energy/:pageId'].map((path) => (
} />
))}
@@ -54,6 +70,18 @@ function RobotRoutes() {
} />
))}
+ } />
+ } />
+
+ } />
+ {/*
+ {['tokens', 'networks', 'channels'].map((path) => (
+ } />
+ ))} */}
+ } />
+ } />
+ } />
+
} />
Page should not exist
} />
diff --git a/src/pages/robot/robot.context.tsx b/src/pages/robot/robot.context.tsx
index 632068386..2c78abb5e 100644
--- a/src/pages/robot/robot.context.tsx
+++ b/src/pages/robot/robot.context.tsx
@@ -1,13 +1,12 @@
-import React, { useCallback, useEffect, useMemo, useState } from 'react';
+import React, { useCallback, useMemo, useState } from 'react';
import { useParams, useLocation, useNavigate } from 'react-router-dom';
-import { CHAIN_ID } from 'src/constants/config';
import usePassportByAddress from 'src/features/passport/hooks/usePassportByAddress';
import usePassportContract from 'src/features/passport/usePassportContract';
import { selectCurrentAddress } from 'src/redux/features/pocket';
import { useAppSelector } from 'src/redux/hooks';
import { routes } from 'src/routes';
import { Citizenship } from 'src/types/citizenship';
-import { Networks } from 'src/types/networks';
+import { isPussyChain } from 'src/utils/chains/pussy';
import { fromBech32 } from 'src/utils/utils';
const RobotContext = React.createContext<{
@@ -113,7 +112,7 @@ function RobotContextProvider({ children }: { children: React.ReactNode }) {
}
isOwner = isOwner as boolean;
- let query = {};
+ let query;
if (address) {
query = {
active_passport: {
@@ -130,64 +129,33 @@ function RobotContextProvider({ children }: { children: React.ReactNode }) {
const passportContract = usePassportContract({
query,
- skip: isOwner,
+ skip: isOwner || !query,
});
const currentPassport = isOwner ? currentUserPassport : passportContract;
let currentRobotAddress = address || currentPassport.data?.owner || null;
- if (CHAIN_ID === Networks.SPACE_PUSSY && currentRobotAddress) {
+ if (isPussyChain && currentRobotAddress) {
currentRobotAddress = fromBech32(currentRobotAddress, 'pussy');
}
- const isLoading = currentPassport.loading;
-
- // redirect from /robot to /@nickname
- const newUser =
- !passportContract.loading &&
- !currentUserPassport.loading &&
- !currentRobotAddress;
-
- // redirects
- useEffect(() => {
- if (
- newUser &&
- location.pathname.includes(routes.robot.path) &&
- // allowed routes
- ![
+ if (
+ robotUrl &&
+ currentUserPassport.data &&
+ currentAddress === currentUserPassport.data.owner
+ ) {
+ navigate(
+ location.pathname.replace(
routes.robot.path,
- routes.robot.routes.drive.path,
- routes.robot.routes.sense.path,
- ].includes(location.pathname)
- ) {
- navigate(routes.robot.path);
- }
-
- if (
- robotUrl &&
- currentUserPassport.data &&
- currentAddress === currentUserPassport.data.owner
- ) {
- navigate(
- location.pathname.replace(
- routes.robot.path,
- routes.robotPassport.getLink(
- currentUserPassport.data.extension.nickname
- )
- ),
- {
- replace: true,
- }
- );
- }
- }, [
- location.pathname,
- robotUrl,
- currentUserPassport.data,
- newUser,
- currentAddress,
- navigate,
- ]);
+ routes.robotPassport.getLink(
+ currentUserPassport.data.extension.nickname
+ )
+ ),
+ {
+ replace: true,
+ }
+ );
+ }
const addRefetch = useCallback(
(func: () => void) => {
@@ -200,6 +168,8 @@ function RobotContextProvider({ children }: { children: React.ReactNode }) {
refetchFuncs.forEach((func) => func());
}, [refetchFuncs]);
+ const isLoading = currentPassport.loading;
+
const contextValue = useMemo(
() => ({
address: currentRobotAddress,
diff --git a/src/router.tsx b/src/router.tsx
index 2e1912015..8f73a59ae 100644
--- a/src/router.tsx
+++ b/src/router.tsx
@@ -120,7 +120,10 @@ function AppRouter() {
} />
} />
- } />
+ }
+ />
} />
} />
diff --git a/src/routes.ts b/src/routes.ts
index b994231cc..69e37b104 100644
--- a/src/routes.ts
+++ b/src/routes.ts
@@ -51,6 +51,15 @@ export const routes = {
soul: {
path: '/robot/soul',
},
+ keys: {
+ path: '/robot/keys',
+ },
+ audio: {
+ path: '/robot/audio',
+ },
+ hub: {
+ path: '/robot/hub',
+ },
},
},
robotPassport: {