Skip to content

Commit

Permalink
feat: make portals demo feature
Browse files Browse the repository at this point in the history
  • Loading branch information
belopash committed Oct 24, 2024
1 parent 57d40d9 commit 569032d
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 34 deletions.
1 change: 1 addition & 0 deletions src/AppRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const AppRoutes = () => {
<Route element={<GatewaysPage />} index />
<Route element={<Gateway backPath="/portals" />} path=":peerId" />
</Route>
<Route path="/gateways" element={<Navigate to="/portals" replace={true} />} />
<Route element={<Navigate to="/dashboard" replace={true} />} path="*" />
</Route>
</Routes>
Expand Down
15 changes: 1 addition & 14 deletions src/api/subsquid-network-squid/graphql.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5651,7 +5651,6 @@ export type GatewayFragmentFragment = {
website?: string;
createdAt: string;
owner: { __typename?: 'Account'; id: string; type: AccountType };
realOwner: { __typename?: 'Account'; id: string; type: AccountType };
};

export type GatewayByPeerIdQueryVariables = Exact<{
Expand All @@ -5671,7 +5670,6 @@ export type GatewayByPeerIdQuery = {
website?: string;
createdAt: string;
owner: { __typename?: 'Account'; id: string; type: AccountType };
realOwner: { __typename?: 'Account'; id: string; type: AccountType };
};
};

Expand All @@ -5685,7 +5683,6 @@ export type GatewayStakeFragmentFragment = {
lockStart?: number;
lockEnd?: number;
owner: { __typename?: 'Account'; id: string; type: AccountType };
realOwner: { __typename?: 'Account'; id: string; type: AccountType };
};

export type MyGatewaysQueryVariables = Exact<{
Expand All @@ -5705,7 +5702,6 @@ export type MyGatewaysQuery = {
website?: string;
createdAt: string;
owner: { __typename?: 'Account'; id: string; type: AccountType };
realOwner: { __typename?: 'Account'; id: string; type: AccountType };
}>;
};

Expand All @@ -5725,7 +5721,6 @@ export type MyGatewayStakesQuery = {
lockStart?: number;
lockEnd?: number;
owner: { __typename?: 'Account'; id: string; type: AccountType };
realOwner: { __typename?: 'Account'; id: string; type: AccountType };
}>;
networkStats: {
__typename?: 'NetworkStats';
Expand Down Expand Up @@ -5881,10 +5876,6 @@ export const GatewayFragmentFragmentDoc = `
id
type
}
realOwner {
id
type
}
}
`;
export const GatewayStakeFragmentFragmentDoc = `
Expand All @@ -5893,10 +5884,6 @@ export const GatewayStakeFragmentFragmentDoc = `
id
type
}
realOwner {
id
type
}
autoExtension
amount
computationUnits
Expand Down Expand Up @@ -6469,7 +6456,7 @@ export const useGatewayByPeerIdQuery = <TData = GatewayByPeerIdQuery, TError = u

export const MyGatewaysDocument = `
query myGateways($address: String!) {
gateways(where: {realOwner: {id_eq: $address}, status_not_eq: DEREGISTERED}) {
gateways(where: {owner: {id_eq: $address}, status_not_eq: DEREGISTERED}) {
...GatewayFragment
}
}
Expand Down
10 changes: 1 addition & 9 deletions src/api/subsquid-network-squid/schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,6 @@ fragment GatewayFragment on Gateway {
id
type
}
realOwner {
id
type
}
}

query gatewayByPeerId($peerId: String!) {
Expand All @@ -305,10 +301,6 @@ fragment GatewayStakeFragment on GatewayStake {
id
type
}
realOwner {
id
type
}
autoExtension
amount
computationUnits
Expand All @@ -319,7 +311,7 @@ fragment GatewayStakeFragment on GatewayStake {
}

query myGateways($address: String!) {
gateways(where: { realOwner: { id_eq: $address }, status_not_eq: DEREGISTERED }) {
gateways(where: { owner: { id_eq: $address }, status_not_eq: DEREGISTERED }) {
...GatewayFragment
}
}
Expand Down
15 changes: 9 additions & 6 deletions src/layouts/NetworkLayout/NetworkMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { Button, styled } from '@mui/material';
import { Link, useLocation } from 'react-router-dom';

import { useIsWorkerOperator } from '@api/subsquid-network-squid';
import { demoFeaturesEnabled } from '@hooks/demoFeaturesEnabled';
import { useWorkersChatUrl } from '@network/useWorkersChat';

interface NetworkMenuProps {
Expand Down Expand Up @@ -131,12 +132,14 @@ export const NetworkMenu = ({ onItemClick }: NetworkMenuProps) => {
onClick={onItemClick}
path="/delegations"
/>
<Item
LeftIcon={active => (active ? <SensorDoor /> : <SensorDoorOutlined />)}
label="Portals"
onClick={onItemClick}
path="/portals"
/>
{demoFeaturesEnabled() && (
<Item
LeftIcon={active => (active ? <SensorDoor /> : <SensorDoorOutlined />)}
label="Portals"
onClick={onItemClick}
path="/portals"
/>
)}

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

Expand Down
6 changes: 3 additions & 3 deletions src/pages/WorkersPage/WorkerUndelegate.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useMemo, useState } from 'react';

import { dateFormat, relativeDateFormat } from '@i18n';
import { percentFormatter } from '@lib/formatters/formatters';
import { percentFormatter, tokenFormatter } from '@lib/formatters/formatters';
import { fromSqd, toSqd } from '@lib/network';
import { Lock } from '@mui/icons-material';
import { LoadingButton } from '@mui/lab';
Expand Down Expand Up @@ -254,10 +254,10 @@ function WorkerUndelegateDialog({
</FormRow>
<FormDivider />
<Stack direction="row" justifyContent="space-between" alignContent="center">
<Box>Expected APR</Box>
<HelpTooltip title={EXPECTED_APR_TIP}>
<span>{isExpectedAprPending ? '-' : percentFormatter(stakerApr)}</span>
<Box>Expected APR</Box>
</HelpTooltip>
<span>{isExpectedAprPending ? '-' : percentFormatter(stakerApr)}</span>
</Stack>
</Form>
</ContractCallDialog>
Expand Down
10 changes: 8 additions & 2 deletions src/pages/WorkersPage/WorkersPage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { percentFormatter, tokenFormatter } from '@lib/formatters/formatters.ts';
import { fromSqd } from '@lib/network';
import { Box, Button, Stack, TableBody, TableCell, TableHead, TableRow } from '@mui/material';
import { Outlet } from 'react-router-dom';
import { Link, Outlet } from 'react-router-dom';

import {
SortDir,
Expand Down Expand Up @@ -49,7 +49,13 @@ export function MyWorkers() {
<>
<SquaredChip label="My Workers" color="primary" />
<Stack direction="row" spacing={1}>
<Button color="secondary" variant="outlined">
<Button
color="secondary"
variant="outlined"
component={Link}
target="_blank"
to="https://docs.sqd.dev/subsquid-network/participate/worker/"
>
LEARN MORE
</Button>
<AddWorkerButton sources={sources} disabled={isLoading} />
Expand Down

0 comments on commit 569032d

Please sign in to comment.