Skip to content

Commit

Permalink
Merge pull request #23 from subsquid/main
Browse files Browse the repository at this point in the history
main
  • Loading branch information
belopash authored May 31, 2024
2 parents 226dd2c + fe04167 commit 27ce9ad
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 46 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
echo "::set-output name=app_env::prod"
echo "::set-output name=wc_project_id::475eff0658d0f3300ca18971418d261b"
echo "::set-output name=testnet_squid_api_url::https://subsquid.squids.live/subsquid-network-testnet/v/v1/graphql"
echo "::set-output name=mainnet_squid_api_url::https://subsquid.squids.live/subsquid-network-mainnet/v/v1/graphql"
echo "::set-output name=mainnet_squid_api_url::https://subsquid.squids.live/subsquid-network-mainnet/v/v2/graphql"
echo "::set-output name=enable_demo_features::false"
else
echo "::set-output name=app_env::dev"
Expand Down
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
24 changes: 23 additions & 1 deletion src/components/Logo/Logo.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import React from 'react';

import { Box, styled, useMediaQuery, useTheme } from '@mui/material';
import { upperFirst } from 'lodash-es';

import { useSubsquidNetwork } from '@network/useSubsquidNetwork';

export const LogoWrapper = styled('div', {
name: 'LogoWrapper',
Expand All @@ -11,6 +14,7 @@ export const LogoWrapper = styled('div', {
display: 'block',
marginRight: 2,
},
userSelect: 'none',
}));

export const LogoPrimary = styled(Box, {
Expand All @@ -23,15 +27,33 @@ export const LogoPrimary = styled(Box, {
marginLeft: theme.spacing(0.5),
}));

export const LogoSecondary = styled(Box, {
name: 'LogoSecondary',
})(({ theme }) => ({
fontSize: '16px',
fontWeight: 400,
lineHeight: 1,
letterSpacing: '0 em',
marginLeft: theme.spacing(0.5),
// fontStyle: 'italic',
}));

export function Logo({ color = '#fff' }: { color?: string }) {
const theme = useTheme();
const narrow = useMediaQuery(theme.breakpoints.down('lg'));
const size = 32;

const { network } = useSubsquidNetwork();

return (
<LogoWrapper>
<img width={size} height={size} src="/logo.png" />
{!narrow ? <LogoPrimary sx={{ color }}>SUBSQUID</LogoPrimary> : null}
{!narrow ? (
<>
<LogoPrimary sx={{ color }}>SUBSQUID</LogoPrimary>
<LogoSecondary sx={{ color }}>{upperFirst(network)}</LogoSecondary>
</>
) : null}
</LogoWrapper>
);
}
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
10 changes: 2 additions & 8 deletions src/pages/AssetsPage/Assets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ import { Card } from '@components/Card';
import { CopyToClipboard } from '@components/CopyToClipboard';
import { HelpTooltip } from '@components/HelpTooltip';
import { Loader } from '@components/Loader';
import { demoFeaturesEnabled } from '@hooks/demoFeaturesEnabled';
import { NetworkPageTitle } from '@layouts/NetworkLayout';
import { useContracts } from '@network/useContracts';
import { NetworkName, useSubsquidNetwork } from '@network/useSubsquidNetwork';
import { useSubsquidNetwork } from '@network/useSubsquidNetwork';

import { ClaimButton } from './ClaimButton';

Expand Down Expand Up @@ -148,12 +147,7 @@ export function MyAssets() {

return (
<Box>
<NetworkPageTitle
title="My Assets"
endAdornment={
demoFeaturesEnabled() || network === NetworkName.Testnet ? <ClaimButton /> : null
}
/>
<NetworkPageTitle title="My Assets" endAdornment={<ClaimButton />} />

{isLoading ? (
<Loader />
Expand Down
3 changes: 3 additions & 0 deletions src/theme/theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,9 @@ export const useCreateTheme = (mode: PaletteType) => {
width: '100% !important',
},
},
'*': {
fontVariantLigatures: 'none',
},
},
},
MuiAvatar: {
Expand Down

0 comments on commit 27ce9ad

Please sign in to comment.