Skip to content

Commit

Permalink
feat: enable mainnet menu
Browse files Browse the repository at this point in the history
  • Loading branch information
mo4islona authored and belopash committed May 30, 2024
1 parent 936942d commit d17d3a6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 36 deletions.
14 changes: 4 additions & 10 deletions src/AppRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import React from 'react';

import { Navigate, Route, Routes } from 'react-router-dom';

import { demoFeaturesEnabled } from '@hooks/demoFeaturesEnabled.ts';
import { NetworkLayout } from '@layouts/NetworkLayout';
import { NetworkName, useSubsquidNetwork } from '@network/useSubsquidNetwork.ts';
import { AssetsPage } from '@pages/AssetsPage/AssetsPage.tsx';
import { Vesting } from '@pages/AssetsPage/Vesting.tsx';
import { DashboardPage } from '@pages/DashboardPage/DashboardPage.tsx';
Expand All @@ -22,18 +20,14 @@ import { hideLoader } from './index.tsx';
export const AppRoutes = () => {
hideLoader(0);

const { network } = useSubsquidNetwork();

return (
<Routes>
<Route element={<NetworkLayout />} path="/">
<Route element={<Navigate to="/assets" replace={true} />} index />
{demoFeaturesEnabled() || network === NetworkName.Testnet ? (
<Route path="/dashboard">
<Route element={<DashboardPage />} index />
<Route element={<Worker backPath="/dashboard" />} path="workers/:peerId" />
</Route>
) : null}
<Route path="/dashboard">
<Route element={<DashboardPage />} index />
<Route element={<Worker backPath="/dashboard" />} path="workers/:peerId" />
</Route>

<Route path="/assets">
<Route element={<AssetsPage />} index />
Expand Down
30 changes: 4 additions & 26 deletions src/layouts/NetworkLayout/NetworkMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,12 @@ import { Box, Button, buttonClasses, styled } from '@mui/material';
import { Link, useLocation } from 'react-router-dom';

import { useIsWorkerOperator } from '@api/subsquid-network-squid';
import { demoFeaturesEnabled } from '@hooks/demoFeaturesEnabled';
import { AccountIcon } from '@icons/AccountIcon';
import { ComputersIcon } from '@icons/ComputersIcon';
import { ContactsIcon } from '@icons/ContactsIcon';
import { DashboardIcon } from '@icons/DashboardIcon';
import { DocumentIcon } from '@icons/DocumentIcon';
import { OpenInNewIcon } from '@icons/OpenInNewIcon';
import { NetworkName, useSubsquidNetwork } from '@network/useSubsquidNetwork';
import { useWorkersChatUrl } from '@network/useWorkersChat';

interface NetworkMenuProps {
Expand Down Expand Up @@ -135,38 +133,18 @@ export const Item = forwardRef(
);

export const NetworkMenu = ({ onItemClick }: NetworkMenuProps) => {
const { network } = useSubsquidNetwork();
const { isWorkerOperator } = useIsWorkerOperator();
const workersChatUrl = useWorkersChatUrl();

const showMenu = demoFeaturesEnabled() || network === NetworkName.Testnet;

return (
<>
<div style={{ height: '1.125rem' }} />
{/*<Item*/}
{/* LeftIcon={DashboardIcon}*/}
{/* label="Dashboard"*/}
{/* onClick={onItemClick}*/}
{/* path="/network-dashboard"*/}
{/*/>*/}

{showMenu ? (
<Item LeftIcon={DashboardIcon} label="Dashboard" onClick={onItemClick} path="/dashboard" />
) : null}
<Item LeftIcon={DashboardIcon} label="Dashboard" onClick={onItemClick} path="/dashboard" />
<Item LeftIcon={AccountIcon} label="Assets" onClick={onItemClick} path="/assets" />
{showMenu ? (
<>
<Item LeftIcon={ComputersIcon} label="Workers" onClick={onItemClick} path="/workers" />
<Item
LeftIcon={AccountIcon}
label="Delegations"
onClick={onItemClick}
path="/delegations"
/>
<Item LeftIcon={DocumentIcon} label="Gateways" onClick={onItemClick} path="/gateways" />
</>
) : null}
<Item LeftIcon={ComputersIcon} label="Workers" onClick={onItemClick} path="/workers" />
<Item LeftIcon={AccountIcon} label="Delegations" onClick={onItemClick} path="/delegations" />
<Item LeftIcon={DocumentIcon} label="Gateways" onClick={onItemClick} path="/gateways" />

<div style={{ flex: 1 }} />

Expand Down

0 comments on commit d17d3a6

Please sign in to comment.